Checkout

Create a checkout session

POST/v1/checkout/sessions

Creates a hosted payment page for an order. Send your customer to its url; the page asks for their number, sends the prompt, waits, lets them retry and gives them a receipt. When they’ve paid, we send them to your success_url.

With reusable: true it becomes a payment page that takes any number of payments until you expire it.

Permissioncheckout:write

Headers#

Idempotency-Keystringheader

8–80 letters, digits, - or _. Lets you retry safely: the same key and body return the first answer and never move money twice. See Idempotency.

Body#

JSON, with Content-Type: application/json.

line_itemsarray

What they’re paying for, like invoice lines. Give these or amount.

Show child attributes
descriptionstringrequired

What the line is for.

quantityintegerrequired

How many.

unit_amountintegerrequired

The price of one, in whole UGX.

amountinteger

A single amount in UGX, instead of line_items. Needs title.

titlestring

What’s being paid for. Required with amount; defaults to the first line.

descriptionstring

Text under the title.

success_urlstring

Where to send the customer after paying. {CHECKOUT_SESSION_ID} is replaced with the session id.

cancel_urlstring

Shown as a back arrow on the page.

referencestring

Your order id. Returned on the session and in webhooks.

customerobject

Fills in the page for them.

Show child attributes
namestring
emailstring
phonestring
require_emailboolean

Make the email field required, so they always get a receipt.

require_nameboolean

Make the name field required.

allow_custom_amountboolean

Let the customer type the amount, for donations, fees and top-ups.

min_amountinteger

The lowest amount they may type.

reusablebooleandefault: false

true: a link that takes any number of payments until you expire it. false: one payment, then complete.

expires_in_minutesintegerdefault: 1440

One-time sessions only. 30 to 10,080.

wallet_idstring

Where payments land. Defaults to your main wallet.

fee_bearerstring

wallet or customer.

metadataobject

Up to 20 keys of your own, with simple values. Returned on the object and in webhooks.

Returns#

The checkout session, with its url.

Errors#

StatusCodeWhen
422VALIDATION_ERRORFor example, neither line_items nor amount, or a total outside UGX 500–5,000,000.

The common codes, such as UNAUTHENTICATED and RATE_LIMITED, can come from any endpoint. See Errors.

Don’t ship an order just because the customer arrived at your success_url: anyone can open that address. Confirm with the checkout.session.completed webhook, or by getting the session and checking that its status is complete.