Create a hosted checkout
Creates a payment link your customer opens to pay you by mobile money or iSmartPay. Use amountType fixed with amount, or open with optional minAmount, maxAmount and up to four suggestedAmounts. usage single closes after one payment; reusable stays open. Share the returned url: it carries a secret, so send it only to the payer. The checkout becomes paid only when the payment succeeds. Hosted checkout must be turned on by a business owner first and needs verification tier 2. Send a required Idempotency-Key header. Requires the collections.write permission. Optional appearance (accent colour, button text, payment method order), lineItems and metadata shape what the page shows; see the request schema for the rules.
/v1/checkoutsAuthorizationBearer token (JWT) · headerrequiredA token from POST /v1/oauth/token on the iSmartPay identity service, obtained with an API credential's client id and secret.
Idempotency-KeystringrequiredA unique value you generate for this attempt, at most 255 characters. Send the same value when you retry the same request: it is answered once, however many times you send it. Reusing a value with a different body is refused with 409 idempotency_key_reused.
application/jsonreferencestringrequiredamountTypestringfixedopenamountstring | nullRequired for fixed amount checkouts and omitted or null for open amount checkouts.
minAmountstring | nullmaxAmountstring | nullsuggestedAmountsstring[]usagestringsinglereusablecurrencystringrequireddescriptionstringenvironmentstringOptional test or live. Omit it to use this API's environment; a different one returns 422 environment_mismatch.
testlivesuccessUrlstring<uri>cancelUrlstring<uri>expiresInMinutesinteger | nullFor single checkouts, 5 to 10080, default 60, and null is rejected. For reusable checkouts, 5 to 525600 or null/omitted for no expiry.
Show propertiesHide properties
integernullappearanceCheckoutAppearanceOverrideOverrides for this checkout. Anything you leave out falls back to the business default set in the console, then to the standard look.
Show propertiesHide properties
accentColorstringA hex colour. Refused with 422 accent_contrast_too_low unless white text on it has a contrast ratio of at least 4.5:1. Stored as six lowercase hex characters.
buttonTextstringWhat the pay button says: Pay, Pay with the amount, Donate or Book.
paypay_amountdonatebookpaymentMethodsstring[]Providers to show, in this order. The page never shows more than the payment providers offer at that moment, so a listed provider that is down or unavailable is left out. Providers not listed are hidden. An unknown provider is refused with 422.
lineItemsCheckoutLineItem[]Shown on the page, never charged on their own. On a fixed checkout the sum of quantity times amount over all rows must equal amount, or the request is refused with 422. On an open checkout they are display only.
Show propertiesHide properties
CheckoutLineItemlabelstringrequiredquantityintegerrequiredamountstringrequiredThe price of one unit, a GHS amount with two decimal places.
metadataobjectUp to 20 string pairs of your own. Keys are 1 to 40 characters and values at most 500. Returned when you read the checkout, never shown on the page.
walletIdstring<uuid>The wallet a mobile money payment lands in. A customer paying with iSmartPay pays into your primary wallet. It is checked when the checkout is created, so the key also needs wallets.read. A closed wallet is 422 wallet_closed; an id that is not yours is 404.
The checkout.
idstring<uuid>requiredreferencestringrequiredamountstring | nullrequiredcurrencystringrequireddescriptionstringenvironmentstringrequiredtestlivestatusstringrequiredReusable checkouts stay open after settlement and never have paid status.
openpaidexpiredcancelledurlstring<uri>requiredContains the public bearer token for this checkout.
successUrlstring<uri>cancelUrlstring<uri>expiresAtstring<date-time> | nullrequiredpaidAtstring<date-time> | nullrequiredcollectionReferencestring | nullrequiredattemptsCheckoutAttempt[]Present only on the single-checkout read.
Show propertiesHide properties
CheckoutAttemptcollectionReferencestringrequiredproviderstringrequiredpayerstringrequiredThe payer: a masked phone number, or @handle when the customer paid with iSmartPay using a handle.
statusstringrequiredpendingsucceededfailedfailureReasonstringcreatedAtstring<date-time>requiredamountstringrequiredcreatedAtstring<date-time>requiredamountTypestringrequiredfixedopenminAmountstring | nullrequiredmaxAmountstring | nullrequiredsuggestedAmountsstring[]requiredusagestringrequiredsinglereusablepaymentsCountintegerrequiredtotalCollectedstringrequiredSettled payments only.
appearanceCheckoutAppearanceOverrideOverrides for this checkout. Anything you leave out falls back to the business default set in the console, then to the standard look.
Show propertiesHide properties
accentColorstringA hex colour. Refused with 422 accent_contrast_too_low unless white text on it has a contrast ratio of at least 4.5:1. Stored as six lowercase hex characters.
buttonTextstringWhat the pay button says: Pay, Pay with the amount, Donate or Book.
paypay_amountdonatebookpaymentMethodsstring[]Providers to show, in this order. The page never shows more than the payment providers offer at that moment, so a listed provider that is down or unavailable is left out. Providers not listed are hidden. An unknown provider is refused with 422.
lineItemsCheckoutLineItem[]Left out when the checkout has none.
Show propertiesHide properties
CheckoutLineItemlabelstringrequiredquantityintegerrequiredamountstringrequiredThe price of one unit, a GHS amount with two decimal places.
metadataobjectUp to 20 string pairs of your own. Keys are 1 to 40 characters and values at most 500. Returned when you read the checkout, never shown on the page.
walletIdstring<uuid>The wallet the money went into or came out of, when one was named.
The request is not valid. message says which field.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
The token is missing, expired or not valid. Get a new one from the token endpoint.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
The request was understood and refused. Common causes: the token is not an API credential's (forbidden); the credential is for the other environment (environment_mismatch); it does not have the permission this operation needs (forbidden); a limit was reached (limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit); or iSmartPay has suspended or deactivated the business (business_suspended, business_deactivated). A suspended business's API credentials stop exchanging for tokens, so a request made with a token issued just before the suspension is refused with business_suspended.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
Nothing was found with that reference or number. For utilities, product_not_found means no product has that productId.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
checkout_not_enabled (an owner has not turned on hosted checkout), checkout_not_open, checkout_reference_taken or idempotency_key_reused.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
environment_mismatch: the environment you sent is not this API's. accent_contrast_too_low: white text on the accent colour is under 4.5:1. invalid_input: an appearance, line item or metadata value breaks its rule, or line items do not add up to amount on a fixed checkout.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
Too many requests for this credential. Wait the number of seconds in the Retry-After header, then try again.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
Something failed on our side. The message is fixed. If the request was a POST, retry with the same Idempotency-Key and body.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
A service behind the API did not answer usably. If the request was a POST, retry with the same Idempotency-Key and body. A party lookup the provider rejects is provider_error.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
The API is temporarily unable to tell which environment it serves (environment_unknown), utility purchases are not available right now (utilities_unavailable), a settlement destination could not be name-checked just now (destination_verification_unavailable; retry the same request), or hosted checkout is not set up on this deployment (checkout_unavailable). Retry shortly, except for checkout_unavailable, which lasts until the deployment is configured.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.
The request took too long. If it was a POST, its outcome is unknown: retry with the same Idempotency-Key and body, or read it back by reference. A party lookup the provider does not answer is provider_timeout: check again before relying on it.
errorobjectrequiredShow propertiesHide properties
codestringrequiredA stable, machine-readable code. Branch on this, not on the message. Codes include invalid_input, unauthenticated, forbidden, environment_mismatch, not_found, rate_limited, idempotency_key_reused, request_in_flight, limits_missing, limits_unusable, tier_ineligible, transaction_limit_exceeded, daily_limit_exceeded, monthly_limit_exceeded, new_destination_limit, business_suspended, business_deactivated, environment_unknown, duplicate_reference, provider_error, provider_timeout, destination_not_verified, destination_verification_unavailable, upstream_timeout and internal.
messagestringrequiredReadable detail for a person. For any 5xx it is always the fixed text internal server error.