Create a payment session
How to create a payment session via API
To create a new payment session, send a POST request to the /api/2026-05/payment_sessions endpoint, passing the resource arguments in the request body.
Request
POST https://yourdomain.commercelayer.io/api/2026-05/payment_sessions
Arguments
type
string
Required
attributes.amount_cents
integer
Optional, default to the payment link amount or the order outstanding amount
attributes.currency_code
string
Optional, default to the payment link or order currency code
attributes.gift_card_code
string
Optional, but when linked to a paymentsettinggiftcard
attributes.token
string
Optional
attributes.options
object
Optional
attributes.vaulting
boolean
Optional, default is 'false'
attributes.client_data
object
Optional
attributes._internal_version
string
Optional
attributes.expires_at
string
Optional, default depends on the payment setting
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.order
object
Optional
relationships.payment_setting
object
Required
relationships.payment_wallet
object
Optional
Example
The following request creates a new payment session:
On success, the API responds with a 201 Created status code, returning the created resource object:
Last updated