curl --request POST \
--url https://api.example.com/api/cards/assign \
--header 'Content-Type: application/json' \
--data '
{
"userId": "<string>",
"source": "<string>"
}
'{
"status": true,
"message": "<string>",
"data": {
"cardId": "<string>",
"brand": "<string>",
"last4": "<string>"
}
}Attach a tokenized card to a Stripe customer
curl --request POST \
--url https://api.example.com/api/cards/assign \
--header 'Content-Type: application/json' \
--data '
{
"userId": "<string>",
"source": "<string>"
}
'{
"status": true,
"message": "<string>",
"data": {
"cardId": "<string>",
"brand": "<string>",
"last4": "<string>"
}
}Attaches a tokenized card (source) to an existing Stripe customer. The card becomes a payment method that can be used for future payments.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/peLuis123/Stripe_Back/llms.txt
Use this file to discover all available pages before exploring further.
cus_.Example: "cus_QRs9eKZ4xUzN2TP9"tok_.Example: "tok_1QRs9eKZ4xUzN2TP9vQqWXYZ"true) or failed (false)."Tarjeta añadida con éxito"curl -X POST https://your-api.com/api/cards/assign \
-H "Content-Type: application/json" \
-d '{
"userId": "cus_QRs9eKZ4xUzN2TP9",
"source": "tok_1QRs9eKZ4xUzN2TP9vQqWXYZ"
}'
{
"status": true,
"message": "Tarjeta añadida con éxito",
"data": {
"cardId": "card_1QRs9eKZ4xUzN2TPabcdefgh",
"brand": "Visa",
"last4": "4242"
}
}
// Step 1: Create card token
const tokenResponse = await fetch('https://your-api.com/api/cards/create', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
number: '4242424242424242',
exp_month: '12',
exp_year: '2026',
cvc: '123'
})
});
const tokenData = await tokenResponse.json();
// Step 2: Assign token to customer
const assignResponse = await fetch('https://your-api.com/api/cards/assign', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
userId: 'cus_QRs9eKZ4xUzN2TP9',
source: tokenData.data.token_id
})
});
const assignData = await assignResponse.json();
console.log('Card assigned:', assignData);