Create a Session
POST
/v1/checkout/sessionsCreates a Session object.
请求参数
A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in payment mode.
Controls when the funds will be captured from the customer’s account. Possible enum values:automatic(default) and manual
An arbitrary string attached to the object. Often useful for displaying to users.
The order ID created in the merchant's order system that corresponds to this PaymentIntent
The user ID created in merchant's order system that corresponds to this PaymentIntent
A 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.
A list of items the customer is purchasing. Use this parameter to pass one-time or recurring Prices.
Required conditionally. The ID of the Price object. One of price or price_data is required.
Required conditionally.Data used to generate a new Price object inline. One of price or price_data is required. For more details of price_data, please refer to the endpoint of 'create a price'.
Required unless metered billing. The quantity of the line item being purchased.
The coupon or promotion code to apply to this Session. Currently, only up to one may be specified.
The ID of the coupon to apply to this Session.
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.
{
"cancel_url": "https://yourwebsite.com",
"mode": "payment",
"success_url": "https://yourwebsite.com",
"line_items": [
{
"price_data": {
"currency": "GBP",
"unit_amount": 2000,
"product_data": {
"name": "apple"
}
},
"quantity": 1
}
]
}
示例代码
Responses
{}