Create a checkout session
create_checkout_sessionCreate a checkout session for a 1–20 item cart in one currency and redirect the buyer to pay via a hosted URL or pay.js overlay, returning them to your success or cancel page.
Instructions
Create a checkout session.
A cart of 1–20 prices in one currency. Send the buyer to url, or open it in an overlay with pay.js (data-session="cs_…"). The buyer comes back to return_url after paying, cancel_url if they leave. Live mode: a new session is refused with 403 bill_overdue while a Perly Pay bill is unpaid past its 14 days.
Test keys only: refused with a live key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coupon | No | A coupon code. | |
| customer | No | A customer id, `cus_…`. | |
| metadata | No | Your own key–value pairs (≤ 50 keys, values ≤ 500 characters). On an update they are merged in; an empty value removes its key. | |
| cancel_url | No | An http(s) URL. | |
| line_items | Yes | ||
| return_url | No | An http(s) URL. | |
| customer_email | No | ||
| expires_in_minutes | No | Default 1440 (24 hours). |