---
updatedAt: 2026-07-27T15:26:42.000Z
agentTools:
  projectIndex: https://docs.truelayer.com/llms.txt
---

# Make a payout to an account that paid in

Learn about closed-loop payouts and how to make one.

<HTMLBlock>{`
<style>
   /* Style for the closed details element */
    details {
      border: 1px solid #1f1f25; /* 1px stroke around the edge */
      border-radius: 16px; /* 16px rounded corners */
      padding: 8px; /* Optional: Add padding for better visual appeal */
    }

/* Style for the summary within the details element */
    details summary {
      outline: none; /* Remove default focus outline */
    }

/* Style for the open details element */
    details[open] {
      border: 1px solid #1f1f25; /* 1px stroke around the edge */
      border-radius: 16px; /* 16px rounded corners */
      padding: 8px; /* Optional: Add padding for better visual appeal */
    }
  </style>
`}</HTMLBlock>

In a closed-loop payout, a payment is made to a user who has made a previous payment (known as a *closed-loop pay-in*) to your merchant account.

We identify the user who made the pay-in using two types of `id`:

* `payment_source_id`, which identifies a set of bank account details
* user `id`, which identifies a specific user.

These `id` values ensure that the payout is sent to the correct account, and that you don't need to collect additional user details.

<Image src="https://files.readme.io/ca0e3770ac4a229ae14646d3c708f1978170a87b7d9da20969e3087d6b6754d9-Closed-loop-pay-in-and-pay-out.svg" alt="After a closed-loop pay-in, you can can easily make multiple payouts to the same user, and also access other merchant account-related functionality. (light)" align="center" caption="After a closed-loop pay-in, you can easily make multiple payouts to the same user, and also access other merchant account-related functionality." />

<br />

<Image src="https://files.readme.io/43bddf7fb1dc41496342ec0284d5c3ea263d370fb81e8bd4a4ae34d3a2a2243d-Closed-loop-pay-in-and-pay-out_dark.svg" alt="closed-loop payouts (dark)" align="center" caption="After a closed-loop pay-in, you can easily make multiple payouts to the same user, and also access other merchant account-related functionality." />

Closed-loop payouts are useful if your customers need to top up and withdraw from an account frequently: for example, in gaming or investment apps.

## Closed-loop payout overview

To make a closed-loop payout successfully, there are three key steps:

