> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Route funds from a transaction

> Route funds from transactions to different bank accounts for a single paypoint

Payabli allows you to route funds from a transaction to a specific bank account for the paypoint. This option only works with a single paypoint that's running the transaction, and can't be used to distribute funds to accounts that belong to other paypoints.

## Setup

Contact the Payabli team to enable and configure fund routing. After a paypoint is boarded, the Payabli team configures the merchant's bank accounts. Payabli can add as many separate accounts as you need, and each account has an `accountId`.

## Retrieve `accountId`

You can retrieve `accountId` values for all a Paypoint's accounts by sending a GET request to the [/Paypoint endpoint](/developers/api-reference/paypoint/get-paypoint-details). They're returned in objects in the `Credentials` array.

In this example, there are two accounts for ACH (187-782 and 187-783) and two accounts for card (187-798 and 187-799)

```json
{
    "isSuccess": true,
    "responseText": "Success",
    "responseCode": 1,
    "": {
        "Paypoint": {
            "IdPaypoint": 187,
            "DbaName": "The Board Haus",
            "LegalName": "Board Haus LLC.",
            "Address1": "1801 Main Avenue",
            "Address2": "",
            "City": "Durango",
            "Zip": "81301",
            "ServiceData": null,
        // Example truncated
            "Credentials": [
                {
                    "Service": "ach",
                    "Mode": 1,
                    "Minticket": 0.0,
                    "Maxticket": 100000.0,
                    "CfeeFix": 0.0,
                    "CfeeFloat": 0.0,
                    "CfeeMin": 0.0,
                    "CfeeMax": 0.0,
                    "ReferenceId": 348,
                    "AccountId": "187-782"
                },
                {
                    "Service": "ach",
                    "Mode": 0,
                    "Minticket": 0.0,
                    "Maxticket": 100000.0,
                    "CfeeFix": 0.0,
                    "CfeeFloat": 0.0,
                    "CfeeMin": 0.0,
                    "CfeeMax": 0.0,
                    "ReferenceId": 348,
                    "AccountId": "187-783"
                },
                {
                    "Service": "card",
                    "Mode": 0,
                    "Minticket": 0.0,
                    "Maxticket": 100000.0,
                    "CfeeFix": 0.0,
                    "CfeeFloat": 0.0,
                    "CfeeMin": 0.0,
                    "CfeeMax": 0.0,
                    "ReferenceId": 358,
                    "AccountId": "187-798"
                },
                {
                    "Service": "card",
                    "Mode": 1,
                    "Minticket": 0.0,
                    "Maxticket": 100000.0,
                    "CfeeFix": 0.0,
                    "CfeeFloat": 0.0,
                    "CfeeMin": 0.0,
                    "CfeeMax": 0.0,
                    "ReferenceId": 358,
                    "AccountId": "187-799"
                },
    
                // Example truncated
            ]
        },
    },
}
```

## Routing transactions

When there is more than one account set up for a payment method, you must pass an `accountId` with the transaction.
For example, if you have Account A and Account B set up for card transactions, each transaction must include an `accountId` for either Account A or Account B.

In these examples, Account A has an `accountId` of 187-798, and Account B has an `accountId` of 187-799.

```bash Card payment to Account A

curl -X POST 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid?forceCustomerCreation=false' \
     -H 'accept: application/json' \
     -H 'content-type: application/*+json' \
     -H 'requestToken: <API TOKEN>'
{
    "entryPoint": "41035afaa7",
    "paymentMethod": {
        "method": "card",
        "cardnumber": "4293189100000008",
        "cardexp": "0924",
        "cardcvv": "345",
        "cardzip": "34234",
        "cardHolder": "John Smith"
    },
    "paymentDetails": {
        "totalAmount":20,
        "serviceFee": 0.00
    },
    "customerData": {
        "customerId": 224,
        "customerNumber": "888",
        "billingAddress1": "5127 Linkwood ave"
    },
    "accountId": "187-798"
}
```

```bash Card payment to Account B

curl -X POST 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid?forceCustomerCreation=false' \
     -H 'accept: application/json' \
     -H 'content-type: application/*+json' \
     -H 'requestToken: <API TOKEN>'
{
    "entryPoint": "41035afaa7",
    "paymentMethod": {
        "method": "card",
        "cardnumber": "4293111111111111",
        "cardexp": "0927",
        "cardcvv": "999",
        "cardzip": "34234",
        "cardHolder": "Rafael Campos"
    },
    "paymentDetails": {
        "totalAmount":3670.56,
        "serviceFee": 10.00
    },
    "customerData": {
        "customerId": 222,
        "customerNumber": "987",
        "billingAddress1": "221 Judge Gault Pkwy"
    },
    "accountId": "187-799"
}
```

If a paypoint is set up with multiple accounts and you don't include an `accountId` with a transaction, you'll get a "Multiple Gateway Data for payment method" error:

```json Example error response
{
    "responseText": "Declined",
    "isSuccess": false,
    "responseData": {
        "authCode": null,
        "referenceId": null,
        "resultCode": 3,
        "resultText": "Multiple Gateway Data for payment method",
        "avsResponseText": null,
        "cvvResponseText": null,
        "customerId": null,
        "methodReferenceId": null
    }
}
```

## Related resources

See these related resources to help you get the most out of Payabli.

* **[Fund routing overview](/guides/pay-in-routing-overview)** - Learn your options for sending Pay In funds into different accounts

- **[Bank account functions and account IDs](/guides/pay-ops-boarding-bank-accounts-overview)** - Understand how deposit, withdrawal, and remittance accounts work and how account IDs route transactions

**Split funds from a transaction** - Fund routing sends a transaction to one account; split funding distributes one transaction across several. See [Split funds from a transaction](/guides/pay-in-developer-routing-split-funds)