Create a public checkout
POST
/v2/public/checkoutsHeader parameters
idempotency-keystringrequiredRequired for write endpoints that create records and need deterministic retry behavior.
min length 1 · max length 255
x-request-idstringOptional caller-provided request correlation ID.
min length 1
Request body
requiredapplication/jsonlocatorstringrequiredmin length 1 · max length 160
offerIdstring<uuid>requiredformIdstring<uuid>buyerobjectrequiredShow propertiesHide properties
namestringmin length 1 · max length 160
emailstring<email>requiredmax length 254
mobilestringmin length 1 · max length 32
localestringAllowed:
enarbillingAddressobjectShow propertiesHide properties
line1stringrequiredmin length 1 · max length 200
line2stringmin length 1 · max length 200
citystringrequiredmin length 1 · max length 120
regionstringrequiredmin length 1 · max length 120
postalCodestringrequiredmin length 1 · max length 20
countryCodestringmin length 2 · max length 2 · default: "SA"
addressstringmin length 1 · max length 500
countrystringmin length 2 · max length 2
companyNamestringmin length 1 · max length 160
companyTaxNumberstringmin length 1 · max length 32
customAmountHalalasintegermin 0 · max 9007199254740991
discountCodestringmax length 64 · matches ^[A-Z0-9_-]{1,64}$
policyFingerprintstringmatches ^[a-f0-9]{64}$
recurringConsentAcceptedanyResponses
200OK
checkoutobject | anyrequiredShow propertiesHide properties
Any of:
object
capabilitystringrequiredmin length 32 · max length 512
orderIdstring<uuid>productIdstring<uuid>statusobjectrequiredShow propertiesHide properties
statestringrequiredAllowed:
ready_for_checkouthosted_checkout_opencompletedfailedexpiredrecoverablehostedUrlstring<uri> | anyrequiredShow propertiesHide properties
Any of:
string<uri>
string<uri>any
anyexpiresAtstring<date-time>requirednextActionstringrequiredAllowed:
open_hosted_checkoutwaitdoneretrycontact_merchantcheckoutDesignobject | anyrequiredShow propertiesHide properties
Any of:
object
logoAssetIdstring<uuid> | anyShow propertiesHide properties
Any of:
string<uuid>
string<uuid>any
anyaccentColoranybackgroundColoranytextColoranyfontstringrequiredAllowed:
systemarabic_sansseriflayoutstringAllowed:
two_columnstackedproductOrderstring<uuid>[]max items 100
acceptsDiscountCodebooleandefault: false
copyobjectrequiredShow propertiesHide properties
headingobjectrequiredShow propertiesHide properties
enstringrequiredmin length 1 · max length 120
arstringrequiredmin length 1 · max length 120
subheadingobjectrequiredShow propertiesHide properties
enstringrequiredmin length 1 · max length 120
arstringrequiredmin length 1 · max length 120
submitLabelobjectrequiredShow propertiesHide properties
enstringrequiredmin length 1 · max length 120
arstringrequiredmin length 1 · max length 120
any
anyorderIdstring<uuid>productIdstring<uuid>any
any400Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject404Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject409Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject422Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject429Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject500Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobjectRequest
curl -X POST "https://api.cipay.net/v2/public/checkouts" \
-H "idempotency-key: string" \
-H "Content-Type: application/json" \
-d '{
"locator": "string",
"offerId": "<uuid>",
"formId": "<uuid>",
"buyer": {
"name": "string",
"email": "<email>",
"mobile": "string",
"locale": "en",
"billingAddress": {
"line1": "string",
"line2": "string",
"city": "string",
"region": "string",
"postalCode": "string",
"countryCode": "SA"
},
"address": "string",
"country": "string",
"companyName": "string",
"companyTaxNumber": "string"
},
"customAmountHalalas": 0,
"discountCode": "string",
"policyFingerprint": "string",
"recurringConsentAccepted": true
}'const response = await fetch("https://api.cipay.net/v2/public/checkouts", {
method: "POST",
headers: {
"idempotency-key": "string",
"Content-Type": "application/json"
},
body: JSON.stringify({
"locator": "string",
"offerId": "<uuid>",
"formId": "<uuid>",
"buyer": {
"name": "string",
"email": "<email>",
"mobile": "string",
"locale": "en",
"billingAddress": {
"line1": "string",
"line2": "string",
"city": "string",
"region": "string",
"postalCode": "string",
"countryCode": "SA"
},
"address": "string",
"country": "string",
"companyName": "string",
"companyTaxNumber": "string"
},
"customAmountHalalas": 0,
"discountCode": "string",
"policyFingerprint": "string",
"recurringConsentAccepted": true
})
});Response
{
"checkout": {
"capability": "string",
"orderId": "<uuid>",
"productId": "<uuid>",
"status": {
"state": "ready_for_checkout",
"hostedUrl": "<uri>",
"expiresAt": "2024-01-01T00:00:00Z",
"nextAction": "open_hosted_checkout",
"checkoutDesign": {
"logoAssetId": "<uuid>",
"accentColor": "string",
"backgroundColor": "string",
"textColor": "string",
"font": "system",
"layout": "two_column",
"productOrder": [
"<uuid>"
],
"acceptsDiscountCode": false,
"copy": {
"heading": {
"en": "string",
"ar": "string"
},
"subheading": {
"en": "string",
"ar": "string"
},
"submitLabel": {
"en": "string",
"ar": "string"
}
}
},
"orderId": "<uuid>",
"productId": "<uuid>"
}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}