Create a customer
Before creating a Payment Method Session, you need a customer to attach the payment method to. You can either use an existing customer or create a new one using the Customers APIAPI
.
Create a customer
Customer object
Create a Payment Method Session
To create a Payment Method SessionAPI
, you need to specify the customer and payment_method_types. You can optionally include a return_url to redirect customers after the payment method is collected.
Create a Payment Method Session
url parameter.
Payment Method Session object
Supported payment method types
You can collect the following payment method types:| Type | Description |
|---|---|
card | Credit or debit card |
bacs_debit | Bacs Direct Debit (UK) |
sepa_debit | SEPA Direct Debit (EU) |
autogiro | Autogiro (Sweden) |
Share the Payment Method Session URL
After creating a Payment Method Session, share theurl with your customer. They will be guided through a secure flow to enter their payment details. Once complete, they will be redirected to your return_url.
You can also set send_email to true to automatically send the URL to the customer’s email address.
Send email to customer
Collect payment method for a subscription
You can associate a Payment Method Session with a subscription. Once the customer completes the session, the payment method will automatically be attached to the subscription.Create a Payment Method Session for a subscription
Retrieve a Payment Method Session
You can retrieve a Payment Method SessionAPI
to check its status and see which payment method was created.
Retrieve a Payment Method Session
payment_method field will contain the ID of the created payment method.
Completed Payment Method Session