Malaleem API
POST /api/v1/checkout/:id/refund

Refund a checkout session

Refund all or part of a paid session. Send an `Idempotency-Key` header: retrying with the same key returns the first refund instead of refunding twice. Answers 201 with `{data: {id, session_id, amount, currency, status, provider_ref}}` where status is succeeded, pending (the provider is still processing) or failed (the provider refused; nothing was refunded). Errors: 404 not_found, 409 not_refundable (session not paid) / over_refund / idempotency_key_reused, 422 invalid_amount, 501 refund_unsupported (a live payment whose provider cannot refund through its API). Sends a `payment.refunded` webhook.

Parameters

amount integer

Minor units to refund. Defaults to everything not yet refunded.

reason string

Why — passed to the provider where it accepts one.

curl https://malaleem.com/api/v1/checkout/{id}/refund \
  -H "Authorization: Bearer {key_id}:{secret}" \
  -H "Idempotency-Key: refund-1042-1" \
  -H "Content-Type: application/json" \
  -d '{"amount":1500,"reason":"Returned item"}'