Finish saving a card for a customer
/meals/v1/customer/{customer_id}/payment-method/setup/{setup_id}/confirm/documentorder:writeCall it after Stripe.js confirmed the card on your page. It checks the setup, makes sure the
card is recorded on the customer's Nurish'd account, and answers the card. When the customer
had no default card, the card becomes their default card. A customer who already has a
default card keeps it, and the answer says is_default: false.
Calling it again for the same setup is safe, and it does not wait for any notification, so call
it right after the card form says it worked. Answers 409 payment_method_setup_incomplete
when the card form has not confirmed the card yet, 404 for a setup that is not this
customer's, and the same 404, 403 and 409 as the start route for the customer's
connection.
Needs the order:write scope.
Path parameters
customer_idstring (uuid)requiredThe ID of the customer, as the create-customer route answered it.
setup_idstringrequiredThe ID of the setup, as the start route answered it.
Min length 1 · Max length 200 · Pattern ^[A-Za-z0-9_-][A-Za-z0-9._-]{0,199}$
Response 200
cardPaymentMethodCardrequiredThe card details: brand, expiry month and year, and the last four digits.
Show child attributesHide child attributes
brandstringrequiredThe card brand, for example
visaormastercard.exp_monthintegerrequiredThe month the card expires, 1 to 12.
exp_yearintegerrequiredThe four-digit year the card expires.
last4stringrequiredThe last four digits of the card.
idstringrequiredThe ID of the card.
is_defaultbooleanrequiredWhether this is the person's default card, the one later charges use.
Errors
Every error has this shape. Branch on code, not on message. request_id equals the X-Request-Id response header.
{
"error": {
"code": "not_found",
"message": "The object does not exist.",
"request_id": "req_0123456789abcdef0123456789abcdef"
}
}| Status | Code | Meaning |
|---|---|---|
401 | invalid_api_key | The API key is missing or not valid. |
403 | company_archived | This company is archived. |
403 | company_not_live | The company must be live to use prod keys. |
403 | company_suspended | This company is suspended. |
403 | scope_not_granted | This API key does not have the order:write scope. |
404 | not_found | The requested resource was not found. |
409 | connection_not_active | The connection is not active. |
409 | payment_method_setup_incomplete | The card has not been confirmed with the card form yet. Confirm it on your page, then call this route again. |
422 | validation_error | path.customer_id: Input should be a valid UUID, invalid character: found n at 0 |
429 | rate_limited | Too many requests. Wait before calling again. |
500 | internal_error | Something went wrong on our side. Please try again later. |
502 | upstream_error | A Nurish'd service could not complete the request. |
503 | upstream_unavailable | A Nurish'd service is unavailable. Please try again later. |
504 | upstream_timeout | A Nurish'd service did not answer in time. Please try again. |