# How to make transfers and payments

{% embed url="<https://www.youtube.com/watch?index=1&list=PLdtUNQ2k27WiAdJFzLeF-a7weue5U12Kl&v=AA-tiVE8JUA>" %}

The **Account information API** also allows you to perform actions against their account programmatically (not just read-only). This includes transferring money between your accounts and paying money to beneficiaries. &#x20;

{% hint style="info" %}
Transfers and payments are currently only available for 🏦 Private Banking account holders.&#x20;
{% endhint %}

## **Using Postman**&#x20;

If you’re new to APIs and want to get familiar with using the endpoints, we recommend you create a Postman account (it's free) and use the Postman collections provided to test things out.

{% hint style="info" %}
[**Investec Programmable Banking Postman Collection**](https://www.postman.com/investec-open-api/programmable-banking/overview)
{% endhint %}

### 1. Make a transfer

1. [Retrieve a list of your accounts and their accountIDs](https://investec.gitbook.io/programmable-banking-community-wiki/get-started/api-quick-start-guide/pages/CT2Wq9KWR1mLM4lzqWi0#id-1.-get-your-accounts-and-account-id-with-postman)
2. &#x20;Take note of the **accountID** that you would like to make the transfer to.
3. Head over to the "Variables" table to insert your **accountID - this is the account from which you would like to make the transfer.** You can also set it under the Params tab on the query page.
4. Navigate to the **Accounts folder** and **POST transfer multiple query.**
5. Navigate to the **Body** tab and enter a value into each field. Here you will see that each transfer is defined by four key fields
   1. **beneficiaryAccountID -** this is the account where the funds will transfer to
   2. **amount** - the amount to pay in ZAR
   3. **myReference** - reference displayed on your transaction description
   4. **theirReference** - reference displayed on the recipient's statement

```json
{
    "transferList": [
        {
            "beneficiaryAccountId": "3353431574710166878182963",
            "amount": "10", 
            "myReference": "API transfer",
            "theirReference": "API transfer"
        }
    ] 
}
```

6. Hit **Send** to make a call to the API endpoint.

<pre><code><strong>https://openapi.investec.com//za/pb/v1/accounts/:accountId/transfermultiple
</strong></code></pre>

### 2. Make a payment

{% hint style="info" %}
**You can only make programmatic payments to beneficiaries that have been created and paid at least once before from your account with regular online banking.**
{% endhint %}

1. Ensure you have [authenticated](/programmable-banking-community-wiki/get-started/api-quick-start-guide/how-to-authenticate.md) and pasted in your bearer token into the "Variables" tables.
2. Retrieve your list of beneficiaries by navigating to the **Beneficiaries** folder and the **GET Beneficiaries query**.&#x20;
3. Hit **Send** to make a call to the API endpoint (no additional parameters need to be set).&#x20;

```
https://openapi.investec.com/za/pb/v1/accounts/beneficiaries
```

4. Take note of the **beneficiaryID** of the beneficiary that you would like to make the payment to.&#x20;

<details>

<summary>Example response for 🏦 Private Banking</summary>

```json
{
  "data": [
    {
      "beneficiaryId": "LOREMIPSUMDOLOR=",
      "accountNumber": "1234567890",
      "code": "123456",
      "bank": "ACME CORP",
      "beneficiaryName": "Jane Smith",
      "lastPaymentAmount": "1.00",
      "lastPaymentDate": "10/01/2023",
      "cellNo": null,
      "emailAddress": null,
      "name": "Jane Smith",
      "referenceAccountNumber": "LOREM IPSUM DOLOR",
      "referenceName": "LOREM IPSUM",
      "categoryId": "112233445566",
      "profileId": "77889900"
    },
  ],
  "links": {
    "self": "https://openapi.investec.com/za/pb/v1/accounts/beneficiaries"
  },
  "meta": {
    "totalPages": 1
  }
}
```

</details>

{% hint style="info" %}
Payment notifications will go out to the listed "cellNo" and "emailaddress" of the beneficiary. If these are null, then no notification will be sent.
{% endhint %}

5. Head over to the "Variables" table to insert your **accountID - this is the account from which you would like to make the payment.** You can also set it under the Params tab on the query page.
6. Navigate to the **Beneficiaries** folder and the **POST Beneficiary payment query.** The endpoint can receive an array list of payments and is therefore able to process multiple payments at one point.&#x20;
7. Navigate to the **Body** tab and enter a value into each field. Here you will see that each payment is defined by four key fields
   1. **beneficiaryID -** this is the account to which you want to make the payment
   2. **amount** - the amount to pay in ZAR
   3. **myReference** - reference displayed on your transaction description
   4. **theirReference** - reference displayed on the recipient's statement

```json
{
  "paymentsList": [
    {
      "beneficiaryId": "01234567890",
      "amount": "10",
      "myReference": "API transfer",
      "theirReference": "API transfer"
    }
  ]
}
```

8. Hit **Send** to make a call to the API endpoint.&#x20;

```
https://openapi.investec.com/za/pb/v1/accounts/{accountId}/paymultiple
```

## cURL code snippets

#### Get beneficiaries

```
curl --location 'https://openapi.investec.com/za/pb/v1/accounts/beneficiaries' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
```

#### Get beneficiary categories

```
curl --location 'https://openapi.investec.com/za/pb/v1/accounts/beneficiarycategories' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
```

#### **Make a transfer**&#x20;

```
curl --location 'https://openapi.investec.com/za/pb/v1/accounts//transfermultiple' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "transferList": [
        {
            "beneficiaryAccountId": "3353431574710166878182963", 
            "amount": "10", 
            "myReference": "API transfer", 
            "theirReference": "API transfer" 
        }
    ] 
}'
```

#### Make a payment

```
curl --location 'https://openapi.investec.com/za/pb/v1/accounts//paymultiple' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "paymentList": [
        {
            "beneficiaryId": "{{beneficiaryId}}", 
            "amount": "10", 
            "myReference": "API demo", 
            "theirReference": "API demo2" 
        }
    ]
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://investec.gitbook.io/programmable-banking-community-wiki/get-started/api-quick-start-guide/how-to-make-a-payment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
