Send and manage Payouts
Send money from your connected business bank account to a beneficiary, then track the payout through authorisation and processing.
Payouts are asynchronous. A successful API response confirms that Lean accepted the request. It does not confirm that the beneficiary received the funds.
Before you start
Complete Set up payouts and make sure you have:
- A live direct connection and the source account's
account_id. - The authorisation options agreed for your application.
- An API-scoped access token.
- Webhook subscriptions for beneficiary and payment updates.
The payout lifecycle
| Step | You do | You receive |
|---|---|---|
| POST /payouts/v1/payment/destinations | The destination ID, then payment_source.beneficiary.created |
| POST /payouts/v1/payment | The payment identifiers |
| Automatic, or approve in the Lean Dashboard | payment.created, then payment.updated |
| Handle webhooks | payment.updated with post_initiation_status |
Example: one payout with manual authorisation
A customer withdraws AED 100.00 from your platform to their own bank account.
| # | What happens | Status your application sees |
|---|---|---|
| 1 | You create a Payout Destination for the customer's account. | payment_source.beneficiary.created, beneficiary ACTIVE |
| 2 | You submit a payout of 100.00 with authorize_payment: false. | payment.created, status: AWAITING_AUTHORIZATION |
| 3 | A member of your team approves the payout in the Lean Dashboard. Lean submits it to your bank. | payment.updated, status: ACCEPTED_BY_BANK or PENDING_WITH_BANK |
| 4 | The bank completes the transfer. | payment.updated, post_initiation_status: PROCESSED |
| 5 | You mark the withdrawal complete in your own records, once. |
If step 3 returns FAILED, or step 4 returns REJECTED, the payout has failed. See Handle failures.
1. Create a Payout Destination
A Payout Destination identifies the beneficiary account that receives the funds. Creating it also registers the beneficiary for your connected source account.
POST https://sandbox.leantech.me/payouts/v1/payment/destinations
Authorization: Bearer <ACCESS_TOKEN>
Content-Type: application/jsonProvide the beneficiary's account and recipient details as described in the API reference.
Store the destination ID. You can reuse it for later payouts to the same beneficiary, so you don't need to submit the account details again.
Create Payout Destination API reference →
Check the beneficiary is active
With a direct connection there is no beneficiary cooling-off period. The beneficiary is normally ACTIVE when the payment_source.beneficiary.created webhook arrives.
Check that the status is ACTIVE before you submit a payout to that destination. If it is not, wait for payment_source.beneficiary.updated.
You can also retrieve the destination:
curl --request GET \
--url 'https://sandbox.leantech.me/payouts/v1/payment/destinations/<DESTINATION_ID>' \
--header 'Authorization: Bearer <ACCESS_TOKEN>'Get Payout Destination API reference →
2. Submit a payout
Submit the source account, destination, amount and authorisation choice:
curl --request POST \
--url 'https://sandbox.leantech.me/payouts/v1/payment' \
--header 'Authorization: Bearer <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--header 'idempotency-key: <UNIQUE_REQUEST_KEY>' \
--data '{
"payment_details": [
{
"account_id": "<SOURCE_ACCOUNT_ID>",
"destination_details": [
{
"payment_destination_id": "<DESTINATION_ID>",
"amount": 100.00,
"description": "Customer withdrawal",
"authorize_payment": false
}
]
}
]
}'| Field | Purpose |
|---|---|
account_id | The connected source account that funds the payout. |
payment_destination_id | The Payout Destination that receives the funds. |
amount | The amount to send. |
description | The payment reference. Maximum 32 characters. |
authorize_payment | true for automatic authorisation, false for manual authorisation in the Lean Dashboard. Defaults to false. |
The response includes a payment_intent_id for each payout and a payment_id that may be null at this point. Store the payment_intent_id against your own transaction, and add the payment_id when it is available.
Protect retries with idempotency
Send an idempotency-key header of 50 characters or fewer with every request.
- Use a new key for each new payout.
- When you retry the same request, send the same key and the same body.
- If a request times out, check whether the payout was created before you submit it again with a new key. A missing response does not mean the request failed.
3. Authorise the payout
Every payout is authorised in Lean before Lean submits it to your bank. Two options are available, and you choose one for each payout with authorize_payment.
| Option | Request setting | What happens next |
|---|---|---|
| Automatic authorisation | authorize_payment: true | Lean authorises the payout and submits it to your bank straight away. The first webhook shows the bank's response. |
| Manual authorisation in the Lean Dashboard | authorize_payment: false | The payout waits with status AWAITING_AUTHORIZATION until a permitted Dashboard user approves it. Lean then submits it to your bank. |
Because the choice is made per payout, you can combine both. For example, authorise transfers between your own accounts automatically and hold payouts to third parties for manual approval.
Payouts cannot be approved in your bank's portal. Approve them in the Lean Dashboard.
Limit manual approval to the team members who should approve payments. Before approving, check the beneficiary, amount and description.
4. Track the payout
Use payment.created and payment.updated to follow each payout. Read the status fields in the payload. The event name alone does not tell you whether the payout succeeded.
Initiation status
The status field shows where the payout is in authorisation and submission to the bank.
| Status | Meaning | What to do |
|---|---|---|
AWAITING_AUTHORIZATION | The payout is waiting for manual approval. | Approve it in the Lean Dashboard. |
PENDING_WITH_BANK | The payout has been submitted and is pending with the bank. | Wait for post_initiation_status. Do not create a replacement because it is still pending. |
ACCEPTED_BY_BANK | The bank has accepted the payout. | Wait for post_initiation_status. |
FAILED | Authorisation or submission failed. | Treat the payout as failed. Review the failure details before creating a new payout. |
Final outcome
post_initiation_status reports the final outcome after the payout has been submitted to the bank.
| Value | Meaning | What to do |
|---|---|---|
null | No final outcome yet. | Keep tracking. |
PROCESSED | The bank reports the payout as completed. | Treat the payout as successful. |
REJECTED | The bank rejected the payout after accepting it. | Treat the payout as failed. Create a new payout if you still need to pay the beneficiary. |
An update can contain status: ACCEPTED_BY_BANK and post_initiation_status: REJECTED. Check both fields, so that the bank's initial acceptance does not hide a later rejection.
Lean enables final-outcome updates for your application during setup. Confirm with Lean that they are enabled before you go live.
Processing time depends on your bank and the payment rail. Transfers submitted outside your bank's cut-off times, at weekends or on public holidays may complete on the next business day.
Process updates safely
- Match each event to your stored identifiers.
- Expect the same event more than once, and events out of order. Apply the duplicate-handling rules in the webhooks guide.
- Keep the payout outcome separate from the business action it triggers. For example, repeated notifications must not deduct a withdrawal from your customer's balance more than once.
5. Retrieve payouts and payment history
Use API lookups to investigate a payout or recover after missed webhooks.
List payouts
curl --request GET \
--url 'https://sandbox.leantech.me/payouts/v1/payments?page_number=0&page_size=50' \
--header 'Authorization: Bearer <ACCESS_TOKEN>'You can filter by amount, creation time and update time. Retrieve every page when checking a time window.
Retrieve payment history
curl --request GET \
--url 'https://sandbox.leantech.me/payouts/v1/payments/<PAYMENT_ID>/history' \
--header 'Authorization: Bearer <ACCESS_TOKEN>'The history shows each status change, so you can compare it with the updates your application processed.
Payment History API reference →
6. Handle failures and uncertain outcomes
| Issue | What to do |
|---|---|
The beneficiary is not ACTIVE | Wait for payment_source.beneficiary.updated or retrieve the destination. Do not submit the payout until it is active. |
| The request is rejected | Read the error response and correct the request or configuration. |
The payout is AWAITING_AUTHORIZATION | Approve it in the Lean Dashboard. |
The payout is FAILED | Review the failure details and resolve the cause. Create a new payout, with a new idempotency key, only if you still need to pay. |
post_initiation_status is REJECTED | Treat the payout as failed. Create a new payout only if you still need to pay. |
The payout stays PENDING_WITH_BANK | Keep tracking through webhooks and API lookups. Contact Lean Support if the outcome remains unresolved. |
| The submission times out | Check for an existing payout and follow the idempotency guidance before retrying. |
| A webhook is missed | Retrieve the payout and its history. You can also resend webhooks from the Lean Dashboard or recover event records through the Events API. |
When contacting Lean Support, include the environment, request time, payment_intent_id, payment_id and any correlation ID.
Test your integration
Before going live, test in Sandbox:
- Creating a Payout Destination and handling the beneficiary webhooks.
- Automatic authorisation and manual authorisation in the Dashboard.
- Processed and rejected final outcomes.
- Request timeouts and duplicate-submission protection.
- Repeated, delayed and missed webhooks.
Testing with your bank's UAT environment is a separate step that Lean runs with you during setup. Lean also makes two go-live test payouts on your production connection, with your approval.
Next steps
To return funds from an eligible reconciled payment to its original account, use the refund flow.
Updated about 2 hours ago
