Skip to navigation

Cancel a Checkout Session

Withdraws a pending Checkout Session so it can’t be paid, e.g. when the order is abandoned or changed. Fails with payment_in_progress once the Customer has started paying; wait for the outcome webhook instead. Unpaid sessions also cancel on their own after expiresAt, unless the Customer has started paying.

Authentication

AuthorizationBearer

Your secret key: sk_test_… in Test mode, sk_live_… in Live mode.

Path parameters

idstringRequired
Checkout Session identifier.

Response

Cancelled; a checkout_session.cancelled webhook is sent. Safe to retry: a repeat returns 409 invalid_state.

idstring
Checkout Session identifier.
statusenum

pending until the Customer pays or the session ends. succeeded: paid, safe to fulfil. failed: the payment was declined or didn’t go through. cancelled: you cancelled it or it expired unpaid. Only pending ever changes, and each change sends the matching checkout_session.* webhook.

Allowed values:
modeenum

test for a session made with an sk_test_ key, live for an sk_live_ key. Webhook endpoints each hear one mode, and the payload says which it came from.

Allowed values:
amountinteger

Amount to charge, in FJD cents (minor units).

currencyenum
Always FJD in v1.
Allowed values:
hostedUrlstring

Transxact-hosted URL to redirect the Customer to.

metadatamap from strings to strings

Your own key/value data from creation; empty object if none was set.

expiresAtinteger

Unix ms timestamp after which no payment can start; a still-pending session is then cancelled.

invoiceNumberstringOptional

The Invoice number, such as INV-0007, when the session pays one of your Invoices; absent otherwise. Also in the webhook payload.

quoteobjectOptional

Present when you created the session with a quote: the USD or AUD price you sent, the FJD rate it was converted at (a decimal string), and the Unix ms time the rate was taken. amount is the FJD that is charged. Never shown to the Customer.

Errors

401
Unauthorized Error
404
Not Found Error
409
Conflict Error