Payment intents

Every request goes to https://api.lemak.cash. About the reference.

Create a payment intent

POST /v1/payment_intents

Creates a payment intent. Without payment_method, the payment intent stays created and the response includes checkout_url, a hosted page where the payer chooses how to pay. With payment_method, the order is placed with a payment channel at once, and the payment intent is returned in requires_payment with a next_action. If no channel can take the payment, the request fails with 402 no_channel_available and no payment intent is created. Without payment_method, this means no payment method can take the amount in this currency. To charge the payer in another currency, set payment_currency. You price the payment in amount and currency, which must be your settlement currency, and the payer pays the converted amount in payment_currency. The exchange rate is always locked when the payment intent is created, whatever your lock point setting, and it holds until the payment intent expires. markup_bearer chooses who pays the conversion markup.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
Idempotency-Key requiredheaderstringA unique key you generate for this request, up to 255 characters. A retry with the same key and body returns the original response. Without it, the request returns 400 idempotency_key_required. At most 255 characters.
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

Request body

application/json

PaymentIntentCreate

FieldTypeDescription
amount requiredinteger (int64)The amount to collect, in the smallest currency unit. With payment_currency, the price of the order in currency, which must then be your settlement currency, or the request fails with 400 unsupported_pricing_currency. Minimum 1.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payment_currency optionalstringThe currency the payer pays in, when it differs from currency. The amount is converted automatically and returned in payment_amount. The rate is locked at creation and holds until the payment intent expires. Requires payment_method; a crypto method returns 400 conversion_unsupported. When no rate is available, the request fails with 400 rate_unavailable. Pattern ^[A-Z]{3,5}$.
markup_bearer optionalstringWho pays the conversion markup when payment_currency is set. Defaults to payer. payer: the payer pays the conversion and your fee, so you receive exactly amount. The payment amount is amount at the applied rate (fx.rate), grossed up by your fee rate and fixed fee, and rounded up to the payment currency's smallest unit. merchant: the payer pays amount converted at the market rate without markup, rounded up. You receive the payment amount less your fee, converted at the applied rate (fx.rate) and rounded down. One of payer, merchant.
merchant_order_id requiredstringYour ID for the order. It must be unique across all payment intents in your account. At most 255 characters.
payment_method optionalstringThe payment method code. When set, the order is placed with a payment channel at once. When omitted, the payer chooses a method on the hosted checkout page. For a crypto method such as tron or base, currency is the token, USDT or USDC, and the default expiry is 30 minutes.
channel_preference optionalstringThe code of a payment channel you prefer.
description optionalstringA description of the payment.
customer optionalstringYour ID for the customer.
receipt_email optionalstringThe payer's email address. When the payment succeeds, the receipt is sent to it, in the language of the payment's country, else English. Any value that is not one email address returns 400 invalid_receipt_email. It is not returned. At most 254 characters.
return_url optionalstring (uri)The page the payer returns to after a successful payment. It must be an absolute https URL with a host name and no user info. IP addresses and localhost are not accepted, in test mode too. Any other value returns 400 invalid_return_url. At most 2048 characters.
expires_in optionalintegerThe number of seconds until the payment intent expires. When omitted, the payment method's default applies.
metadata optionalobjectKey-value pairs of strings to store on the payment intent. A map of string keys to string values.
payer optionalPayerDetails about the payer. Some payment channels require some of these fields, and a channel is not used when a field it requires is missing. The details are sent to the channel for this payment only. They are never stored or returned.
Fields of payer
FieldTypeDescription
name optionalstringThe payer's full name. At most 200 characters.
phone optionalstringThe payer's phone number in E.164 format, such as +66812345678. Pattern ^\+[1-9][0-9]{6,14}$.
email optionalstringThe payer's email address. At most 254 characters.
country optionalstringTwo-letter ISO 3166-1 country code. When set, routing keeps to payment methods of this country and to methods tied to no country, such as crypto. The hosted checkout page offers only those. Pattern ^[A-Z]{2}$.
bank_code optionalstringThe payer's bank, as one of the bank codes the payment method supports. Pattern ^[A-Za-z0-9_]{1,32}$.
national_id optionalstringThe payer's national identity number, such as a 13-digit CNIC. Pattern ^[0-9]{13}$.
ip optionalstringThe payer's IP address. Some channels, such as cashapp, require it. Send the payer's address, not your server's. The hosted checkout page ignores this field and uses the payer's own address.

Responses

201

Returns the payment intent. A retry with the same Idempotency-Key and body returns the original response.

application/json

PaymentIntent

A payment intent tracks one payment from creation to settlement.

