Hosted checkout
Every request goes to https://api.lemak.cash. About the reference.
Checkout page
GET /c/{token}
The hosted checkout page. The session token in the path is the whole authority, so this route takes no key and the page carries none.
Authentication
None. The checkout session token in the path is the whole authority.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
token required | path | string | The checkout session token. It is unguessable and short lived. |
Responses
200
The page.
text/html
string
Errors
Every error answers with the error object.
| Status | When |
|---|---|
| 410 | The session expired. No attempt is created. |
| Other | 400 bad parameter, 401 authentication, 402 payment failed, 403 forbidden, 404 not found, 409 conflict, 413 request_too_large (a body over 64 KiB), 422 idempotency key reused, 429 rate limited, 5xx api error. |
Example
curl https://api.lemak.cash/c/<token>
Pay checkout session
POST /checkout/sessions/{token}/pay
Start the attempt for the method the payer picked. A session that already holds a pending attempt answers with the credential it already has.
Authentication
None. The checkout session token in the path is the whole authority.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
token required | path | string | The checkout session token. It is unguessable and short lived. |
Request body
application/json
CheckoutPay
| Field | Type | Description |
|---|---|---|
payment_method required | string |
Responses
200
The payment credential.
application/json
CheckoutState
| Field | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
status required | string | One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled. | ||||||||||||
next_action optional | NextAction | Fields of next_action
| ||||||||||||
redirect_url optional | string (uri) | Where to send the payer once the payment succeeded. |
Errors
Every error answers with the error object.
| Status | When |
|---|---|
| 409 | live_not_enabled: the session is live and the merchant's review no longer holds live mode open. No attempt is created and no credential is served. |
| 410 | The session expired. No attempt is created. |
| Other | 400 bad parameter, 401 authentication, 402 payment failed, 403 forbidden, 404 not found, 409 conflict, 413 request_too_large (a body over 64 KiB), 422 idempotency key reused, 429 rate limited, 5xx api error. |
Example
curl -X POST https://api.lemak.cash/checkout/sessions/<token>/pay \
-H "Content-Type: application/json" \
-d '{
"payment_method": "<payment_method>"
}'
Simulate checkout session
POST /checkout/sessions/{token}/simulate
The test panel of the hosted page. Test mode only: tell the channel behind the pending attempt what to report, as POST /v1/test/payment_intents/{id}/simulate does. A session of a live intent answers 404, as a missing session does.
Authentication
None. The checkout session token in the path is the whole authority.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
token required | path | string | The checkout session token. It is unguessable and short lived. |
Request body
application/json
CheckoutSimulate
| Field | Type | Description |
|---|---|---|
outcome required | string | One of succeeded, failed. |
failure_code optional | string | The decline reason a failed outcome reports. It becomes the attempt failure_code. Allowed with outcome failed alone. One of insufficient_funds, payer_cancelled, risk_blocked. |
Responses
200
The state of the payment the moment the callback landed.
application/json
CheckoutState
| Field | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
status required | string | One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled. | ||||||||||||
next_action optional | NextAction | Fields of next_action
| ||||||||||||
redirect_url optional | string (uri) | Where to send the payer once the payment succeeded. |
Errors
Every error answers with the error object.
| Status | When |
|---|---|
| 410 | The session expired. |
| Other | 400 bad parameter, 401 authentication, 402 payment failed, 403 forbidden, 404 not found, 409 conflict, 413 request_too_large (a body over 64 KiB), 422 idempotency key reused, 429 rate limited, 5xx api error. |
Example
curl -X POST https://api.lemak.cash/checkout/sessions/<token>/simulate \
-H "Content-Type: application/json" \
-d '{
"outcome": "succeeded"
}'
Checkout session status
GET /checkout/sessions/{token}/status
What the page polls. It carries the redirect once the payment succeeds.
Authentication
None. The checkout session token in the path is the whole authority.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
token required | path | string | The checkout session token. It is unguessable and short lived. |
Responses
200
The state of the payment behind this session.
application/json
CheckoutState
| Field | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
status required | string | One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled. | ||||||||||||
next_action optional | NextAction | Fields of next_action
| ||||||||||||
redirect_url optional | string (uri) | Where to send the payer once the payment succeeded. |
Errors
Every error answers with the error object.
| Status | When |
|---|---|
| 410 | The session expired. |
| Other | 400 bad parameter, 401 authentication, 402 payment failed, 403 forbidden, 404 not found, 409 conflict, 413 request_too_large (a body over 64 KiB), 422 idempotency key reused, 429 rate limited, 5xx api error. |
Example
curl https://api.lemak.cash/checkout/sessions/<token>/status