Issue and manage Refunds

Return all or part of a reconciled payment to the customer's original bank account.

Refunds use Payouts to send the funds from your connected business bank account. Each refund references the original payment, so you don't choose a beneficiary. The money always goes back to the account the payment came from.

Before you start

Your application needs:

ProductWhy it is required
PaymentsIdentifies the original customer payment.
ReconciliationConfirms that the original payment was received and is eligible for a refund.
PayoutsSends the funds back through your direct connection.

You also need:

  • A live direct connection for Payouts. See Set up payouts.
  • Refunds enabled for your application by Lean.
  • An agreed approval process for refunds in your team.
  • For API integrations, an API-scoped access token and refund webhooks enabled.

Example: a partial refund

A customer paid AED 100.00 for an order. You refund AED 30.00 for one cancelled item.

#What happensResult
1The original payment is reconciled.Eligible for refund. AED 100.00 refundable.
2You create a refund of 30.00 with reason_code: ORDER_CANCELLED.Refund CREATED.
3An approver in your team approves it.Refund APPROVED.
4Lean sends AED 30.00 to the customer's original account.Webhook reports the transaction PROCESSED.
5Later, you refund the remaining amount.At most AED 70.00 can be refunded.

1. Check refund eligibility

Before creating a refund, confirm that:

  • The original payment has been reconciled.
  • You have the original payment_id.
  • The amount does not exceed what remains refundable on that payment.
  • No other refund for the same payment is already awaiting approval or in progress, unless you intend to create another one.

Full and partial refunds

A full refund returns the whole original amount. A partial refund returns less. You can make more than one partial refund against the same payment.

The total refunded against a payment cannot exceed its original amount. In the example above, a payment of AED 100.00 with a completed refund of AED 30.00 has at most AED 70.00 left to refund.

To send money to a different account, create a payout instead.

2. Choose how to create the refund

You can create refunds through the API or in the Lean Dashboard.

Use the API

OperationEndpoint
Retrieve available reasonsGET /payouts/refunds/reasons
Create a refundPOST /payouts/refunds
Approve or reject a refundPUT /payouts/refunds
List refundsGET /payouts/refunds

These refund endpoints have no version segment in the path. Use the paths exactly as shown.

Use the Lean Dashboard

  1. Open the original payment in the Lean Dashboard.
  2. Confirm that it has been reconciled.
  3. Select the refund action.
  4. Enter the amount, reason and your reference.
  5. Submit the refund and complete your approval step.
  6. Track its progress in the Dashboard.

Submitting or approving a refund does not confirm that the funds have reached the customer.

3. Retrieve the refund reasons

curl --request GET \
  --url 'https://sandbox.leantech.me/payouts/refunds/reasons' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>'

The reasons currently available are CUSTOMER_REQUEST, ORDER_CANCELLED, DUPLICATED_PAYMENT and FRAUDULENT_PAYMENT. Retrieve the list from the endpoint rather than hard-coding it, and send the selected value as reason_code.

Get Refund Reasons API reference →

4. Create the refund

POST https://sandbox.leantech.me/payouts/refunds
Authorization: Bearer <ACCESS_TOKEN>
Content-Type: application/json
FieldPurpose
payment_idThe original payment being refunded. Required.
amountThe amount to return. Required.
currencyThe three-letter ISO currency code of the refund.
reason_codeA reason from the reasons endpoint. Required.
descriptionNotes about the refund, such as an order reference.
external_referenceYour own reference for the refund.
statusCREATED (default) to hold the refund for approval, or APPROVED to create it already approved.
🚧

Creating a refund as approved

Sending status: APPROVED skips the separate approval step. Use it only if your own system already enforces the approval you need, for example a second person approving the refund before your backend calls Lean.

Store the returned refund_id with the original payment_id and your own reference. Keep a separate record for each partial refund.

A 201 response confirms that the refund was created, not that the money has been sent.

Create Refunds API reference →

Handle uncertain submissions

Refund requests are not protected by an idempotency key, and external_reference does not prevent duplicates. If a request times out, the refund may still have been created.

Before you retry, check the refunds you already have for that payment. List Refunds filters by status only, so keep your own record of every refund request, including ones that timed out, and match on payment_id, amount and external_reference in the list results.

5. Approve or reject the refund

A refund created with status: CREATED waits for a decision. Record the decision with Process Refunds:

PUT https://sandbox.leantech.me/payouts/refunds
Authorization: Bearer <ACCESS_TOKEN>
Content-Type: application/json
FieldPurpose
refund_idThe refund being decided.
statusAPPROVED to proceed, or REJECTED to stop the refund.

Approval lets the refund proceed. Rejection records a decision not to send the money, which is different from a transfer that fails during processing.

Limit approval to the right people in your team. Before approving, check the original payment, the amount, the reason and any other refunds against the same payment.

Process Refunds API reference →

6. Track refund progress

Track each refund separately from the original payment. Keep the customer's refund pending until the transaction is reported as PROCESSED.

Receive webhook updates

Refund transaction updates use the transaction.account webhook. Configure the subscription in the Lean Dashboard under Development → Webhooks, and check that delivery is enabled for your application.

Transaction statusWhat it means
CREATEDThe refund transaction has been created. Check sub_status for more detail.
PROCESSINGProcessing is under way.
PROCESSEDThe refund transaction is reported as completed.
FAILEDProcessing failed. Check failure_details.

Verify the signature of every webhook and handle duplicates. A repeated notification must not create another refund or update the customer's balance twice.

Set up webhooks →

Retrieve refunds through the API

curl --request GET \
  --url 'https://sandbox.leantech.me/payouts/refunds?page=0&size=50' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>'

You can filter by refund status: CREATED, APPROVED, REJECTED, PENDING_WITH_BANK, ACCEPTED_BY_BANK or FAILED. Retrieve every page when checking existing refunds.

These refund statuses are not the same as the webhook's transaction statuses. Read each field according to the API or webhook that returned it. ACCEPTED_BY_BANK on its own does not confirm that the customer has received the money.

List Refunds API reference →

7. Handle failures and delays

IssueWhat to do
The original payment is not reconciledWait for reconciliation before creating the refund.
The amount exceeds what remains refundableReview completed and outstanding refunds against the original payment.
The reason is missing or invalidRetrieve the available reasons and correct the request.
The refund is awaiting approvalComplete your approval step.
The refund stays in progressCheck webhook and API updates before taking further action.
Processing failsReview failure_details and resolve the cause before deciding whether to create another refund.
Webhooks are missingCheck the subscription and that delivery is enabled. Use the Dashboard resend action where available, and retrieve refunds through the API.

For unresolved outcomes, contact Lean Support with the original payment ID, refund ID, environment and request time.

Test your integration

In Sandbox, test:

  • A full refund.
  • A partial refund, then a second refund against the same payment.
  • Approval and rejection.
  • An ineligible payment and an amount above what remains refundable.
  • A timeout during submission.
  • Repeated and missed webhooks.

Where Sandbox has no trigger for a scenario, simulate it in your own test environment.

Test your integration →

Next steps


Did this page help you?