FieldTypeDescription
id requiredstringUnique identifier for the payment intent.
object requiredpayment_intent
mode requiredstringlive for production, test for test mode. One of live, test.
amount requiredinteger (int64)The amount to collect, in the smallest currency unit. With automatic conversion, the price you set, and the payer pays payment_amount.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payment_amount optionalMoneyWhat the payer pays. Present only with automatic conversion. The fee is charged on this amount.
Fields of payment_amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
presentment_details optionalPresentmentDetailsWhat the payer is shown and charged. Present once a payment method is chosen.
Fields of presentment_details
FieldTypeDescription
presentment_amount requiredinteger (int64)The amount charged, in the smallest currency unit: amount rounded up to the method's rounding_increment, and at least its minimum_amount.
presentment_currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
markup_bearer optionalstringWho pays the conversion markup. Present only with automatic conversion. One of payer, merchant.
merchant_order_id requiredstringYour ID for the order.
status requiredstringThe status of the payment intent. succeeded moves on to channel_settled, or to failed when the payment is reversed: the chain took back a crypto transfer, or the payment channel never paid a payment that succeeded. A reversal takes the amount back from your balance and emits payment_intent.failed and payment_intent.reversed. One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled.
payment_method optionalstringThe payment method code, once one is chosen.
fee optionalMoneyThe whole fee for the payment, in the payment currency, once a payment method is chosen. It includes the cost of the payment channel.
Fields of fee
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
fx optionalFxLockThe exchange rate locked for this payment.
Fields of fx
FieldTypeDescription
locked requiredbooleanWhether a rate is locked.
lock_point optionalstringWhen the rate is locked: when the payment intent is created, or when it is paid. A crypto payment locks when the channel settles it. A payment intent with automatic conversion is always on_create. One of on_create, on_paid, on_channel_settled.
rate optionalstringThe applied rate, as a decimal string: units of the payment currency for one unit of quote_currency, markup included.
quote_currency optionalstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
locked_at optionalstring (date-time)The time the rate was locked.
net optionalMoneyThe amount you receive, in the settlement currency.
Fields of net
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
available_at optionalstring (date-time)The time the funds become available in your balance.
next_action optionalNextActionWhat the payer must do to complete the payment.
Fields of next_action
FieldTypeDescription
type requiredstringHow to present the payment: redirect sends the payer to url, qr_code shows qr_data as a QR code, and crypto_address shows a deposit address. One of redirect, qr_code, crypto_address.
url optionalstring (uri)The URL to send the payer to. For crypto_address, the wallet payment URI.
qr_data optionalstringThe data to show as a QR code. For crypto_address, the wallet payment URI.
address optionalstringThe deposit address of a crypto_address action. Show it as text next to the QR code.
crypto optionalCryptoFinalityWhether a crypto payment is final. Present only on crypto payment intents. On a layer 2 network, a payment succeeds when the transfer is seen and becomes final when its batch is confirmed on layer 1. Until then the chain can reverse it: the payment intent moves to failed, and you receive the events payment_intent.failed and payment_intent.reversed. When the payment becomes final, you receive payment_intent.finalized once. For a high-value order, wait for this event before you deliver.
Fields of crypto
FieldTypeDescription
final requiredbooleanWhether the chain can no longer reverse the payment.
final_at optionalstring (date-time)The time the payment became final.
invoice optionalPaymentIntentInvoiceThe invoice issued with the payment intent. Its hosted page shows the amount due, the due date and a pay button while the payment intent is open, and the outcome after. The page prints to an A4 PDF from the browser.
Fields of invoice
FieldTypeDescription
number requiredstringThe invoice number, sequential per account and mode, for example 3F9A1C07-0042. A sandbox number starts with TEST-.
hosted_invoice_url requiredstring (uri)The URL of the hosted invoice page. Share it with the payer.
receipt optionalPaymentIntentReceiptThe receipt issued when the payment intent succeeds. Present from succeeded on.
Fields of receipt
FieldTypeDescription
number requiredstringThe receipt number, sequential per account and mode, for example 3F9A1C07-R0042. A sandbox number starts with TEST-.
receipt_url requiredstring (uri)The URL of the hosted receipt page.
checkout_url optionalstring (uri)The URL of the hosted checkout page. It is returned only in the response that creates the payment intent.
created requiredstring (date-time)The time the payment intent was created.
expires_at optionalstring (date-time)The time the payment intent expires if it is not paid.
metadata optionalobjectKey-value pairs of strings stored on the payment intent. A map of string keys to string values.

Errors

Every error answers with the error object.

StatusWhen
400A parameter is invalid. An unacceptable return_url returns invalid_return_url. An amount below the minimum deposit of a crypto payment_method returns amount_below_minimum.
402No payment was started. No channel can take the payment (no_channel_available). Or the payment is over a limit on your account, in production mode only: transaction_limit_exceeded when the amount is over the limit for one payment, and daily_limit_exceeded when it would take the day's volume over the daily limit. The day is the UTC calendar day. The volume is every payment intent created that day whose payment started and did not fail, expire or get canceled. A hosted checkout where the payer chose no method does not count. Limits are in USD; another currency is converted at the current mid rate. Contact support to change a limit. Or risk rules declined the payment, in production mode only (payment_blocked). When the request names a payment_method, the decline can come after the payment intent is created: the payment intent is then failed, no channel order is placed, and you receive payment_intent.failed.
409A request with the same Idempotency-Key is still in progress (request_in_progress), or the merchant_order_id is already in use (merchant_order_id_taken).
422The Idempotency-Key was already used with a different request body (idempotency_key_reused).
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl -X POST https://api.lemak.cash/v1/payment_intents \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Api-Version: 2026-12-01" \
  -H "Content-Type: application/json" \
  -d '{
  "amount": 1000,
  "currency": "PHP",
  "merchant_order_id": "<merchant_order_id>"
}'

List payment intents

GET /v1/payment_intents

Returns a list of payment intents, newest first.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.
limit optionalqueryintegerThe maximum number of objects to return, from 1 to 100. Minimum 1. Maximum 100. Default 20.
starting_after optionalquerystringA pagination cursor. Pass the ID of the last object on the previous page to get the next page.
status optionalquerystringOnly return payment intents with this status. One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled.
merchant_order_id optionalquerystringOnly return the payment intent with this order ID.
created[gte] optionalquerystring (date-time)Only return payment intents created at or after this time, in RFC 3339 format.

