Skip to main content
POST
/
v1
/
checkout_sessions
Create a checkout session
curl --request POST \
  --url https://api.yorlet.com/v1/checkout_sessions \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "description": "<string>",
  "currency": "gbp",
  "customer": "<string>",
  "subscription_data": {
    "add_invoice_items": [
      {
        "amount": 123,
        "currency": "<string>",
        "description": "<string>",
        "tax_percent": 50,
        "metadata": {},
        "price": "<string>",
        "tax_rate": "<string>",
        "transfer_destination": "<string>",
        "unit": "<string>"
      }
    ],
    "billing_anchor": 123,
    "billing_anchor_config": {
      "day_of_month": 16
    },
    "coupon": "<string>",
    "custom_fields": [
      {
        "name": "<string>",
        "value": "<string>"
      }
    ],
    "days_before_collection": 3,
    "days_until_due": 1,
    "description": "<string>",
    "end_date": 123,
    "end_date_config": {
      "day": 16,
      "month": 6,
      "year": 123
    },
    "metadata": {},
    "phases": [
      {
        "start_date": 123,
        "items": [
          {
            "price_data": {
              "amount": 123,
              "currency": "<string>",
              "tax_percent": 123
            },
            "description": "<string>",
            "metadata": {},
            "price": "<string>",
            "schedule": [
              {
                "amount": 123,
                "effective_at": 123
              }
            ],
            "tax_rate": "<string>",
            "transfer_destination": "<string>",
            "unit": "<string>"
          }
        ]
      }
    ],
    "start_date": 123,
    "start_date_config": {
      "day": 16,
      "month": 6,
      "year": 123
    },
    "application": "<string>",
    "interval_count": 123,
    "invoice_settings": {
      "custom_fields": [
        {
          "name": "<string>",
          "value": "<string>"
        }
      ]
    },
    "items": [
      {
        "price_data": {
          "amount": 123,
          "currency": "<string>",
          "tax_percent": 123
        },
        "description": "<string>",
        "metadata": {},
        "price": "<string>",
        "schedule": [
          {
            "amount": 123,
            "effective_at": 123
          }
        ],
        "tax_rate": "<string>",
        "transfer_destination": "<string>",
        "unit": "<string>"
      }
    ],
    "use_future_billing_date": true
  },
  "metadata": {},
  "payment_method_types": [],
  "consent_collection": {
    "terms_of_service": false
  },
  "custom_text": {},
  "return_url": "<string>",
  "send_email": true
}
'
{
  "id": "<string>",
  "created": 123,
  "object": "checkout_session",
  "completed_at": 123,
  "consent_collection": {
    "terms_of_service": true
  },
  "custom_text": {
    "terms_of_service": {
      "message": "<string>"
    }
  },
  "currency": "gbp",
  "customer": "<string>",
  "default_payment_method": "<string>",
  "description": "<string>",
  "payment_method_types": [
    "<string>"
  ],
  "return_url": "<string>",
  "subscription_data": {
    "add_invoice_items": [
      {
        "amount": 123,
        "currency": "<string>",
        "description": "<string>",
        "tax_percent": 50,
        "metadata": {},
        "price": "<string>",
        "tax_rate": "<string>",
        "transfer_destination": "<string>",
        "unit": "<string>"
      }
    ],
    "billing_anchor": 123,
    "billing_anchor_config": {
      "day_of_month": 16
    },
    "coupon": "<string>",
    "custom_fields": [
      {
        "name": "<string>",
        "value": "<string>"
      }
    ],
    "days_before_collection": 3,
    "days_until_due": 1,
    "description": "<string>",
    "end_date": 123,
    "end_date_config": {
      "day": 16,
      "month": 6,
      "year": 123
    },
    "metadata": {},
    "phases": [
      {
        "start_date": 123,
        "items": [
          {
            "price_data": {
              "amount": 123,
              "currency": "<string>",
              "tax_percent": 123
            },
            "description": "<string>",
            "metadata": {},
            "price": "<string>",
            "schedule": [
              {
                "amount": 123,
                "effective_at": 123,
                "effective_at_config": {
                  "day": 16,
                  "month": 6,
                  "year": 123
                }
              }
            ],
            "tax_rate": "<string>",
            "transfer_destination": "<string>",
            "unit": "<string>"
          }
        ]
      }
    ],
    "start_date": 123,
    "start_date_config": {
      "day": 16,
      "month": 6,
      "year": 123
    },
    "application": "<string>",
    "interval_count": 123,
    "invoice_settings": {
      "custom_fields": [
        {
          "name": "<string>",
          "value": "<string>"
        }
      ]
    },
    "items": [
      {
        "price_data": {
          "amount": 123,
          "currency": "<string>",
          "tax_percent": 123
        },
        "description": "<string>",
        "metadata": {},
        "price": "<string>",
        "schedule": [
          {
            "amount": 123,
            "effective_at": 123,
            "effective_at_config": {
              "day": 16,
              "month": 6,
              "year": 123
            }
          }
        ],
        "tax_rate": "<string>",
        "transfer_destination": "<string>",
        "unit": "<string>"
      }
    ],
    "use_future_billing_date": true
  },
  "subscription": "<string>",
  "url": "<string>",
  "account": "<string>",
  "deleted": false,
  "merchant": {
    "business_name": "<string>",
    "color": "<string>",
    "country": "<string>",
    "display_name": "<string>",
    "icon": "<string>",
    "id": "<string>",
    "support_email": "<string>",
    "support_phone": "<string>",
    "support_website": "<string>",
    "terms_of_service_url": "<string>"
  },
  "metadata": {}
}

