Skip to main content
POST
Create a checkout session

Authorizations

Authorization
string
header
required

A secret key, sk_test_... or sk_live_...; a publishable key (pk_...) on the browser routes only

Body

application/json
amount
integer
required

In the smallest unit (cents).

Example:

12550

currency
enum<string>
required
Available options:
USD,
CAD
Example:

"USD"

success_url
string<uri>
required

Where the customer goes after paying; ?checkout_session=cs_… is appended. Must be https; a sandbox key may also use http://localhost while you test.

Maximum string length: 2048
Example:

"https://shop.example/thanks?order=1042"

cancel_url
string<uri>
required

Where "Back to store" goes, and where an expired page sends the customer. Must be https; a sandbox key may also use http://localhost while you test.

Maximum string length: 2048
Example:

"https://shop.example/cart"

reference
string

Your order or invoice number; stored on the payment and shown in the dashboard.

Required string length: 1 - 100
Example:

"1042"

description
string

Shown to the customer on the page, and stored on the payment.

Required string length: 1 - 500
Example:

"Northwind order #1042"

customer_email
string<email>

Kept on the session and returned with it, for your records. The page does not show it.

Maximum string length: 254
customer
string<uuid>

One of your customers: the payment is filed on them, and a card can be saved to them.

payment_method_types
enum<string>[]

What the page offers. Omitted means a card only; us_bank_account needs USD.

Minimum array length: 1
Available options:
card,
us_bank_account
Example:
metadata
object

Up to 20 keys of your own (keys up to 40 characters, values up to 500); stored and returned, never interpreted.

Example:
expires_at
string<date-time>

When the page stops accepting a payment. Default 24 hours from now; at most 7 days.

Example:

"2026-09-26T12:00:00.000Z"

Response

The session, with the URL to send the customer to

object
enum<string>
required
Available options:
checkout_session
id
string
required
Example:

"cs_test_7Hs2kQ9mL1pXv4cR8tWzAbCd"

status
enum<string>
required

open while the customer can pay; complete once one payment succeeded (or, for a bank debit, was accepted) on the page; expired after expires_at, or once you expired it. A session pays once.

Available options:
open,
complete,
expired
Example:

"open"

amount
integer
required

In the smallest unit of the currency (cents).

Example:

12550

currency
enum<string>
required
Available options:
USD,
CAD
Example:

"USD"

reference
string | null
required
Example:

"1042"

description
string | null
required
Example:

"Northwind order #1042"

success_url
string
required
Example:

"https://shop.example/thanks?order=1042"

cancel_url
string
required
Example:

"https://shop.example/cart"

customer_email
string | null
required
customer
string | null
required
Example:

null

payment_method_types
enum<string>[]
required
Available options:
card,
us_bank_account
Example:
metadata
object | null
required

Up to 20 keys of your own (keys up to 40 characters, values up to 500); stored and returned, never interpreted.

Example:
payment
string | null
required

The payment made on the page, once the session is complete; read it at GET /payments/{id}.

Example:

"pay_test_7Hs2kQ9mL1pXv4cR8tWzAbCdEf"

livemode
boolean
required
Example:

false

expires_at
string
required
Example:

"2026-09-26T12:00:00.000Z"

completed_at
string | null
required
Example:

null

created_at
string
required
Example:

"2026-09-25T12:00:00.000Z"

url
string
required

Where to send the customer. Returned only here: it carries the key that opens the page.

Example:

"https://dashboard.payra.com/checkout/cs_test_7Hs2kQ9mL1pXv4cR8tWzAbCd?key=…"