Responses

200

A list of payment intents.

application/json

PaymentIntentList

FieldTypeDescription
object requiredlist
data requiredarray of PaymentIntent
Fields of data
FieldTypeDescription
id requiredstringUnique identifier for the payment intent.
object requiredpayment_intent
mode requiredstringlive for production, test for test mode. One of live, test.
amount requiredinteger (int64)The amount to collect, in the smallest currency unit. With automatic conversion, the price you set, and the payer pays payment_amount.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payment_amount optionalMoneyWhat the payer pays. Present only with automatic conversion. The fee is charged on this amount.
Fields of payment_amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
presentment_details optionalPresentmentDetailsWhat the payer is shown and charged. Present once a payment method is chosen.
Fields of presentment_details
FieldTypeDescription
presentment_amount requiredinteger (int64)The amount charged, in the smallest currency unit: amount rounded up to the method's rounding_increment, and at least its minimum_amount.
presentment_currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
markup_bearer optionalstringWho pays the conversion markup. Present only with automatic conversion. One of payer, merchant.
merchant_order_id requiredstringYour ID for the order.
status requiredstringThe status of the payment intent. succeeded moves on to channel_settled, or to failed when the payment is reversed: the chain took back a crypto transfer, or the payment channel never paid a payment that succeeded. A reversal takes the amount back from your balance and emits payment_intent.failed and payment_intent.reversed. One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled.
payment_method optionalstringThe payment method code, once one is chosen.
fee optionalMoneyThe whole fee for the payment, in the payment currency, once a payment method is chosen. It includes the cost of the payment channel.
Fields of fee
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
fx optionalFxLockThe exchange rate locked for this payment.
Fields of fx
FieldTypeDescription
locked requiredbooleanWhether a rate is locked.
lock_point optionalstringWhen the rate is locked: when the payment intent is created, or when it is paid. A crypto payment locks when the channel settles it. A payment intent with automatic conversion is always on_create. One of on_create, on_paid, on_channel_settled.
rate optionalstringThe applied rate, as a decimal string: units of the payment currency for one unit of quote_currency, markup included.
quote_currency optionalstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
locked_at optionalstring (date-time)The time the rate was locked.
net optionalMoneyThe amount you receive, in the settlement currency.
Fields of net
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
available_at optionalstring (date-time)The time the funds become available in your balance.
next_action optionalNextActionWhat the payer must do to complete the payment.
Fields of next_action
FieldTypeDescription
type requiredstringHow to present the payment: redirect sends the payer to url, qr_code shows qr_data as a QR code, and crypto_address shows a deposit address. One of redirect, qr_code, crypto_address.
url optionalstring (uri)The URL to send the payer to. For crypto_address, the wallet payment URI.
qr_data optionalstringThe data to show as a QR code. For crypto_address, the wallet payment URI.
address optionalstringThe deposit address of a crypto_address action. Show it as text next to the QR code.
crypto optionalCryptoFinalityWhether a crypto payment is final. Present only on crypto payment intents. On a layer 2 network, a payment succeeds when the transfer is seen and becomes final when its batch is confirmed on layer 1. Until then the chain can reverse it: the payment intent moves to failed, and you receive the events payment_intent.failed and payment_intent.reversed. When the payment becomes final, you receive payment_intent.finalized once. For a high-value order, wait for this event before you deliver.
Fields of crypto
FieldTypeDescription
final requiredbooleanWhether the chain can no longer reverse the payment.
final_at optionalstring (date-time)The time the payment became final.
invoice optionalPaymentIntentInvoiceThe invoice issued with the payment intent. Its hosted page shows the amount due, the due date and a pay button while the payment intent is open, and the outcome after. The page prints to an A4 PDF from the browser.
Fields of invoice
FieldTypeDescription
number requiredstringThe invoice number, sequential per account and mode, for example 3F9A1C07-0042. A sandbox number starts with TEST-.
hosted_invoice_url requiredstring (uri)The URL of the hosted invoice page. Share it with the payer.
receipt optionalPaymentIntentReceiptThe receipt issued when the payment intent succeeds. Present from succeeded on.
Fields of receipt
FieldTypeDescription
number requiredstringThe receipt number, sequential per account and mode, for example 3F9A1C07-R0042. A sandbox number starts with TEST-.
receipt_url requiredstring (uri)The URL of the hosted receipt page.
checkout_url optionalstring (uri)The URL of the hosted checkout page. It is returned only in the response that creates the payment intent.
created requiredstring (date-time)The time the payment intent was created.
expires_at optionalstring (date-time)The time the payment intent expires if it is not paid.
metadata optionalobjectKey-value pairs of strings stored on the payment intent. A map of string keys to string values.
has_more requiredbooleanWhether more objects exist after this page.

Errors

Every error answers with the error object.

StatusWhen
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl https://api.lemak.cash/v1/payment_intents \
  -H "Authorization: Bearer sk_test_..." \
  -H "Api-Version: 2026-12-01"

Retrieve a payment intent

GET /v1/payment_intents/{id}

Retrieves a payment intent by its ID.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
id requiredpathstringThe ID of the payment intent. Pattern ^pi_[0-9A-Za-z]+$.
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

Responses

200

