Links

Credit and debit cards

Learn how to use Payment Method Sessions to save payment method details for future card payments.

1. Create a payment method session

You'll need to supply the ID of the customer you'd like to attach the payment method.
curl https://api.yorlet.com/v1/payment_method_sessions \
-H "Authorization: Bearer {{API_KEY}}" \
-H "Content-Type: application/json" \
-d '{
"customer": "cus_kowie32023325",
"payment_method_types": ["card"],
"return_url": "https://example.com/success"
}'
{
"object": "payment_method_session",
"created": 1607473397,
"url": "https://pay.yorlet.com/payment_methods/pmsess_kfpOalkieq092Pm"
}

2. Redirect the customer to collect their payment details

Once you're created the payment method session you should redirect your customer to the url returned in the response so they can enter their payment details.

3. Retrieve the payment method

curl https://api.yorlet.com/v1/payment_method_sessions/pmsess_kopfaoko02plaQ \
-H "Authorization: Bearer {{API_KEY}}" \
The payment method session will include a payment_method you can use in future requests.

4. Create a subscription