Create Session
POST
/v1/checkout/sessions
/v1/checkout/sessions
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.Example:
Authorization: Bearer ********************
Body Params application/json
clientReferenceId
string
自定义id
<= 64 characters
subject
string
标题
<= 127 characters
description
string
描述
<= 1023 characters
currency
enum<string>
币种
Allowed value:
USD
amount
number
支付金额
>= 0.5
successUrl
string
支付成功跳转url
cancelUrl
string
取消跳转url
expiresAt
number
过期时间
customerId
string
optional
type
enum<string>
支付类型
Allowed values:
cardstripepaypal
paymentMethodOptions
object
支付方式特殊配置
card
object
卡支付配置
Example
{
"description": "test description",
"customerId": "cus_test_wefAffdqq",
"subject": "test",
"currency": "USD",
"amount": "20",
"successUrl": "https://test.com",
"cancelUrl": "https://test.com",
"clientReferenceId": "1123123123123128",
"expiresAt": 1741768596319,
"paymentMethodOptions": {
"card": {
"setupFutureUsage": "on_session"
}
}
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/v1/checkout/sessions' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "test description",
"customerId": "cus_test_wefAffdqq",
"subject": "test",
"currency": "USD",
"amount": "20",
"successUrl": "https://test.com",
"cancelUrl": "https://test.com",
"clientReferenceId": "1123123123123128",
"expiresAt": 1741768596319,
"paymentMethodOptions": {
"card": {
"setupFutureUsage": "on_session"
}
}
}'
Responses
🟢200成功
application/json
Body
code
string
required
msg
string
required
data
object
required
sessionId
string
required
paymentIntentId
string
required
clientReferenceId
string
required
expiresAt
integer
过期时间
url
string
收银台url
Example
{
"code": "success",
"msg": null,
"data": {
"sessionId": "cs_test_2025031108",
"paymentIntentId": "pi_test_2025031",
"clientReferenceId": "1111111183",
"expiresAt": 1741768596319,
"url": "https://sandbox-checkout.yobopay.com/pay/cs_test_2025031108"
}
}
Modified at 2025-04-09 03:49:19