Returns the payment intent.

application/json

PaymentIntent

A payment intent tracks one payment from creation to settlement.

FieldTypeDescription
id requiredstringUnique identifier for the payment intent.
object requiredpayment_intent
mode requiredstringlive for production, test for test mode. One of live, test.
amount requiredinteger (int64)The amount to collect, in the smallest currency unit. With automatic conversion, the price you set, and the payer pays payment_amount.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payment_amount optionalMoneyWhat the payer pays. Present only with automatic conversion. The fee is charged on this amount.
Fields of payment_amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
presentment_details optionalPresentmentDetailsWhat the payer is shown and charged. Present once a payment method is chosen.
Fields of presentment_details
FieldTypeDescription
presentment_amount requiredinteger (int64)The amount charged, in the smallest currency unit: amount rounded up to the method's rounding_increment, and at least its minimum_amount.
presentment_currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
markup_bearer optionalstringWho pays the conversion markup. Present only with automatic conversion. One of payer, merchant.
merchant_order_id requiredstringYour ID for the order.
status requiredstringThe status of the payment intent. succeeded moves on to channel_settled, or to failed when the payment is reversed: the chain took back a crypto transfer, or the payment channel never paid a payment that succeeded. A reversal takes the amount back from your balance and emits payment_intent.failed and payment_intent.reversed. One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled.
payment_method optionalstringThe payment method code, once one is chosen.
fee optionalMoneyThe whole fee for the payment, in the payment currency, once a payment method is chosen. It includes the cost of the payment channel.
Fields of fee
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
fx optionalFxLockThe exchange rate locked for this payment.
Fields of fx
FieldTypeDescription
locked requiredbooleanWhether a rate is locked.
lock_point optionalstringWhen the rate is locked: when the payment intent is created, or when it is paid. A crypto payment locks when the channel settles it. A payment intent with automatic conversion is always on_create. One of on_create, on_paid, on_channel_settled.
rate optionalstringThe applied rate, as a decimal string: units of the payment currency for one unit of quote_currency, markup included.
quote_currency optionalstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
locked_at optionalstring (date-time)The time the rate was locked.
net optionalMoneyThe amount you receive, in the settlement currency.
Fields of net
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
available_at optionalstring (date-time)The time the funds become available in your balance.
next_action optionalNextActionWhat the payer must do to complete the payment.
Fields of next_action
FieldTypeDescription
type requiredstringHow to present the payment: redirect sends the payer to url, qr_code shows qr_data as a QR code, and crypto_address shows a deposit address. One of redirect, qr_code, crypto_address.
url optionalstring (uri)The URL to send the payer to. For crypto_address, the wallet payment URI.
qr_data optionalstringThe data to show as a QR code. For crypto_address, the wallet payment URI.
address optionalstringThe deposit address of a crypto_address action. Show it as text next to the QR code.
crypto optionalCryptoFinalityWhether a crypto payment is final. Present only on crypto payment intents. On a layer 2 network, a payment succeeds when the transfer is seen and becomes final when its batch is confirmed on layer 1. Until then the chain can reverse it: the payment intent moves to failed, and you receive the events payment_intent.failed and payment_intent.reversed. When the payment becomes final, you receive payment_intent.finalized once. For a high-value order, wait for this event before you deliver.
Fields of crypto
FieldTypeDescription
final requiredbooleanWhether the chain can no longer reverse the payment.
final_at optionalstring (date-time)The time the payment became final.
invoice optionalPaymentIntentInvoiceThe invoice issued with the payment intent. Its hosted page shows the amount due, the due date and a pay button while the payment intent is open, and the outcome after. The page prints to an A4 PDF from the browser.
Fields of invoice
FieldTypeDescription
number requiredstringThe invoice number, sequential per account and mode, for example 3F9A1C07-0042. A sandbox number starts with TEST-.
hosted_invoice_url requiredstring (uri)The URL of the hosted invoice page. Share it with the payer.
receipt optionalPaymentIntentReceiptThe receipt issued when the payment intent succeeds. Present from succeeded on.
Fields of receipt
FieldTypeDescription
number requiredstringThe receipt number, sequential per account and mode, for example 3F9A1C07-R0042. A sandbox number starts with TEST-.
receipt_url requiredstring (uri)The URL of the hosted receipt page.
checkout_url optionalstring (uri)The URL of the hosted checkout page. It is returned only in the response that creates the payment intent.
created requiredstring (date-time)The time the payment intent was created.
expires_at optionalstring (date-time)The time the payment intent expires if it is not paid.
metadata optionalobjectKey-value pairs of strings stored on the payment intent. A map of string keys to string values.

Errors

Every error answers with the error object.

StatusWhen
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl https://api.lemak.cash/v1/payment_intents/pi_123 \
  -H "Authorization: Bearer sk_test_..." \
  -H "Api-Version: 2026-12-01"

Cancel a payment intent

POST /v1/payment_intents/{id}/cancel

Cancels a payment intent in status created, requires_payment or processing. Any other status returns 409 invalid_state_transition. Canceling a payment intent that is already canceled returns it unchanged.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
id requiredpathstringThe ID of the payment intent. Pattern ^pi_[0-9A-Za-z]+$.
Idempotency-Key requiredheaderstringA unique key you generate for this request, up to 255 characters. A retry with the same key and body returns the original response. Without it, the request returns 400 idempotency_key_required. At most 255 characters.
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

Responses

200

