Refunds

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

Create a refund

POST /v1/refunds

Refunds all or part of a succeeded payment intent to the payer. The amount is in the currency the payer paid in, and without amount the whole amount that is left is refunded. Your balance is debited at once, in your settlement currency, at the exchange rate the payment locked, together with the refund fee of the payment channel. The fee of the payment itself is not returned. A refund starts pending and becomes succeeded when the payment channel confirms it. If the channel declines it, it becomes failed and the debit is returned to your balance. A payment channel that does not take refunds returns 409 refund_not_allowed. A payment that has a dispute returns 409 payment_disputed, and a payment that has not succeeded returns 409 payment_not_refundable. An amount larger than what is left returns 400 amount_exceeds_refundable.

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

RefundCreate

FieldTypeDescription
payment_intent requiredstringThe ID of the payment intent to refund.
amount optionalinteger (int64)The amount to refund, in the smallest unit of the currency the payer paid in. When omitted, the whole amount that is left is refunded. Minimum 1.
reason optionalstringWhy you refund the payment. One of duplicate, fraudulent, requested_by_customer.
metadata optionalobjectKey-value pairs of strings to store on the refund. A map of string keys to string values.

Responses

201

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

application/json

Refund

FieldTypeDescription
id requiredstringUnique identifier for the refund.
object requiredrefund
payment_intent requiredstringThe ID of the refunded payment intent.
amount requiredMoneyThe amount refunded to the payer, in the currency the payer paid in.
Fields of 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}$.
fee requiredMoneyThe refund fee of the payment channel, in your settlement currency. It is debited from your balance with the refund.
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}$.
status requiredstringThe status of the refund. pending waits for the payment channel to confirm it, and succeeded and failed are final. One of pending, succeeded, failed.
reason optionalstringWhy you refund the payment. One of duplicate, fraudulent, requested_by_customer.
failure_code optionalstringWhy the refund failed. Present on a failed refund alone.
metadata requiredobjectThe key-value pairs stored on the refund. A map of string keys to string values.
created_at requiredstring (date-time)The time the refund 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 -X POST https://api.lemak.cash/v1/refunds \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Api-Version: 2026-12-01" \
  -H "Content-Type: application/json" \
  -d '{
  "payment_intent": "<payment_intent>"
}'

List refunds

GET /v1/refunds

Returns a list of refunds, 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.
payment_intent optionalquerystringOnly return refunds of this payment intent. Pattern ^pi_[0-9A-Za-z]+$.
status optionalquerystringOnly return refunds with this status. One of pending, succeeded, failed.

Responses

200

A list of refunds.

application/json

RefundList

FieldTypeDescription
object requiredlist
data requiredarray of Refund
Fields of data
FieldTypeDescription
id requiredstringUnique identifier for the refund.
object requiredrefund
payment_intent requiredstringThe ID of the refunded payment intent.
amount requiredMoneyThe amount refunded to the payer, in the currency the payer paid in.
Fields of 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}$.
fee requiredMoneyThe refund fee of the payment channel, in your settlement currency. It is debited from your balance with the refund.
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}$.
status requiredstringThe status of the refund. pending waits for the payment channel to confirm it, and succeeded and failed are final. One of pending, succeeded, failed.
reason optionalstringWhy you refund the payment. One of duplicate, fraudulent, requested_by_customer.
failure_code optionalstringWhy the refund failed. Present on a failed refund alone.
metadata requiredobjectThe key-value pairs stored on the refund. A map of string keys to string values.
created_at requiredstring (date-time)The time the refund was created.
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/refunds \
  -H "Authorization: Bearer sk_test_..." \
  -H "Api-Version: 2026-12-01"

Retrieve a refund

GET /v1/refunds/{id}

Retrieves a refund 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 refund. Pattern ^re_[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 refund.

application/json

Refund

FieldTypeDescription
id requiredstringUnique identifier for the refund.
object requiredrefund
payment_intent requiredstringThe ID of the refunded payment intent.
amount requiredMoneyThe amount refunded to the payer, in the currency the payer paid in.
Fields of 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}$.
fee requiredMoneyThe refund fee of the payment channel, in your settlement currency. It is debited from your balance with the refund.
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}$.
status requiredstringThe status of the refund. pending waits for the payment channel to confirm it, and succeeded and failed are final. One of pending, succeeded, failed.
reason optionalstringWhy you refund the payment. One of duplicate, fraudulent, requested_by_customer.
failure_code optionalstringWhy the refund failed. Present on a failed refund alone.
metadata requiredobjectThe key-value pairs stored on the refund. A map of string keys to string values.
created_at requiredstring (date-time)The time the refund 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/refunds/re_123 \
  -H "Authorization: Bearer sk_test_..." \
  -H "Api-Version: 2026-12-01"