Skip to main content
POST
/
v1
/
payment_method_sessions
Create a payment method session
curl --request POST \
  --url https://api.yorlet.com/v1/payment_method_sessions \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customer": "<string>",
  "payment_method_types": [],
  "metadata": {},
  "return_url": "<string>",
  "send_email": true,
  "subscription": "<string>"
}
'
{
  "id": "<string>",
  "created": 123,
  "object": "payment_method_session",
  "customer": "<string>",
  "payment_method": "<string>",
  "payment_method_types": [],
  "return_url": "<string>",
  "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>"
  },
  "metadata": {}
}

Authorizations

Authorization
string
header
required

API Key authentication. Use "Bearer YOUR_API_KEY".

Body

application/json
customer
string
required

The ID of the customer the payment method session is for.

payment_method_types
enum<string>[]
required

The payment method types allowed for this 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
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.

return_url
string<uri>

The URL to return to after the session is complete.

send_email
boolean

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

subscription
string

The ID of the subscription to associate the payment method with.

Response

200 - application/json

Returns the payment method 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:
payment_method_session
customer
required

The customer the payment method session is for.

payment_method
required

The payment method created or selected during the session.

payment_method_types
enum<string>[]
required

The payment method types allowed for this session.

Available options:
autogiro,
bacs_debit,
card,
card_present,
bank_transfer,
direct_transfer,
gbp_credit_transfer,
pay_by_bank,
sepa_debit
return_url
string<uri> | null
required

The URL to return to after the session is complete.

status
enum<string>
required

The current status of the payment method session.

Available options:
requires_payment_method,
succeeded
subscription
required

The subscription associated with the payment method session, if any.

url
string<uri> | null
required

The hosted URL of the payment method 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 payment method 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.