Returns the canceled payment intent.

application/json

PaymentIntent

A payment intent tracks one payment from creation to settlement.

FieldTypeDescription
id requiredstringUnique identifier for the payment intent.
object requiredpayment_intent
mode requiredstringlive for production, test for test mode. One of live, test.
amount requiredinteger (int64)The amount to collect, in the smallest currency unit. With automatic conversion, the price you set, and the payer pays payment_amount.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payment_amount optionalMoneyWhat the payer pays. Present only with automatic conversion. The fee is charged on this amount.
Fields of payment_amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
presentment_details optionalPresentmentDetailsWhat the payer is shown and charged. Present once a payment method is chosen.
Fields of presentment_details
FieldTypeDescription
presentment_amount requiredinteger (int64)The amount charged, in the smallest currency unit: amount rounded up to the method's rounding_increment, and at least its minimum_amount.
presentment_currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
markup_bearer optionalstringWho pays the conversion markup. Present only with automatic conversion. One of payer, merchant.
merchant_order_id requiredstringYour ID for the order.
status requiredstringThe status of the payment intent. succeeded moves on to channel_settled, or to failed when the payment is reversed: the chain took back a crypto transfer, or the payment channel never paid a payment that succeeded. A reversal takes the amount back from your balance and emits payment_intent.failed and payment_intent.reversed. One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled.
payment_method optionalstringThe payment method code, once one is chosen.
fee optionalMoneyThe whole fee for the payment, in the payment currency, once a payment method is chosen. It includes the cost of the payment channel.
Fields of fee
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
fx optionalFxLockThe exchange rate locked for this payment.
Fields of fx
FieldTypeDescription
locked requiredbooleanWhether a rate is locked.
lock_point optionalstringWhen the rate is locked: when the payment intent is created, or when it is paid. A crypto payment locks when the channel settles it. A payment intent with automatic conversion is always on_create. One of on_create, on_paid, on_channel_settled.
rate optionalstringThe applied rate, as a decimal string: units of the payment currency for one unit of quote_currency, markup included.
quote_currency optionalstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
locked_at optionalstring (date-time)The time the rate was locked.
net optionalMoneyThe amount you receive, in the settlement currency.
Fields of net
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
available_at optionalstring (date-time)The time the funds become available in your balance.
next_action optionalNextActionWhat the payer must do to complete the payment.
Fields of next_action
FieldTypeDescription
type requiredstringHow to present the payment: redirect sends the payer to url, qr_code shows qr_data as a QR code, and crypto_address shows a deposit address. One of redirect, qr_code, crypto_address.
url optionalstring (uri)The URL to send the payer to. For crypto_address, the wallet payment URI.
qr_data optionalstringThe data to show as a QR code. For crypto_address, the wallet payment URI.
address optionalstringThe deposit address of a crypto_address action. Show it as text next to the QR code.
crypto optionalCryptoFinalityWhether a crypto payment is final. Present only on crypto payment intents. On a layer 2 network, a payment succeeds when the transfer is seen and becomes final when its batch is confirmed on layer 1. Until then the chain can reverse it: the payment intent moves to failed, and you receive the events payment_intent.failed and payment_intent.reversed. When the payment becomes final, you receive payment_intent.finalized once. For a high-value order, wait for this event before you deliver.
Fields of crypto
FieldTypeDescription
final requiredbooleanWhether the chain can no longer reverse the payment.
final_at optionalstring (date-time)The time the payment became final.
invoice optionalPaymentIntentInvoiceThe invoice issued with the payment intent. Its hosted page shows the amount due, the due date and a pay button while the payment intent is open, and the outcome after. The page prints to an A4 PDF from the browser.
Fields of invoice
FieldTypeDescription
number requiredstringThe invoice number, sequential per account and mode, for example 3F9A1C07-0042. A sandbox number starts with TEST-.
hosted_invoice_url requiredstring (uri)The URL of the hosted invoice page. Share it with the payer.
receipt optionalPaymentIntentReceiptThe receipt issued when the payment intent succeeds. Present from succeeded on.
Fields of receipt
FieldTypeDescription
number requiredstringThe receipt number, sequential per account and mode, for example 3F9A1C07-R0042. A sandbox number starts with TEST-.
receipt_url requiredstring (uri)The URL of the hosted receipt page.
checkout_url optionalstring (uri)The URL of the hosted checkout page. It is returned only in the response that creates the payment intent.
created requiredstring (date-time)The time the payment intent was created.
expires_at optionalstring (date-time)The time the payment intent expires if it is not paid.
metadata optionalobjectKey-value pairs of strings stored on the payment intent. A map of string keys to string values.

Errors

Every error answers with the error object.

StatusWhen
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl -X POST https://api.lemak.cash/v1/payment_intents/pi_123/cancel \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Api-Version: 2026-12-01"

Create a payment attempt

POST /v1/payment_intents/{id}/attempts

Places the order for this payment intent with a payment channel and returns the attempt, with the next_action the payer must complete. If the payment intent already has an order in progress, the request returns its latest attempt and places no new order.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
id requiredpathstringThe ID of the payment intent. Pattern ^pi_[0-9A-Za-z]+$.
Idempotency-Key requiredheaderstringA unique key you generate for this request, up to 255 characters. A retry with the same key and body returns the original response. Without it, the request returns 400 idempotency_key_required. At most 255 characters.
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

Request body

application/json

object

