Create a hosted checkout session
create_checkout_sessionCreates a hosted checkout session and returns a URL or token so customers can complete bank-transfer payments, with optional expiry, reference, and success or cancel URLs.
Instructions
Create a hosted checkout session.
Create a checkout session, then either redirect your customer to its url (hosted checkout) or hand its token to your front end and open it in the Pletopay popup with the browser SDK and your publishable key. Pletopay’s page shows the bank-transfer details (the payment is created when the customer opens it), waits for the transfer and sends the customer to success_url (hosted) or calls your onSuccess callback (popup). The session expires after expires_in seconds (default 1 hour, at most 3 hours: one-time bank accounts are limited to 3 hours) and completes when its payment succeeds (checkout.session.completed). reference is optional; when given it must be unique per mode (409 duplicate_reference), and the session can then be retrieved with GET /api/v1/checkout/sessions/reference/{reference}. Neither the redirect nor the callback is proof of payment: confirm with the webhook or by retrieving the session.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| split | No | Split rule applied to the payment (spl_…) | |
| amount | Yes | Amount in kobo | |
| currency | Yes | ||
| customer | No | Existing customer (cus_…) | |
| metadata | No | ||
| reference | No | Your reference for this session, unique per mode (409 duplicate_reference if reused) | |
| cancel_url | No | Where the customer goes if they cancel | |
| expires_in | No | Seconds until the session expires (default 3600, at most 10800: one-time accounts last up to 3 hours) | |
| description | No | Shown to the customer | |
| success_url | No | Where the customer is sent after paying | |
| customer_email | No | ||
| idempotency_key | No | Optional. A unique key for this request; retrying with the same key returns the original result instead of acting twice. One is generated if omitted. |