POST
Cancel a checkout session

Authorizations

Authorization
string
header
default:sk_test_docs_246e232c64ccc7a001bf61ec0f2e6ab0
required

Authorization: Bearer <secret key>. Secret keys belong to your organisation, are shown once when created in the dashboard, and are scoped (see x-required-scope on each operation). Keep them on your server. Live keys are issued after your business is verified. Publishable keys (pk_) are only for @ketapay/checkout and don't work here.

Headers

Idempotency-Key
string
required

Unique key for this operation. Retries with the same key return the first result.

Maximum string length: 255
Example:

"7f3e2a10-6c4d-4b8e-9a1f-2d5c8e7b6a40"

Path Parameters

id
string<uuid>
required

Response

The cancelled checkout session

id
string<uuid>
required
object
string
required
Allowed value: "checkout_session"
livemode
boolean
required
status
enum<string>
required

open: waiting for payment. complete: paid, escrow_id is set. expired: not paid by expires_at. cancelled: you cancelled it.

Available options:
open,
complete,
expired,
cancelled
url
string<uri>
required

The hosted checkout. Open it with @ketapay/checkout or redirect the buyer to it.

Example:

"https://app.ketapay.com/checkout/2c9a7f4e-1b3d-4e6a-8f2c-5d7b9e1a3c60"

amount
integer
required

Amount in kobo

Required range: x >= 0
Example:

45000000

currency
string
required
Allowed value: "NGN"
fees
object
required

Totals for the whole escrow, in kobo. buyer_total = amount + buyer_fee + buyer_vat and seller_payout = amount - seller_fee - commission. Until everything is released these are what will apply; each milestone shows its own share.

category
enum<string>
default:other
required

What kind of deal this is. KetaPay uses it for risk checks and dispute handling.

Available options:
goods,
services,
property,
vehicle,
digital,
other
title
string
required
description
string
required
images
object[]
required

KetaPay's copies, in order; the first is the cover

Send either file (an id from POST /files with purpose agreement) or url (an HTTPS link KetaPay copies). JPEG, PNG, HEIC or WebP. Responses carry KetaPay's own url plus a small thumbnail_url.

attachments
object[]
required

Send either file (an id from POST /files) or url (an HTTPS link KetaPay copies, so it survives your copy being deleted). Responses always carry KetaPay's own url.

milestones
object[]
required

The plan. One entry for a single payment.

buyer
object
required

At least one of email and phone. Both is better.

seller
object
required

The seller as you sent them, or your business when you sent none

release
object
required
commission
object | null
required

Your cut, taken from the seller's side of each release. Never charged on money refunded to the buyer. rate_bps is basis points (500 = 5%). min_amount and max_amount apply to the whole escrow; each milestone's release carries its share. Must be within the maximum rate in your KetaPay agreement. Not allowed when you sell your own goods (no seller): commission_not_allowed.

escrow_id
string<uuid> | null
required

Set once the buyer has paid

return_url
string<uri> | null
required
cancel_url
string<uri> | null
required
external_reference
string | null
required

Your own id for this object, for example your order or project id. Filterable.

Maximum string length: 255
Example:

"proj_4471"

metadata
object
required

Your own key-value pairs. KetaPay stores them and never reads them.

Example:
expires_at
string<date-time>
required
created_at
string<date-time>
required
url_on_platform
string<uri> | null

The url you sent at creation

completed_at
string<date-time> | null
cancelled_at
string<date-time> | null