FieldTypeDescription
payment_method requiredstringThe payment method code. Required if the payment intent has no order yet. Without it, the request returns 400 payment_method_required.

Responses

201

Returns the payment attempt.

application/json

PaymentAttempt

An attempt to pay a payment intent through a payment channel. A payment intent has at most one pending attempt. Failed attempts are kept.

FieldTypeDescription
id requiredstringUnique identifier for the attempt. Pattern ^pa_[A-Z2-7]+$.
object requiredpayment_attempt
status requiredstringThe status of the attempt. One of pending, succeeded, failed.
amount requiredinteger (int64)The amount in the smallest currency unit.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payment_method optionalstringThe payment method code.
next_action optionalNextActionWhat the payer must do to complete the payment.
Fields of next_action
FieldTypeDescription
type requiredstringHow to present the payment: redirect sends the payer to url, qr_code shows qr_data as a QR code, and crypto_address shows a deposit address. One of redirect, qr_code, crypto_address.
url optionalstring (uri)The URL to send the payer to. For crypto_address, the wallet payment URI.
qr_data optionalstringThe data to show as a QR code. For crypto_address, the wallet payment URI.
address optionalstringThe deposit address of a crypto_address action. Show it as text next to the QR code.
failure_code optionalstringWhy the attempt failed, such as insufficient_funds.
failure_message optionalstringA readable explanation of the failure.
succeeded_at optionalstring (date-time)The time the attempt succeeded.
created requiredstring (date-time)The time the attempt was created.

Errors

Every error answers with the error object.

StatusWhen
402payment_blocked: risk rules declined the payment, in production mode only. The payment intent is failed, no channel order is placed, and you receive payment_intent.failed.
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl -X POST https://api.lemak.cash/v1/payment_intents/pi_123/attempts \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Api-Version: 2026-12-01" \
  -H "Content-Type: application/json" \
  -d '{
  "payment_method": "<payment_method>"
}'

List payment attempts

GET /v1/payment_intents/{id}/attempts

Returns every attempt on a payment intent, oldest first. Failed attempts are included.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
id requiredpathstringThe ID of the payment intent. Pattern ^pi_[0-9A-Za-z]+$.
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

Responses

200

A list of payment attempts.

application/json

PaymentAttemptList

FieldTypeDescription
object requiredlist
has_more requiredbooleanWhether more objects exist after this page.
data requiredarray of PaymentAttempt
Fields of data
FieldTypeDescription
id requiredstringUnique identifier for the attempt. Pattern ^pa_[A-Z2-7]+$.
object requiredpayment_attempt
status requiredstringThe status of the attempt. One of pending, succeeded, failed.
amount requiredinteger (int64)The amount in the smallest currency unit.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payment_method optionalstringThe payment method code.
next_action optionalNextActionWhat the payer must do to complete the payment.
Fields of next_action
FieldTypeDescription
type requiredstringHow to present the payment: redirect sends the payer to url, qr_code shows qr_data as a QR code, and crypto_address shows a deposit address. One of redirect, qr_code, crypto_address.
url optionalstring (uri)The URL to send the payer to. For crypto_address, the wallet payment URI.
qr_data optionalstringThe data to show as a QR code. For crypto_address, the wallet payment URI.
address optionalstringThe deposit address of a crypto_address action. Show it as text next to the QR code.
failure_code optionalstringWhy the attempt failed, such as insufficient_funds.
failure_message optionalstringA readable explanation of the failure.
succeeded_at optionalstring (date-time)The time the attempt succeeded.
created requiredstring (date-time)The time the attempt was created.

Errors

Every error answers with the error object.

StatusWhen
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl https://api.lemak.cash/v1/payment_intents/pi_123/attempts \
  -H "Authorization: Bearer sk_test_..." \
  -H "Api-Version: 2026-12-01"

Simulate a channel outcome

POST /v1/test/payment_intents/{id}/simulate

Test mode only. Makes the payment channel report an outcome for this payment intent, and processes the resulting notification as it would be processed in production. A production key returns 400 test_mode_required, and a channel that cannot simulate outcomes returns 400 simulation_unsupported. A payment intent with no pending attempt returns 409 no_pending_attempt: start one with POST /v1/payment_intents/{id}/attempts and a payment_method, or pick a method on the hosted page, first. Reusing an Idempotency-Key on another payment intent returns 422 idempotency_key_reused.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
id requiredpathstringThe ID of the payment intent. Pattern ^pi_[0-9A-Za-z]+$.
Idempotency-Key requiredheaderstringA unique key you generate for this request, up to 255 characters. A retry with the same key and body returns the original response. Without it, the request returns 400 idempotency_key_required. At most 255 characters.
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

Request body

application/json

PaymentIntentSimulate

FieldTypeDescription
outcome requiredstringThe outcome to simulate. succeeded, failed and pending are payment outcomes, and they replace any outcome a test amount set. dispute_opened opens a dispute for the full amount of a paid payment intent, and dispute_won or dispute_lost decides that dispute. One of succeeded, failed, pending, dispute_opened, dispute_won, dispute_lost.
failure_code optionalstringThe decline reason for a failed outcome. It becomes the attempt's failure_code. Allowed only with the outcome failed. One of insufficient_funds, payer_cancelled, risk_blocked.
amount optionalinteger (int64)The amount the channel reports, in the smallest currency unit. Defaults to the payment intent amount. Send a different value to test a payment whose amount does not match.
currency optionalstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.

