Checkout sessions

Create a checkout session

POST/api/v1/checkout/sessions

Creates a hosted checkout page for a one-time payment (mode payment), for a new subscription (mode subscription, with a customer and one recurring price). Send the customer to the url in the response. The url is returned only by this call.

In subscription mode the customer chooses how many periods to pay for, up to maxPeriods. An invoice is not paid through a session: send the customer to the invoice's pay link.

Do not give access or ship because the customer reached your successUrl. Confirm with the checkout.session.completed event or by retrieving the session.

Send a unique Idempotency-Key. Repeating the request with the same key and body returns the original session, without its url.

Authorization

bearerAuth
AuthorizationBearer <token>

An access token from POST /api/v1/oauth/token, sent as Authorization: Bearer <token>.

In: header

Header Parameters

Idempotency-Key*string

A unique key you choose for this request: 1 to 255 visible ASCII characters, no spaces. A UUID works well. Never put personal data in it. Send the same key again to retry safely.

FlexMalipo-Version?"2026-11-06"

The API version to use for this request, a date such as 2026-11-06. Without it the request uses your default version for the mode of your key. An unknown version answers 400 api_version_invalid.

Value in

  • "2026-11-06"

Request Body

application/json

A checkout session to create.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api-malipo.flex.co.tz/api/v1/checkout/sessions" \  -H "Authorization: Bearer <token>" \  -H "Idempotency-Key: 5f1c1e0a-3b7e-4c8e-9d1a-2f6b8a4c7e11" \  -H "FlexMalipo-Version: 2026-11-06" \  -H "Content-Type: application/json" \  -d '{    "mode": "payment",    "successUrl": "https://shop.example.com/thanks?session={CHECKOUT_SESSION_ID}"  }'
{  "id": "0b6f3a52-6c1e-4f0a-8d2e-5a1c9e7b4d10",  "mode": "payment",  "status": "open",  "livemode": false,  "currency": "TZS",  "amountTotal": 24000,  "customerDetails": {    "name": "string",    "email": "string",    "phone": "string"  },  "clientReferenceId": "order-1042",  "metadata": {    "property1": "string",    "property2": "string"  },  "successUrl": "string",  "cancelUrl": "string",  "expiresAt": "2019-08-24T14:15:22Z",  "completedAt": "2019-08-24T14:15:22Z",  "createdAt": "2019-08-24T14:15:22Z",  "lineItems": [    {      "name": "string",      "unitAmount": 12000,      "quantity": 0,      "adjustableQuantity": {        "minimum": 0,        "maximum": 0      },      "amount": 24000    }  ],  "customer": "5b0c6a0e-1f0d-4f6b-8a5e-0d8f6c1f2a33",  "subscriptionId": "9c1d7e44-2a3b-4c5d-8e6f-7a8b9c0d1e2f",  "invoiceId": "3d2c1b0a-9f8e-4d7c-a6b5-c4d3e2f1a0b9",  "maxPeriods": 3,  "carriedAmount": 300,  "creditApplied": 2000,  "lines": [    {      "kind": "string",      "description": "string",      "amount": 0,      "usageQuantity": 0,      "unitAmountDecimal": "string",      "usagePeriodStart": "2019-08-24T14:15:22Z",      "usagePeriodEnd": "2019-08-24T14:15:22Z"    }  ],  "amountDue": 13000,  "brandId": "3f2b8c1e-6a4d-4e0b-9d71-5c8a2b7e4f10",  "url": "https://pay.example.com/s/0b6f3a52-6c1e-4f0a-8d2e-5a1c9e7b4d10#Zm9v"}