Building payment method management into your customer account pages
Update payment method
Out of the box, the payment method selected at checkout will be used for all subscription orders. This can be switched to a different Submarine payment method at any time.
- If creating a new payment method, a payment token should be generated first (using your payment processor client-side library, e.g. Stripe Elements or Braintree Hosted Fields).
- That token should be supplied to Submarine's Payment Methods API, in order to create a new Submarine payment method.
- The Submarine payment method ID should be supplied to the update-subscription endpoint.
Request payload
{
"subscription": {
"payment_method_id": 12345678
}
}
Unsuccessful response
The supplied payment method cannot be found, or it is inactive.
{
"errors": [
{
"detail": "Cannot find active customer payment method: 12345678",
"source": {
"pointer": "/subscription/payment_method_id"
},
"status": "422"
}
]
}
Updated over 3 years ago