Responses

200

Returns the payment intent after the simulated notification is processed.

application/json

PaymentIntent

A payment intent tracks one payment from creation to settlement.

FieldTypeDescription
id requiredstringUnique identifier for the payment intent.
object requiredpayment_intent
mode requiredstringlive for production, test for test mode. One of live, test.
amount requiredinteger (int64)The amount to collect, in the smallest currency unit. With automatic conversion, the price you set, and the payer pays payment_amount.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payment_amount optionalMoneyWhat the payer pays. Present only with automatic conversion. The fee is charged on this amount.
Fields of payment_amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
presentment_details optionalPresentmentDetailsWhat the payer is shown and charged. Present once a payment method is chosen.
Fields of presentment_details
FieldTypeDescription
presentment_amount requiredinteger (int64)The amount charged, in the smallest currency unit: amount rounded up to the method's rounding_increment, and at least its minimum_amount.
presentment_currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
markup_bearer optionalstringWho pays the conversion markup. Present only with automatic conversion. One of payer, merchant.
merchant_order_id requiredstringYour ID for the order.
status requiredstringThe status of the payment intent. succeeded moves on to channel_settled, or to failed when the payment is reversed: the chain took back a crypto transfer, or the payment channel never paid a payment that succeeded. A reversal takes the amount back from your balance and emits payment_intent.failed and payment_intent.reversed. One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled.
payment_method optionalstringThe payment method code, once one is chosen.
fee optionalMoneyThe whole fee for the payment, in the payment currency, once a payment method is chosen. It includes the cost of the payment channel.
Fields of fee
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
fx optionalFxLockThe exchange rate locked for this payment.
Fields of fx
FieldTypeDescription
locked requiredbooleanWhether a rate is locked.
lock_point optionalstringWhen the rate is locked: when the payment intent is created, or when it is paid. A crypto payment locks when the channel settles it. A payment intent with automatic conversion is always on_create. One of on_create, on_paid, on_channel_settled.
rate optionalstringThe applied rate, as a decimal string: units of the payment currency for one unit of quote_currency, markup included.
quote_currency optionalstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
locked_at optionalstring (date-time)The time the rate was locked.
net optionalMoneyThe amount you receive, in the settlement currency.
Fields of net
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
available_at optionalstring (date-time)The time the funds become available in your balance.
next_action optionalNextActionWhat the payer must do to complete the payment.
Fields of next_action
FieldTypeDescription
type requiredstringHow to present the payment: redirect sends the payer to url, qr_code shows qr_data as a QR code, and crypto_address shows a deposit address. One of redirect, qr_code, crypto_address.
url optionalstring (uri)The URL to send the payer to. For crypto_address, the wallet payment URI.
qr_data optionalstringThe data to show as a QR code. For crypto_address, the wallet payment URI.
address optionalstringThe deposit address of a crypto_address action. Show it as text next to the QR code.
crypto optionalCryptoFinalityWhether a crypto payment is final. Present only on crypto payment intents. On a layer 2 network, a payment succeeds when the transfer is seen and becomes final when its batch is confirmed on layer 1. Until then the chain can reverse it: the payment intent moves to failed, and you receive the events payment_intent.failed and payment_intent.reversed. When the payment becomes final, you receive payment_intent.finalized once. For a high-value order, wait for this event before you deliver.
Fields of crypto
FieldTypeDescription
final requiredbooleanWhether the chain can no longer reverse the payment.
final_at optionalstring (date-time)The time the payment became final.
invoice optionalPaymentIntentInvoiceThe invoice issued with the payment intent. Its hosted page shows the amount due, the due date and a pay button while the payment intent is open, and the outcome after. The page prints to an A4 PDF from the browser.
Fields of invoice
FieldTypeDescription
number requiredstringThe invoice number, sequential per account and mode, for example 3F9A1C07-0042. A sandbox number starts with TEST-.
hosted_invoice_url requiredstring (uri)The URL of the hosted invoice page. Share it with the payer.
receipt optionalPaymentIntentReceiptThe receipt issued when the payment intent succeeds. Present from succeeded on.
Fields of receipt
FieldTypeDescription
number requiredstringThe receipt number, sequential per account and mode, for example 3F9A1C07-R0042. A sandbox number starts with TEST-.
receipt_url requiredstring (uri)The URL of the hosted receipt page.
checkout_url optionalstring (uri)The URL of the hosted checkout page. It is returned only in the response that creates the payment intent.
created requiredstring (date-time)The time the payment intent was created.
expires_at optionalstring (date-time)The time the payment intent expires if it is not paid.
metadata optionalobjectKey-value pairs of strings stored on the payment intent. A map of string keys to string values.

Errors

Every error answers with the error object.

StatusWhen
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl -X POST https://api.lemak.cash/v1/test/payment_intents/pi_123/simulate \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Api-Version: 2026-12-01" \
  -H "Content-Type: application/json" \
  -d '{
  "outcome": "succeeded"
}'

Advance a test timer

POST /v1/test/payment_intents/{id}/advance

Test mode only. Moves one timer of the payment intent to the current time: expiry sets expires_at and release sets available_at. The payment intent then expires, or its funds become available, shortly after, as in production. A production key returns 400 test_mode_required, and a timer that is not running, such as release before the payment intent succeeds, returns 409 invalid_state_transition.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
id requiredpathstringThe ID of the payment intent. Pattern ^pi_[0-9A-Za-z]+$.
Idempotency-Key requiredheaderstringA unique key you generate for this request, up to 255 characters. A retry with the same key and body returns the original response. Without it, the request returns 400 idempotency_key_required. At most 255 characters.
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

