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. To send funds to your merchants, complete the following steps:
  1. Generate your Bearer token.
  2. (Optional) Check the available balance.
  3. Create a funding instruction.
  4. Test your integration.

Step 1. Generate your Bearer token

To generate your Bearer token, you must send your API key to our Identity Service. To send your API key to our Identity Service, complete the following steps:
  1. Include your API key in the x-api-key parameter in the header of your request.
  2. Send your POST request to https://identity.payroc.com/authorize.

Example request

curl --location --request POST 'https://identity.payroc.com/authorize' --header 'x-api-key: <api key>'
If your request is successful, we return a response that contains your Bearer token and information about its scope and when it expires.

Example response

{
"access_token": "eyJhbGc....adQssw5c",
"expires_in": 3600,
"scope": "service_a service_b",
"token_type": "Bearer"
}

Step 2. (Optional) Check the available balance

To check the available balance, you need to send a GET request to our Funding Balance endpoint. To create your request, complete the following steps: Test endpoint: https://api.uat.payroc.com/v1/funding-balance
Production endpoint: https://api.payroc.com/v1/funding-balance
  1. Create the header of your request. The header of your request should include the following parameters:
  • Content-Type: Include application/json as the value for this parameter.
  • Authorization: Include your Bearer token in this parameter.

Example header

curl
-H "Content-Type: application/json"
-H "Authorization: <Bearer token>"
  1. (Optional) Add query parameters to filter your results. This method also supports pagination to allow you navigate through the results.
  1. Send your request to the following endpoint. GET https://api.payroc.com/v1/funding-balance

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"
}
]
}
If your request is unsuccessful, we return details about the error. For more information about errors, see Errors.

Step 3. 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. To create your request, complete the following steps: Test endpoint: https://api.uat.payroc.com/v1/funding-instructions
Production endpoint: https://api.payroc.com/v1/funding-instructions
  1. Create the header of your request. The header of your request should 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.
You must include an idempotency key to prevent duplicate requests.
curl
-H "Content-Type: application/json"
-H "Authorization: <Bearer token>"
-H "Idempotency-Key: <UUID v4>"
  1. Create the body of your request. To check which parameters you need to include in the body of your request, use the following schema:

Body parameters

Use our metadata feature to add custom information to your request.
  1. Send your requests to the following endpoint:
POST https://api.payroc.com/v1/funding-instructions

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:

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"
}
}
If your request is unsuccessful, we return details about the error. For more information about errors, see Errors.

Step 4. Test your integration

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.