> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mangopay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Payouts

## General testing

To test payouts, you need a user that has the `KYCLevel` of `REGULAR`. To simulate their verification, call [POST Create an IDV Session](/api-reference/idv-sessions/create-idv-session) and follow the `HostedUrl` returned (see hosted [KYC/KYB testing](/guides/users/verification/hosted/integration#testing) for details).

When the user is verified, you now need to register a Recipient for them, which requires SCA redirection. You can bypass SCA in Sandbox by adding the word `accept` to the User's `Email` or `LegalRepresentative.Email`.

To register the Recipient, call [POST Create a Recipient](/api-reference/recipients/create-recipient) (with `RecipientScope` `PAYOUT`).

You can use the test accounts below.

#### IBAN test account

* `IBAN` - FR7630004000031234567890143
* `BIC` - BNPAFRPP

#### GB test account

* `AccountNumber` - 55779911
* `SortCode` - 200000
* `IBAN` - GB60BARC20000055779911
* `BIC` – BARCGB22XXX

When the Recipient's `Status` is `ACTIVE`, call the [POST Create a Payout](/api-reference/payouts/create-payout) endpoint with the `Id` of the Recipient in the `RecipientId` parameter.

Payouts are typically set to succeed automatically on testing accounts.

To test a `FAILED` payout, you need to use a technical error, such as setting the amount as greater than the wallet balance.

## Instant payout testing

To simulate the fallback to a standard payout from an instant payout due to a banking error, you can use the following IBAN account:

* `IBAN` - FR541558929750ZZZZZZAC01915
* `BIC` - CMBRFR2BXXX

```json Request example theme={null}
{
    "AuthorId": "145397183",
    "Tag": "IP banking error",
    "DebitedFunds": {
        "Currency": "EUR",
        "Amount": 1000
    },
    "Fees": {
        "Currency": "EUR",
        "Amount": 10
    },
    "BankAccountId": "158988175",
    "DebitedWalletId": "145397873",
    "BankWireRef": "Postman",
    "PayoutModeRequested":"INSTANT_PAYMENT"
}
```

When viewing the payout, the API returns a fallbacked payout (i.e., the `STANDARD` mode was applied).

```json Response example theme={null}
{
    "ModeRequested": "INSTANT_PAYMENT",
    "ModeApplied": "STANDARD",
    "FallbackReason": {
        "Code": "001999",
        "Message": "Generic Operation error"
    },
    "EndToEndId": "77a7f37820fd4e49910e6bd3c04c919c",
    "Id": "158988302",
    "Tag": "IP banking error",
    "CreationDate": 1672235391,
    "AuthorId": "145397183",
    "CreditedUserId": null,
    "DebitedFunds": {
        "Currency": "EUR",
        "Amount": 1000
    },
    "CreditedFunds": {
        "Currency": "EUR",
        "Amount": 990
    },
    "Fees": {
        "Currency": "EUR",
        "Amount": 10
    },
    "Status": "SUCCEEDED",
    "ResultCode": "000000",
    "ResultMessage": "Success",
    "ExecutionDate": 1672235391,
    "Type": "PAYOUT",
    "Nature": "REGULAR",
    "CreditedWalletId": null,
    "DebitedWalletId": "145397873",
    "PaymentType": "BANK_WIRE",
    "BankAccountId": "158988175",
    "BankWireRef": "Postman"
}
```

To simulate a non-reachable bank account, use the `IP1070` value for the `BankWireRef` parameter.

```json Request example theme={null}
{
    "AuthorId":"142036728",
    "DebitedFunds":{
        "Currency":"EUR",
        "Amount":1260
    },
    "Fees":{
        "Currency":"EUR",
        "Amount":12
    },
    "BankAccountId":"151986981",
    "DebitedWalletId":"145389978",
    "BankWireRef":"IP1070",
    "PayoutModeRequested":"INSTANT_PAYMENT"
}
```

```json Response theme={null}
{
    "InstantPayout": {
        "IsReachable": false,
        "UnreachableReason": {
            "Code": "130010",
            "Message": "Generic operation error"
        }
    }
}
```

The following unreachable reasons can be returned:

* 130006 - technical error, please try again later
* 130007 - Destination Bank is not reachable
* 130008 - Duplicate transaction identified
* 130009 - The destination IBAN is not valid
* 130010 - Generic operation error

## Related resources

<CardGroup col={2}>
  <Card title="Endpoints" href="/api-reference/payouts/payout-object">
    The Payout object
  </Card>

  <Card title="Guide" href="/guides/payouts">
    Learn more about payouts
  </Card>
</CardGroup>
