Membership payment methods are used to charge invoices and to let members buy time passes, booking passes etc. A membership payment method is always connected to one of the payment methods set up for the space.
When selecting a payment method for a member using the Cobot web interface, users have to submit their card/bank details directly to the processor's site/api via a web form or a JavaScript call. This form/call usually returns a token that is connected to the submitted card/account, which is what Cobot stores in order to process payments.
When assigning a payment method via the API, you need to implement the flow to submit the payment details yourself, and only send the resulting token(s) to Cobot.
Right now this endpoint is only implemented for Stripe and Gocardless. Contact us if you need support for other processors.
PUT https://co-up.cobot.me/api/memberships/dce8ca410400c427cb4a3262e6874c9f/payment_method
Body:
{ "payment_method_id": "a7vb410400c427cb4a3262e6874c9fa63", "customer_id": "12345", "stripe_payment_method_id": "pm_1EmGu02eZvKYlo2CDUt99ZAQ" }
Response:
{ "payment_method_id": "a7vb410400c427cb4a3262e6874c9fa63", "customer_id": "12345", "stripe_payment_method_id": "pm_1EmGu02eZvKYlo2CDUt99ZAQ" }
At the moment the stripe_payment_method_id
parameter for the Stripe endpoint is not required. However, according to SCA regulations across EU(that comes into force on 14 September 2019), Stripe has changed their API and all the products using this Cobot endpoint will have to implement their new solution by replacing Stripe token with the payment method id generated by Stripe for each customer. More documentation here: https://stripe.com/docs/payments/payment-methods#transitioning
PUT https://:subdomain.cobot.me/api/memberships/:membership_id/payment_method
Body:
{ "payment_method_id": "a7vb410400c427cb4a3262e6874c9fa63", "mandate": "12345" }
Response:
{ "payment_method_id": "a7vb410400c427cb4a3262e6874c9fa63" }
In case something goes wrong at Stripe (status 422):
{ "errors": ["something went wrong"] }