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
| Name | In | Type | Description |
|---|---|---|---|
Idempotency-Key required | header | string | A 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 optional | header | string | The 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
| Field | Type | Description |
|---|---|---|
payment_intent required | string | The ID of the payment intent to refund. |
amount optional | integer (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 optional | string | Why you refund the payment. One of duplicate, fraudulent, requested_by_customer. |
metadata optional | object | Key-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
| Field | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
id required | string | Unique identifier for the refund. | |||||||||
object required | refund | ||||||||||
payment_intent required | string | The ID of the refunded payment intent. | |||||||||
amount required | Money | The amount refunded to the payer, in the currency the payer paid in.Fields of amount
| |||||||||
fee required | Money | The refund fee of the payment channel, in your settlement currency. It is debited from your balance with the refund.Fields of fee
| |||||||||
status required | string | The 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 optional | string | Why you refund the payment. One of duplicate, fraudulent, requested_by_customer. | |||||||||
failure_code optional | string | Why the refund failed. Present on a failed refund alone. | |||||||||
metadata required | object | The key-value pairs stored on the refund. A map of string keys to string values. | |||||||||
created_at required | string (date-time) | The time the refund was created. |
Errors
Every error answers with the error object.
| Status | When |
|---|---|
| Other | An 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
| Name | In | Type | Description |
|---|---|---|---|
Api-Version optional | header | string | The 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 optional | query | integer | The maximum number of objects to return, from 1 to 100. Minimum 1. Maximum 100. Default 20. |
starting_after optional | query | string | A pagination cursor. Pass the ID of the last object on the previous page to get the next page. |
payment_intent optional | query | string | Only return refunds of this payment intent. Pattern ^pi_[0-9A-Za-z]+$. |
status optional | query | string | Only return refunds with this status. One of pending, succeeded, failed. |
Responses
200
A list of refunds.
application/json
RefundList
| Field | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
object required | list | ||||||||||||||||||||||||||||||||||||||||||||||||||||
data required | array of Refund | Fields of data
| |||||||||||||||||||||||||||||||||||||||||||||||||||
has_more required | boolean | Whether more objects exist after this page. |
Errors
Every error answers with the error object.
| Status | When |
|---|---|
| Other | An 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
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | The ID of the refund. Pattern ^re_[0-9A-Za-z]+$. |
Api-Version optional | header | string | The 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
| Field | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
id required | string | Unique identifier for the refund. | |||||||||
object required | refund | ||||||||||
payment_intent required | string | The ID of the refunded payment intent. | |||||||||
amount required | Money | The amount refunded to the payer, in the currency the payer paid in.Fields of amount
| |||||||||
fee required | Money | The refund fee of the payment channel, in your settlement currency. It is debited from your balance with the refund.Fields of fee
| |||||||||
status required | string | The 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 optional | string | Why you refund the payment. One of duplicate, fraudulent, requested_by_customer. | |||||||||
failure_code optional | string | Why the refund failed. Present on a failed refund alone. | |||||||||
metadata required | object | The key-value pairs stored on the refund. A map of string keys to string values. | |||||||||
created_at required | string (date-time) | The time the refund was created. |
Errors
Every error answers with the error object.
| Status | When |
|---|---|
| Other | An 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"