Send funds to your merchants

Important: Before you begin, make sure that you have read our Getting Started guide, and that you have received your API key.

To send funds to your merchants, you need to provide us with instructions about:

  • Funding accounts that we should send the funds to
  • Amount of funds that we should send

Before you create your funding instructions, we recommend that you check to make sure you have the funds available to send.

Integration steps

Step 1. (Optional) Check the available balance.
Step 2. Create a funding instruction.

Before you begin

Bearer tokens

Use our Identity Service to generate a Bearer token to include in the header of your requests. To generate your Bearer token, complete the following steps:

  1. Include your API key in the x-api-key parameter in the header of a POST request.
  2. Send your request to https://identity.payroc.com/authorize.

Note: You need to generate a new Bearer token before the previous Bearer token expires.

Example request

$curl --location --request POST 'https://identity.payroc.com/authorize' --header 'x-api-key: <api key>'

Example response

If your request is successful, we return a response that contains your Bearer token, information about its scope, and when it expires.

1{
2 "access_token": "eyJhbGc....adQssw5c",
3 "expires_in": 3600,
4 "scope": "service_a service_b",
5 "token_type": "Bearer"
6}

Headers

To create the header of each POST request, you must include the following parameters:

  • Content-Type: Include application/json as the value for this parameter.
  • Authorization: Include your Bearer token in this parameter.
  • Idempotency-Key: Include a UUID v4 to make the request idempotent.
$curl
>-H "Content-Type: application/json"
>-H "Authorization: <Bearer token>"
>-H "Idempotency-Key: <UUID v4>"

Errors

If your request is unsuccessful, we return an error. For more information about errors, see Errors.

Step 1. (Optional) Check the available balance

To check the available balance, you need to send a GET request to our Funding Balance endpoint.

Query parameters

beforestringOptional
Return the previous page of results before the value that you specify. You can’t send the before parameter in the same request as the after parameter.
afterstringOptional
Return the next page of results after the value that you specify. You can’t send the after parameter in the same request as the before parameter.
limitintegerOptional<=100Defaults to 10
Limit the maximum number of results that we return for each page.
merchantIdstringOptional
Filter results by the unique identifier that the processor assigned to the merchant.

Example request

GET
/v1/funding-balance
1curl -G https://api.payroc.com/v1/funding-balance \
2 -H "Authorization: Bearer <token>" \
3 -d before=2571 \
4 -d after=8516 \
5 -d limit=25 \
6 -d merchantId=4525644354

If your request is successful, we return a response that contains the funds available for your merchant. The response contains the following fields:

Response

datalist of objectsRequired
Array of merchantBalance objects.
countdoubleOptional
Number of results we returned on this page. **Note:** This might not be the total number of results that match your query.
hasMorebooleanOptional
Indicates whether there is another page of results available.
limitdoubleOptional
Maximum number of results that we return for each page.

Example response

Response
1{
2 "data": [
3 {
4 "merchantId": "4525644354",
5 "funds": 120000,
6 "pending": 50050,
7 "available": 69950,
8 "currency": "USD"
9 },
10 {
11 "merchantId": "9876543219",
12 "funds": 50000,
13 "pending": 0,
14 "available": 50000,
15 "currency": "USD"
16 }
17 ],
18 "count": 2,
19 "hasMore": true,
20 "limit": 2,
21 "links": [
22 {
23 "rel": "previous",
24 "method": "get",
25 "href": "https://api.payroc.com/v1/funding-balance?before=4525644354&limit=2"
26 },
27 {
28 "rel": "next",
29 "method": "get",
30 "href": "https://api.payroc.com/v1/funding-balance?after=9876543219&limit=2"
31 }
32 ]
33}

Step 2. Create a funding instruction

Note: You can use a funding instruction to send funds to a single merchant or to multiple merchants in a single request.

To create your funding instruction, send a POST request to our Funding Instructions endpoint.

To create the body of your request, use the following parameters:

Request

merchantslist of objectsOptional
Array of merchantInstruction objects.
metadatamap from strings to stringsOptional
[Metadata](https://docs.payroc.com/api/metadata) object you can use to include custom data with your request.

Note: Use our metadata feature to add custom information to your request.

Example request

POST
/v1/funding-instructions
1curl -X POST https://api.payroc.com/v1/funding-instructions \
2 -H "Idempotency-Key: 8e03978e-40d5-43e8-bc93-6894a57f9324" \
3 -H "Authorization: Bearer <token>" \
4 -H "Content-Type: application/json" \
5 -d '{}'

If your request is successful, we create the funding instruction and return a response. The response contains the following fields:

Response

instructionIdintegerOptional
Unique identifier of the funding instruction.
createdDatestringOptionalformat: "datetime"
Date that we created the funding instruction.
lastModifiedDatestringOptionalformat: "datetime"
Date of the most recent change to the funding instruction.
statusenumOptional
Status of the funding instruction.
Allowed values:
merchantslist of objectsOptional
Array of merchantInstruction objects.
metadatamap from strings to stringsOptional
[Metadata](https://docs.payroc.com/api/metadata) object you can use to include custom data with your request.

Example response

Response
1{
2 "instructionId": 64643131,
3 "createdDate": "2024-07-02T15:30:00Z",
4 "lastModifiedDate": "2024-07-02T15:30:00Z",
5 "status": "accepted",
6 "merchants": [
7 {
8 "merchantId": "4525644354",
9 "recipients": [
10 {
11 "fundingAccountId": 123,
12 "paymentMethod": "ACH",
13 "amount": {
14 "value": 120000,
15 "currency": "USD"
16 },
17 "status": "accepted",
18 "metadata": {
19 "yourCustomField": "abc123"
20 },
21 "link": {
22 "rel": "fundingAccount",
23 "method": "get",
24 "href": "https://api.payroc.com/v1/funding-accounts/123"
25 }
26 }
27 ],
28 "link": {
29 "rel": "merchant",
30 "method": "get",
31 "href": "https://api.payroc.com/v1/processing-accounts/4525644354"
32 }
33 }
34 ],
35 "metadata": {
36 "instructionRef": "abc123"
37 }
38}

Test cases

Our integration team provides you with test cases that you can run to verify that your integration works with our API.

For your next steps, we recommend that you integrate with the other functions so you can manage your funding instructions. To view the other functions, see funding instructions.