Request body

application/json

PaymentIntentAdvance

FieldTypeDescription
clock requiredstringThe timer to move. expiry moves expires_at and release moves available_at. One of expiry, release.

Responses

200

Returns the payment intent with the timer moved.

application/json

PaymentIntent

A payment intent tracks one payment from creation to settlement.

FieldTypeDescription
id requiredstringUnique identifier for the payment intent.
object requiredpayment_intent
mode requiredstringlive for production, test for test mode. One of live, test.
amount requiredinteger (int64)The amount to collect, in the smallest currency unit. With automatic conversion, the price you set, and the payer pays payment_amount.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payment_amount optionalMoneyWhat the payer pays. Present only with automatic conversion. The fee is charged on this amount.
Fields of payment_amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
presentment_details optionalPresentmentDetailsWhat the payer is shown and charged. Present once a payment method is chosen.
Fields of presentment_details
FieldTypeDescription
presentment_amount requiredinteger (int64)The amount charged, in the smallest currency unit: amount rounded up to the method's rounding_increment, and at least its minimum_amount.
presentment_currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
markup_bearer optionalstringWho pays the conversion markup. Present only with automatic conversion. One of payer, merchant.
merchant_order_id requiredstringYour ID for the order.
status requiredstringThe status of the payment intent. succeeded moves on to channel_settled, or to failed when the payment is reversed: the chain took back a crypto transfer, or the payment channel never paid a payment that succeeded. A reversal takes the amount back from your balance and emits payment_intent.failed and payment_intent.reversed. One of created, requires_payment, processing, succeeded, channel_settled, failed, expired, canceled.
payment_method optionalstringThe payment method code, once one is chosen.
fee optionalMoneyThe whole fee for the payment, in the payment currency, once a payment method is chosen. It includes the cost of the payment channel.
Fields of fee
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
fx optionalFxLockThe exchange rate locked for this payment.
Fields of fx
FieldTypeDescription
locked requiredbooleanWhether a rate is locked.
lock_point optionalstringWhen the rate is locked: when the payment intent is created, or when it is paid. A crypto payment locks when the channel settles it. A payment intent with automatic conversion is always on_create. One of on_create, on_paid, on_channel_settled.
rate optionalstringThe applied rate, as a decimal string: units of the payment currency for one unit of quote_currency, markup included.
quote_currency optionalstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
locked_at optionalstring (date-time)The time the rate was locked.
net optionalMoneyThe amount you receive, in the settlement currency.
Fields of net
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
available_at optionalstring (date-time)The time the funds become available in your balance.
next_action optionalNextActionWhat the payer must do to complete the payment.
Fields of next_action
FieldTypeDescription
type requiredstringHow to present the payment: redirect sends the payer to url, qr_code shows qr_data as a QR code, and crypto_address shows a deposit address. One of redirect, qr_code, crypto_address.
url optionalstring (uri)The URL to send the payer to. For crypto_address, the wallet payment URI.
qr_data optionalstringThe data to show as a QR code. For crypto_address, the wallet payment URI.
address optionalstringThe deposit address of a crypto_address action. Show it as text next to the QR code.
crypto optionalCryptoFinalityWhether a crypto payment is final. Present only on crypto payment intents. On a layer 2 network, a payment succeeds when the transfer is seen and becomes final when its batch is confirmed on layer 1. Until then the chain can reverse it: the payment intent moves to failed, and you receive the events payment_intent.failed and payment_intent.reversed. When the payment becomes final, you receive payment_intent.finalized once. For a high-value order, wait for this event before you deliver.
Fields of crypto
FieldTypeDescription
final requiredbooleanWhether the chain can no longer reverse the payment.
final_at optionalstring (date-time)The time the payment became final.
invoice optionalPaymentIntentInvoiceThe invoice issued with the payment intent. Its hosted page shows the amount due, the due date and a pay button while the payment intent is open, and the outcome after. The page prints to an A4 PDF from the browser.
Fields of invoice
FieldTypeDescription
number requiredstringThe invoice number, sequential per account and mode, for example 3F9A1C07-0042. A sandbox number starts with TEST-.
hosted_invoice_url requiredstring (uri)The URL of the hosted invoice page. Share it with the payer.
receipt optionalPaymentIntentReceiptThe receipt issued when the payment intent succeeds. Present from succeeded on.
Fields of receipt
FieldTypeDescription
number requiredstringThe receipt number, sequential per account and mode, for example 3F9A1C07-R0042. A sandbox number starts with TEST-.
receipt_url requiredstring (uri)The URL of the hosted receipt page.
checkout_url optionalstring (uri)The URL of the hosted checkout page. It is returned only in the response that creates the payment intent.
created requiredstring (date-time)The time the payment intent was created.
expires_at optionalstring (date-time)The time the payment intent expires if it is not paid.
metadata optionalobjectKey-value pairs of strings stored on the payment intent. A map of string keys to string values.

Errors

Every error answers with the error object.

StatusWhen
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl -X POST https://api.lemak.cash/v1/test/payment_intents/pi_123/advance \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Api-Version: 2026-12-01" \
  -H "Content-Type: application/json" \
  -d '{
  "clock": "expiry"
}'