Authorizations

Authorization
string
header
required

API Key authentication. Use "Bearer YOUR_API_KEY".

Body

application/json
description
string
required

The description of the checkout session. This will be displayed to the customer.

currency
enum<string>
required

The currency to use for the checkout session.

Available options:
gbp,
usd,
eur,
sek
Example:

"gbp"

customer
string
required

The ID of the customer to use for the checkout session.

subscription_data
object
required

The subscription data hash.

metadata
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

payment_method_types
enum<string>[]

The payment method types allowed for this checkout session.

Minimum array length: 1
Available options:
autogiro,
bacs_debit,
card,
card_present,
bank_transfer,
direct_transfer,
gbp_credit_transfer,
pay_by_bank,
sepa_debit

The consent collection object.

custom_text
object

The custom text object. Used to override the default text for a checkout session.

return_url
string<uri>

The URL to return to after the checkout session is complete.

send_email
boolean
default:true

Whether to send an email to the customer with a link to the checkout session.

Response

200 - application/json

Returns the checkout session object if the request succeeded.

id
string
required

Unique identifier for the object.

created
number
required

Time at which the object was created. Measured in seconds since the Unix epoch.

object
enum<string>
required
Available options:
checkout_session
completed_at
number | null
required

The time at which the checkout session was completed.

Configuration for collecting consent during the checkout session.

custom_text
object
required

Custom text to display on the checkout session.

currency
enum<string>
required

Three-letter ISO currency code, in lowercase. Must be a supported currency.

Available options:
gbp,
usd,
eur,
sek
Example:

"gbp"

customer
required

The customer the checkout session is for.

default_payment_method
required

The default payment method selected during the checkout session.

description
string | null
required

The description of the checkout session. This will be displayed to the customer.

payment_method_types
string[]
required

The payment method types allowed for this checkout session.

return_url
string | null
required

The URL to return to after the checkout session is complete.

status
enum<string>
required

The status of the checkout session.

Available options:
canceled,
expired,
open,
complete
subscription_data
object
required

The subscription data used to create the subscription on checkout completion.

subscription
required

The subscription created by the checkout session, if any.

url
string | null
required

The hosted URL of the checkout session.

account
string

The account that the object belongs to. Only returned if the request is made with a valid Yorlet-Context header.

deleted
boolean
default:false

Only returned if the object has been deleted.

merchant
object

Information about the merchant operating the checkout session.

metadata
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.