Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Membership Payment Methods

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.

Authentication required
yes, additionally user must be a space admin
Scope required
write_membership_payment_method
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"
}
payment_method_id
id of a Stripe payment method set up for the space
customer_id
Stripe customer id
stripe_payment_method_id
id of the payment method used by Stripe for the given customer

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"
}
payment_method_id
id of a Gocardless payment method set up for the space
mandate
Mandate id returned by Gocardless when completting their redirect flow

Response:

{
  "payment_method_id": "a7vb410400c427cb4a3262e6874c9fa63"
}

In case something goes wrong at Stripe (status 422):

{
  "errors": ["something went wrong"]
}

back to index