Send funds to your merchants

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

1. (Optional) Check the available balance.
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.
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.
{
"access_token": "eyJhbGc....adQssw5c",
"expires_in": 3600,
"scope": "service_a service_b",
"token_type": "Bearer"
}

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. Test endpoint: https://api.uat.payroc.com/v1/funding-balance
Production endpoint: https://api.payroc.com/v1/funding-balance
(Optional) Add query parameters to filter your results. This method also supports pagination to allow you navigate through the results:

Query parameters

Example request

Request
curl --request get \
--url https://api.payroc.com/v1/funding-balance
If your request is successful, we return a response that contains the funds available for your merchant. The response contains the following fields:

Response Schema

Status Code 200

Successful request. Returns the balance available for each merchant.
Response body

Example response

Response
application/json
{
"limit": 2,
"count": 2,
"hasMore": true,
"links": [
{
"rel": "previous",
"method": "get",
"href": "https://api.payroc.com/v1/funding-balance?before=65&limit=2"
},
{
"rel": "next",
"method": "get",
"href": "https://api.payroc.com/v1/funding-balance?after=66&limit=2"
}
],
"data": [
{
"merchantId": "65",
"funds": 120000,
"pending": 50050,
"available": 69950,
"currency": "USD"
},
{
"merchantId": "66",
"funds": 50000,
"pending": 0,
"available": 50000,
"currency": "USD"
}
]
}

Step 2. Create a funding instruction

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. Test endpoint: https://api.uat.payroc.com/v1/funding-instructions
Production endpoint: https://api.payroc.com/v1/funding-instructions
To create the body of your request, use the following parameters:

Header parameters

Body parameters

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

Example request

Request
curl --request post \
--url https://api.payroc.com/v1/funding-instructions \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: abc123' \
--data '{"merchants":[{"merchantId":"123456","recipients":[{"fundingAccountId":5432425374,"paymentMethod":"ACH","amount":{"value":12350,"currency":"USD"},"metadata":{"customerId":"2345"}}]}],"metadata":{"internalInstructionRef":"abcdef"}}'
If your request is successful, we create the funding instruction and return a response. The response contains the following fields:

Response Schema

Status Code 200

Successful request. Returns all available funding activity for the date range.
Response body

Example response

Response
application/json
{
"instructionId": 123,
"createdDate": "2021-09-05T13:15:00.000Z",
"lastModifiedDate": null,
"status": "accepted",
"merchants": [
{
"merchantId": "99999",
"recipients": [
{
"status": "accepted",
"fundingAccountId": 67890,
"paymentMethod": "ACH",
"amount": {
"value": 12350,
"currency": "USD"
},
"metadata": {
"customerId": "2345"
},
"link": {
"rel": "fundingAccount",
"method": "get",
"href": "https://api.payroc.com/v1/funding-accounts/67890"
}
}
],
"link": {
"rel": "merchant",
"method": "get",
"href": "https://api.payroc.com/v1/merchants/99999"
}
}
],
"metadata": {
"instructionRef": "abcd"
}
}

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.