Payment Sessions are a way to accept payments from your customers. You can create a Payment Session for a specific amount and currency, and share the Payment Session URL with your customers. Your customers can then pay using their preferred payment method.

Create a customer

Before creating a Payment Session, you need to create a customer. You can create a customer using the Customers API

.

Create a customer
curl https://api.yorlet.com/v1/customers \
  -H "Authorization: Bearer {{API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{
        "email": "[email protected]"
      }'

If the request completed successfully, the response contains the customer object.

Customer object
{
  "id": "cus_lrhplff1u4ZhIPSU",
  "object": "customer",
  "email": "[email protected]"
  // ... other fields on the Customer object
}

Create a Payment Session

To create a Payment Session

, you need to specify the amount, currency, customer, payment_method_types, and return_url. The return_url is where your customers will be redirected after the payment is completed.

Create a Payment Session
curl https://api.yorlet.com/v1/payment_sessions \
  -H "Authorization: Bearer {{API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{
        "amount": 10000,
        "currency": "gbp",
        "customer": "{{CUSTOMER_ID}}",
        "payment_method_types": ["card"],
        "return_url": "https://example.com/success"
      }'

If the request completed successfully, the Payment Session object contains the url parameter.

Payment Session object
{
  "id": "py_sess_lvu4xju9NAB38beQ",
  "object": "payment_session",
  // ... other fields on the Payment Session object
  "url": "https://pay.yorlet.com/sessions/py_sess_lvu4xju9NAB38beQ"
}

Share the Payment Session URL

After creating a Payment Session, you will receive a Payment Session URL. Share this link with your customers so they can pay using their preferred payment method.