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:
| Product | Why it is required |
|---|---|
| Payments | Identifies the original customer payment. |
| Reconciliation | Confirms that the original payment was received and is eligible for a refund. |
| Payouts | Sends 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 happens | Result |
|---|---|---|
| 1 | The original payment is reconciled. | Eligible for refund. AED 100.00 refundable. |
| 2 | You create a refund of 30.00 with reason_code: ORDER_CANCELLED. | Refund CREATED. |
| 3 | An approver in your team approves it. | Refund APPROVED. |
| 4 | Lean sends AED 30.00 to the customer's original account. | Webhook reports the transaction PROCESSED. |
| 5 | Later, 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
| Operation | Endpoint |
|---|---|
| Retrieve available reasons | GET /payouts/refunds/reasons |
| Create a refund | POST /payouts/refunds |
| Approve or reject a refund | PUT /payouts/refunds |
| List refunds | GET /payouts/refunds |
These refund endpoints have no version segment in the path. Use the paths exactly as shown.
Use the Lean Dashboard
- Open the original payment in the Lean Dashboard.
- Confirm that it has been reconciled.
- Select the refund action.
- Enter the amount, reason and your reference.
- Submit the refund and complete your approval step.
- 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| Field | Purpose |
|---|---|
payment_id | The original payment being refunded. Required. |
amount | The amount to return. Required. |
currency | The three-letter ISO currency code of the refund. |
reason_code | A reason from the reasons endpoint. Required. |
description | Notes about the refund, such as an order reference. |
external_reference | Your own reference for the refund. |
status | CREATED (default) to hold the refund for approval, or APPROVED to create it already approved. |
Creating a refund as approvedSending
status: APPROVEDskips 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| Field | Purpose |
|---|---|
refund_id | The refund being decided. |
status | APPROVED 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 status | What it means |
|---|---|
CREATED | The refund transaction has been created. Check sub_status for more detail. |
PROCESSING | Processing is under way. |
PROCESSED | The refund transaction is reported as completed. |
FAILED | Processing 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.
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.
7. Handle failures and delays
| Issue | What to do |
|---|---|
| The original payment is not reconciled | Wait for reconciliation before creating the refund. |
| The amount exceeds what remains refundable | Review completed and outstanding refunds against the original payment. |
| The reason is missing or invalid | Retrieve the available reasons and correct the request. |
| The refund is awaiting approval | Complete your approval step. |
| The refund stays in progress | Check webhook and API updates before taking further action. |
| Processing fails | Review failure_details and resolve the cause before deciding whether to create another refund. |
| Webhooks are missing | Check 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.
Next steps
Updated about 2 hours ago