1. [**Authentication**](https://docs.truelayer.com/truelayer/docs/make-a-payout-to-an-account-that-paid-in#1-authenticate-a-closed-loop-payout): Properly configure authentication before your request. Most of this is the same as the initial pay-in request.
2. [**Request configuration**](https://docs.truelayer.com/truelayer/docs/make-a-payout-to-an-account-that-paid-in#2-configure-a-closed-loop-payout): Provide information including the value of the payout, the merchant account that the payout is made from and the payment source that the payout is made to.<br />[See examples of a complete request.](https://docs.truelayer.com/truelayer/docs/make-a-payout-to-an-account-that-paid-in#example-closed-loop-payout-requests)
3. [**Monitoring**](https://docs.truelayer.com/truelayer/docs/make-a-payout-to-an-account-that-paid-in#3-monitor-a-closed-loop-payout): Set up webhooks for your payout so that you can track its progress and confirm its success.

## 1. Authenticate a closed-loop payout

Before you can make a closed-loop payout, you must secure your requests. Authentication has two parts:

* Generating an access token
* Signing your requests and including an idempotency key.

### 1.1 Generate an `access_token`

You must include an `access_token` with the `payments` scope in order to make a closed-loop payout. This should be included as a Bearer header along with your payout request.

### 1.2 Include headers for signing and idempotency

All requests to the Payments API v3, including payouts, should include a valid `Tl-Signature` header for security purposes. [Learn how to sign your requests](https://docs.truelayer.com/truelayer/docs/sign-your-payments-requests).

To help with payment signatures, try <a href="https://github.com/TrueLayer/truelayer-signing/tree/main" target="_blank">our signing libraries</a>.

It's also important that your requests include a valid `Idempotency-Key` header. This should be a unique key, and enables you to run your request multiple times without duplicating it.

## 2. Configure a closed-loop payout

After setting up your `access_token` and headers, you're ready to configure and create your closed-loop payout request.

To create a payout, send a POST request to the <a href="https://docs.truelayer.com/reference/create-payout" target="_blank">`/payouts` endpoint</a>. You must include information about the payment and the beneficiary in this request (see below for the exact details to include, and .

### 2.1 Request parameters

The table below contains an overview of all the parameters you need to specify to initiate a closed-loop payout.

<Table>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `merchant_account_id`
      </td>

      <td>
        The unique `id` of the merchant account to make the closed-loop payout from.
      </td>
    </tr>

    <tr>
      <td>
        `amount_in_minor`
      </td>

      <td>
        The value of the payout in a minor denomination.

        A minor denomination is the smallest unit of the specified currency, so 1 is equivalent to a penny or a cent.
      </td>
    </tr>

    <tr>
      <td>
        `currency`
      </td>

      <td>
        The currency of the payment, provided as a 3-letter ISO 4217 currency code. For example, `GBP` for pounds, or `EUR` for euros.

        Note that you cannot make a payment from an account with one currency to an account with a different currency. For example from a GBP to EUR account. Ensure you provide the correct `merchant_account_id`.
      </td>
    </tr>

    <tr>
      <td>
        `beneficiary.type`
      </td>

      <td>
        This must be set to `payment_source` for a closed-loop payout.
      </td>
    </tr>

    <tr>
      <td>
        `beneficiary.reference`
      </td>

      <td>
        A reference for the payout.

        The beneficiary sees this reference alongside this payout on their statement or in their banking app.
      </td>
    </tr>

    <tr>
      <td>
        `beneficiary.payment_source_id`
      </td>

      <td>
        The `id` of the account that made the original deposit.

        You can find this `id` as the value of `payment_source.id` in the [`payment_settled` webhook](https://docs.truelayer.com/truelayer/docs/payment-webhooks#payment_settled) for the initial pay-in.

        Alternatively, you can find this under **Payment Source ID** if you click the initial pay-in in the [Console payments view](https://docs.truelayer.com/truelayer/docs/payments-view).
      </td>
    </tr>

    <tr>
      <td>
        `beneficiary.user_id`
      </td>

      <td>
        The `id` of the user that made the original deposit.

        You can find this `id` as the value of `user_id` in the [`payment_settled` webhook](https://docs.truelayer.com/truelayer/docs/payment-webhooks#payment_settled) for the initial pay-in.

        Alternatively, you can find this under **User ID** if you click the initial pay-in in the [Console payments view](https://docs.truelayer.com/truelayer/docs/payments-view).
      </td>
    </tr>

    <tr>
      <td>
        `submerchants`
      </td>

      <td>
        This parameter is only relevant if you are a partner of TrueLayer operating as a collecting PSP. As a partner, you are considered a merchant, and any businesses you process transactions for are 'submerchants'.

        If this applies to you, you must provide the details of the submerchant you're processing a transaction for in this parameter, along with the user information for the payout.

        Find more information about the required information in the `submerchants.ultimate_counterparty` parameter in the API reference for the <a href="https://docs.truelayer.com/reference/create-payout" target="_blank">`/v3/payouts` endpoint</a>.
      </td>
    </tr>

    <tr>
      <td>
        `metadata`
      </td>

      <td>
        This parameter is optional.

        You can include up to 10 key-value pairs in this object. This is typically used to attach metadata that helps with reconciliation to your payout.
      </td>
    </tr>
  </tbody>
</Table>

### 2.2 Merchant account `id`

Include the `id` of the merchant account you want to pay out from in your request. You include it in the `merchant_account_id` parameter. This ensures that you make the payout from the correct account.

The merchant account that you use must be in the same currency as the payout and beneficiary account. (For example, you cannot make a EUR payment from a GBP merchant account or to a GBP beneficiary account.)

You can get your `merchant_account_id` through two methods:

* Use the <a href="https://docs.truelayer.com/reference/list-operating-accounts" target="_blank">`/v3/merchant-accounts` endpoint</a> to return a list of your merchant accounts.
* Open the <a href="https://console.truelayer.com/payments/v3/merchant-account" target="_blank">**Merchant Account** page in Console</a>, select the correct currency, then open the **Details** tab.

This is an example of the `merchant_account_id` parameter filled out correctly:

```json merchant_account_id example
{
	"merchant_account_id": "2a485b0a-a29c-4aa2-bcef-b34d0f6f8d51",
//...
}
```

### 2.3 Payout amount and currency

When you make a closed-loop payout, you must specify the value and currency of the payout.

To specify the value of your payout, provide a numeric value for the `amount_in_minor` parameter. This should be the value of your payout in a minor denomination. This means that a value of 1500 corresponds to 15 GBP or 15 EUR.

To specify the currency of your payout, you need to provide a <a href="https://en.wikipedia.org/wiki/ISO_4217" target="_blank">three-letter ISO 4217 currency code</a> for the `currency` parameter. For example, GBP for pounds sterling and EUR for euros.

This an example of the `amount_in_minor` and `currency` parameters filled out correctly:

```json amount_in_minor and currency example
{
//...
	"amount_in_minor": 1500,
	"currency": "EUR",
//...
}
```

### 2.4 Payout scheme selection

You can select a payment scheme for your payout to be made through by using the `scheme_selection` object. Unlike creating a payment, the `scheme_selection` object for payouts is not contained within a provider selection object.

There are three different values that you can set for scheme selection:

#### `instant_preferred`

Preferably selects a payment scheme that supports instant payments for the currency and geography that you're making the payment in. However, the API will fall back to a non-instant scheme if instant payments are unavailable. The `payout_executed` webhook will specify the actual scheme used. This is optimal when you don't mind if a payout settles slowly, and can help you avoid fees and payment failures.

#### `instant_only`

Automatically selects a payment scheme that supports instant payments for the currency and geography that you're making the payment in. This type is optimal when you need payments to settle quickly.

#### `preselected`

Selects a payment scheme compatible with the currency of the payment and geographic region that you are paying in. This is useful if you want full control over the scheme that a payout goes through.

When you use a preselected scheme, you need to specify a `scheme_id`. Ensure that your scheme ID is compatible with the currency that you are using. Possible scheme IDs are:

* `faster_payments_service`
* `sepa_credit_transfer_instant`
* `sepa_credit_transfer`

See this code block for examples of each scheme selection type.

```json instant_preferred example
{
  //[...]
	"scheme_selection": {
		"type" : "instant_preferred"
	}
}
```
```json instant_only example
{
  //[...]
	"scheme_selection": {
		"type" : "instant_only"
	}
}
```
```json preselected example
{
  //[...]
	"scheme_selection": {
		"type" : "preselected",
		"scheme_id": "polish_domestic_express"
	}
}
```

We recommend using `instant_preferred` for the best user experience.

#### <€100,000 payouts

Payouts that are €100,000 or over automatically move through the **SEPA Credit** scheme.

The payout appears as normal in the payments view on Console, with SEPA Credit displayed as the scheme.

Do not use the `instant_only` scheme selection object for these payments, as they will immediately fail.

### 2.5 Beneficiary details

Use the beneficiary object in your payout creation request to specify who will receive your payout. For a closed-loop payout, it contains four mandatory parameters, explained below.

#### 2.5.1 `type` parameter

In a closed-loop payout, you must use a value of `payment_source` for the `type` parameter.

You can use a value of `external_account` or `business_account` for an [open-loop payout](https://docs.truelayer.com/truelayer/docs/make-a-payout-to-an-external-account) or [payout to your business account](https://docs.truelayer.com/truelayer/docs/make-a-payout-to-your-business-account) respectively.

#### 2.5.2 `payment_source` parameter

You must provide the payment source `id` if the initial pay-in in your payout request. You include this in the `payment_source_id` parameter. This ensures the payout is sent back to the same account as the initial pay-in.

There are three ways to get the payment source `id` for a previous pay-in:

* Check the value returned in the [`payment_settled` webhook](https://docs.truelayer.com/truelayer/docs/payment-webhooks#payment_settled) for the initial pay-in.
* Make a request to the <a href="https://docs.truelayer.com/reference/get-payment-1" target="_blank">`/v3/payments/{id}` endpoint</a>, using the `id` of initial pay-in as a path parameter.
* Click on the initial pay-in in the [payment view in Console](https://docs.truelayer.com/truelayer/docs/payments-view), and check the **Payment Source ID** in the right panel.

#### 2.5.3 `user_id` parameter

Within your payout request, you must include the user `id` for the user who made the initial pay-in. You include this in the `user_id` parameter.

When you accept the initial payment, you can provide a user `id` or allow us to auto-generate one for you. Whichever approach you choose, you should use this `id` to represent the same user for future payments.

As with the payment source, there are three ways to get the user `id` for a previous pay-in:

* Check the value returned in the [`payment_settled` webhook](https://docs.truelayer.com/truelayer/docs/payment-webhooks#payment_settled) for the initial pay-in.
* Make a request to the <a href="https://docs.truelayer.com/reference/get-payment-1" target="_blank">`/v3/payments/{id}` endpoint</a>, using the `id` of initial pay-in as a path parameter.
* Click on the initial pay-in in the [payment view in Console](https://docs.truelayer.com/truelayer/docs/payments-view), and check the **User ID** in the right panel.

#### 2.5.4 `reference` parameter

Include a string for the `reference` parameter in your payout. The beneficiary sees this reference alongside this payout on their statement or in their banking app.

A common approach to take is to programmatically generate a reference that starts with a string that identifies your business. Then attach a number to it, which you and your user can use to reconcile the payout if needed.

We recommend that you keep your reference under 18 characters, and include no [special characters](https://docs.truelayer.com/truelayer/docs/character-limitations-in-payments) other than `-` or `.`.

#### `beneficiary` object example

This an example of the `beneficiary` object filled out correctly, including the four parameters described above:

```json beneficiary object example
{
//...
	"beneficiary": {
		"type": "payment_source",
		"user_id": "f61c0ec7-0f83-414e-8e5f-aace86e0ed35",
		"payment_source_id": "c7022d14-3f53-4162-99de-1d615b77b960",
		"reference": "FinancialCo-738940"
	}
}
```

### 2.6 Optional metadata

You don't need to include any values for the `metadata` object. However, if your business needs to include extra metadata in your payout requests (for internal processes for example), you can choose to include up to 10 key value pairs.

To include metadata, provide key value pairs in the object in the format below:

```json
{
//...
  "metadata": {
    "Metadata_key_1": "Metadata_value_1",
    "Metadata_key_2": "Metadata_value_2",
    "Metadata_key_3": "Metadata_value_3"
  }
}
```

## Example closed-loop payout requests

When you specify the mandatory parameters above in your request, you can initiate a closed-loop payout.

The code block below contains two examples of sandbox closed-loop payouts. One for a GBP payout, and one for a EUR payout.

```json GBP closed-loop payout example
POST /v3/payouts HTTP/1.1
Content-Type: application/json
Idempotency-Key: {RANDOM_UUID}
Tl-Signature: {SIGNATURE}
Authorization: Bearer {ACCESS_TOKEN}
Host: api.truelayer-sandbox.com

{
	"merchant_account_id": "200552da-13da-43c5-a9ba-04ee1502ac57",
	"amount_in_minor": 1,
	"currency": "GBP",
	"beneficiary": {
		"type": "payment_source",
		"user_id": "f61c0ec7-0f83-414e-8e5f-aace86e0ed35",
		"payment_source_id": "41b500a4-5379-4f30-9eda-2fcc032afc37",
		"reference": "PayOutRef"
	}
}
```
```json EUR closed-loop payout example
POST /v3/payouts HTTP/1.1
Content-Type: application/json
Idempotency-Key: {RANDOM_UUID}
Tl-Signature: {SIGNATURE}
Authorization: Bearer {ACCESS_TOKEN}
Host: api.truelayer-sandbox.com

{
	"merchant_account_id": "2a485b0a-a29c-4aa2-bcef-b34d0f6f8d51",
	"amount_in_minor": 1,
	"currency": "EUR",
	"beneficiary": {
		"type": "payment_source",
		"user_id": "f61c0ec7-0f83-414e-8e5f-aace86e0ed35",
		"payment_source_id": "c7022d14-3f53-4162-99de-1d615b77b960",
		"reference": "PayOutRef"
	}
}
```

## 3. Monitor a closed-loop payout

When you make a successful closed-loop payout, you receive a webhook and also a response that contains the payout `id` only:

```json Example closed-loop payout response
{
	"id": "a7e4e74f-d7da-43e2-af7f-f953724a461c"
}
```

You can use this webhook and `id` to confirm whether your payout was successful, and take action if appropriate.

There are two ways that you can check on the progress of your payout:

* Check the webhooks sent to your webhook URI you have set in Console (recommended)
* Make a GET request to the `/v3/payouts/{id}` endpoint.

### Payout webhooks

We recommend that you use webhooks to monitor all of the requests you make with the Payments API v3. You receive webhooks for all events in your integration.

Webhooks for your integration are sent to the Webhook URI you have set on the [**Payments > Settings** page](https://docs.truelayer.com/truelayer/docs/payments-settings) in Console. You should ensure that you have [set up request signing for your webhook notifications](https://docs.truelayer.com/truelayer/docs/configure-webhooks-for-your-integration) to ensure that they are reliable.

The two webhooks that you receive for a closed-loop payout are [`payout_executed`](https://docs.truelayer.com/truelayer/docs/payout-webhooks#payout_executed) or [`payout_failed`](https://docs.truelayer.com/truelayer/docs/payout-webhooks#payout_failed). You should receive these very soon after your payout request.

This code block contains examples of an executed and a failed webhook for a closed-loop payout:

```json payout_executed webhook
{
  "type": "payout_executed",
  "event_id": "8712ba64-7864-58d5-1ae8-20ddf61f47d8",
  "event_version": 1,
  "payout_id": "45784e7e-e592-4d9c-b315-3b6a203584bb",
  "executed_at": "2024-01-12T13:53:49.963Z",
  "beneficiary": {
    "type": "payment_source",
    "user_id": "f61c0ec7-0f83-414e-8e5f-aace86e0ed35",
    "payment_source_id": "c7022d14-3f53-4162-99de-1d615b77b960"
  },
  "scheme_id": "internal_transfer"
}
```
```json payout_failed webhook
{
  "type": "payout_failed",
  "event_id": "24089aed-4fd4-9e13-f8b2-f458f30c836c",
  "event_version": 1,
  "payout_id": "0a495e9f-2f41-4669-ba33-85407c0b26cb",
  "failed_at": "2024-01-12T14:56:05.117850644Z",
  "failure_reason": "insufficient_funds",
  "beneficiary": {
    "type": "payment_source",
    "user_id": "f61c0ec7-0f83-414e-8e5f-aace86e0ed35",
    "payment_source_id": "c7022d14-3f53-4162-99de-1d615b77b960"
  }
}
```

### GET payouts endpoint

You can use the payout `id` you received when you made the payout to get information about it.

To do so, make a POST request to the <a href="https://docs.truelayer.com/reference/get-payout" target="_blank">`/v3/payouts/{id}` endpoint</a>, including the payout `id` as a path parameter.

You receive a response in this format:

```json /v3/payouts/{id} endpoint response example
{
  "id": "0cd1b0f7-71bc-4d24-b209-95259dadcc20",
  "merchant_account_id": "AB8FA060-3F1B-4AE8-9692-4AA3131020D0",
  "amount_in_minor": 0,
  "currency": "GBP",
  "beneficiary": {
    "type": "external_account",
    "reference": "string",
    "account_holder_name": "string",
    "account_identifiers": [
      {
        "type": "sort_code_account_number",
        "sort_code": 560029,
        "account_number": 26207729
      },
      {
        "type": "iban",
        "iban": "GB32CLRB04066800012315"
      }
    ]
  },
  "metadata": {
    "prop1": "value1",
    "prop2": "value2"
  },
  "scheme_id": "faster_payments_service",
  "status": "pending",
  "created_at": "string"
}
```

The `status` object is especially important, as you can use this to check the progression of your payout through its lifecycle.

## Payout lifecycle

After you create a payout, it moves through a series of different states depending on its outcome. See the [full list of payout statuses](https://docs.truelayer.com/truelayer/docs/payout-and-refund-statuses) for more information.

This is the journey a payout usually follows:

1. When a payout is first made, it has a status of `pending` before it's sent to the payment scheme for authorisation.
2. Once the payout has been authorised and is with the payment scheme for execution, it has a status of `authorized`.<br />It usually takes just a few seconds for a successful payout to transition through the `pending` and `authorized` statuses.
3. Depending on whether the payment scheme executes the payout, it transitions to one of two statuses:
   1. `payout_executed` if the payout was successful.
   2. `payout_failed` if the payout could not be executed.

If a payout fails, the webhook contains a [`failure_reason` that you can use to identify why it failed](https://docs.truelayer.com/truelayer/docs/payout-and-refund-statuses#payout-failure-reasons). It also includes a `failure_details` object with:&#x20;

* additional information in the form of a machine-readable `error_code` eg `account_closed`&#x20;
* a human-readable message in the `message` field with more information.

### [Payout returns](https://docs.truelayer.com/truelayer/docs/payout-and-refund-returns)

A return occurs when a payout or refund is executed, but rejected by a banking provider. The money moves back to your merchant account.

<Image src="https://files.readme.io/6602ccddb78dbcad2e76f41d7bd921508119858ea05e3763da1e1ac2f634a62b-payout_and_refund_return_flow.svg" alt="payout statuses (light)" align="center" />

![payout statuses (dark)](https://files.readme.io/80cfa8ef25e6fc0ece800c0bc05083c517a33dd109ced24ff5e8e40cd0ef01b3-payout_and_refund_return_flow_dark.svg)

<br />

The reasons for a return are decided by banks. For example, a payout might be returned if the account you're attempting to pay has been closed by the bank or is under investigation.

This occurs in less than 0.01% of payouts, but you must make sure that your system can handle a payout transitioning from `executed` to `failed`.