Skip to navigation

Create a Checkout Session

Starts a payment: call this from your server, then redirect the Customer to the returned hostedUrl, which takes the payment with any Provider. Don’t fulfil on the redirect; wait for the checkout_session.succeeded webhook or retrieve the session. The Idempotency-Key header is required: a retry with the same key replays the original session instead of creating a second one, so derive it from your order. An sk_test_ key creates a Test mode session that simulates payment; an sk_live_ key creates a Live mode session that moves real money.

Authentication

AuthorizationBearer

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

Headers

idempotency-keystringRequired

Client-generated key; a repeated key returns the original session.

Request

This endpoint expects an object.
amountintegerOptional<=499999

Amount to charge, in FJD cents (minor units). Must be under FJD 5,000.00 (at most 499999), in Test mode and Live mode alike. Send this with currency, or send quote instead, never both.

currencyenumOptional

Always FJD in v1. Required with amount.

Allowed values:
quoteobjectOptional

Price the session in USD or AUD instead of sending amount. amount is in cents of that currency. We convert it to FJD once, now, and lock the rate; the Customer sees and pays FJD only. The converted FJD amount must still be under FJD 5,000.00. Test mode only for now: a Live mode key gets quote_unavailable_in_live_mode. Only on Business accounts.

successUrlstringOptionalformat: "uri"<=2048 characters

Where the hosted checkout sends the Customer after the payment succeeds. HTTPS only. Transxact appends session_id=<Checkout Session id>; confirm the outcome with GET /v1/checkout-sessions/{id} rather than trusting the redirect.

cancelUrlstringOptionalformat: "uri"<=2048 characters

Where the hosted checkout sends the Customer if they cancel or the payment doesn’t go through. HTTPS only. Transxact appends session_id=<Checkout Session id>; confirm the outcome with GET /v1/checkout-sessions/{id} rather than trusting the redirect.

metadatamap from strings to stringsOptional

Up to 20 string key/value pairs (keys ≤40 chars, values ≤500) for matching the session to your own records. Returned on retrieve and in webhooks; never shown to the Customer. Don’t put secrets or personal data here.

customerEmailstringOptionalformat: "email"<=254 characters

The Customer’s email. In Live mode, once the payment succeeds, Transxact emails them a receipt from you (branded with your Display name) unless you’ve turned receipts off in Settings. We keep the address 30 days after the session ends and never return it. In Test mode it is checked and dropped; nothing is sent.

expiresAtintegerOptional
Unix ms timestamp, 30 minutes to 24 hours from now, after which the session can't be paid and is cancelled. Defaults to 24 hours.

Response

Checkout Session created (or replayed from the Idempotency-Key).

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

400
Bad Request Error
401
Unauthorized Error
409
Conflict Error