Skip to main content

Create a checkout session

POST 

/checkout/session

Create a checkout session

Request

Body

required
    allow_promotion_codes boolean

    Enables user redeemable promotion codes.

    success_url stringrequired

    The URL to which the customers is redirected when payment or setup is complete.

    cancel_url string

    If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website.

    currency string

    Three-letter ISO currency code, in lowercase. Must be a supported currency.

    customer string

    ID of an existing Customer, if one exists. If blank, a new Customer object based on information provided during the payment flow will be created.

    discounts object[]

    The coupon to apply. Currently, only up to one may be specified.

  • Array [
  • coupon string

    The ID of the coupon to apply.

  • ]
  • line_items object[]required

    A list of items the customer is purchasing. For payment mode, there is a maximum of 100 line items, however it is recommended to consolidate line items if there are more than a few dozen. For subscription mode, there is a maximum of 20 line items with recurring Prices and 20 line items with one-time Prices.

  • Array [
  • adjustable_quantity object
    enabled booleanrequired

    Set to true if the quantity can be adjusted to any non-negative integer. By default customers will be able to remove the line item by setting the quantity to 0.

    maximum number

    Possible values: <= 999999

    The maximum quantity the customer can purchase. By default this value is 99. You can specify a value up to 999999.

    minimum number

    The minimum quantity the customer must purchase. By default this value is 0.

    price stringrequired

    The ID of the Price object.

    quantity numberrequired

    Possible values: >= 1

    The quantity of the line item being purchased.

  • ]
  • mode stringrequired

    Possible values: [subscription, payment]

    The mode of the Session. Pass subscription if it includes at least one recurring item.

    payment_method_types string[]

    Possible values: [card, paypal, customer_balance]

    Default value: card

    subscription_data objectrequired
    trial_period_days numberrequired

    Possible values: >= 1

    Integer representing the number of trial period days before the customer is charged for the first time.

    expand string[]

    Specifies which fields in the response should be expanded.

Responses

Schema
    url stringrequired
Loading...