Payment Method
Private Payment Method API endpoints
Store a payment method for a customer of your shop from a gateway-side token. The token is exchanged with the gateway; only the shape of token is validated up front, so a token the gateway rejects surfaces as a server error rather than a validation error. When the customer has no default payment method yet and the gateway is in live mode, the new payment method becomes the default.
Request body
customer_idRequiredintegerID of the customer the payment method belongs to.
gateway_idRequiredintegerID of a payment gateway belonging to your shop.
tokenRequiredstringGateway-side token for the payment instrument, for example a Stripe payment method ID or a Braintree nonce. It is exchanged with the gateway on the spot.
ReturnsPaymentMethod
Payment method object response
Error responses
422objectValidation failed, for example a customer_id that is not a customer of your shop, a missing token, or a gateway_id that does not belong to your shop.
A detailed description of the payment method.
expand[]: Accepted for consistency with other endpoints; the payment method has no expandable relations.
Path parameters
payment_method_idRequiredintegerPayment method ID
Format: integer.
Query parameters
expand[]optionalstring[]List of relations to expand in the response. Each expandable field on the response schema names its key, e.g. expand[]=customer. Nested keys use dot notation, e.g. items.product or subscriptions.items. Fields marked as always present are returned without being requested. An expanded list is null, not [], when there are no records. Unknown keys are ignored unless the endpoint says otherwise.
ReturnsPaymentMethod
Payment method object response
Error responses
400objectThe payment method belongs to another shop.
404objectThe payment method does not exist or has been deleted.
Remove a stored payment method and detach it at the gateway. When it was the customer's default payment method, the default is cleared as well. The payment method must belong to your shop.
Path parameters
payment_method_idRequiredintegerPayment method ID
Format: integer.
ReturnsPaymentMethod
The deleted payment method
Error responses
404objectThe payment method does not exist or belongs to another shop.