Send an unreferenced refund to a customer’s bank account

Note: Only certain merchant accounts can send unreferenced refunds.

A merchant can refund a payment to a customer’s bank account without a paymentId by running an unreferenced refund.

Integration steps

Step 1. Refund the payment.

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. Refund the payment

To refund a bank transfer payment, send a POST request to the Bank Transfer Refunds endpoint.

Request parameters

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

Request

processingTerminalIdstringRequired>=4 characters<=50 characters
Unique identifier that we assigned to the terminal.
orderobjectRequired
Object that contains information about the order.
refundMethodobjectRequired
Object that contains information about how the merchant refunds the customer.
customFieldslist of objectsOptional
Array of customField objects.

Example request

POST
/v1/bank-transfer-refunds
1curl -X POST https://api.payroc.com/v1/bank-transfer-refunds \
2 -H "Idempotency-Key: 8e03978e-40d5-43e8-bc93-6894a57f9324" \
3 -H "Authorization: Bearer <token>" \
4 -H "Content-Type: application/json" \
5 -d '{
6 "processingTerminalId": "52d9b7f7-3b39-4cd6-9acb-1050f8593ec6",
7 "order": {
8 "amount": 2899,
9 "currency": "AED",
10 "description": "Pizza Doe #1234 - Dinner",
11 "orderId": "OrderRef6543"
12 },
13 "refundMethod": {
14 "type": "ach",
15 "nameOnAccount": "Shara Hazel Hopper",
16 "accountNumber": "1234567890",
17 "routingNumber": "123456789"
18 }
19}'

Response fields

If your request is successful, we send the refund to the customer’s bank account and return a response. The response contains the following fields:

Response

refundIdstringRequired=10 characters
Unique identifier that our gateway assigned to the refund.
processingTerminalIdstringRequired>=4 characters<=50 characters
Unique identifier that we assigned to the terminal.
orderobjectRequired
Object that contains information about the order.
bankAccountobjectRequired
Object that contains information about the bank account.
transactionResultobjectRequired
Object that contains information about the transaction.
customerobjectOptional
Object that contains information about the customer.
paymentobjectOptional
Object that contains information about a payment.
customFieldslist of objectsOptional
Array of customField objects.

Example response

Response
1{
2 "refundId": "CD3HN88U9F",
3 "processingTerminalId": "1234001",
4 "order": {
5 "amount": 4999,
6 "currency": "USD",
7 "description": "Refund for order OrderRef6543",
8 "orderId": "OrderRef6543",
9 "dateTime": "2024-07-02T15:30:00Z"
10 },
11 "bankAccount": {
12 "type": "ach",
13 "secCode": "web",
14 "nameOnAccount": "Sarah Hazel Hopper",
15 "accountNumber": "****7890",
16 "routingNumber": "*****6789"
17 },
18 "transactionResult": {
19 "type": "unreferencedRefund",
20 "status": "ready",
21 "responseMessage": "NoError",
22 "authorizedAmount": -4999,
23 "currency": "USD",
24 "responseCode": "A",
25 "processorResponseCode": "0"
26 },
27 "customer": {
28 "notificationLanguage": "en",
29 "contactMethods": [
30 {
31 "type": "email",
32 "value": "[email protected]"
33 }
34 ]
35 },
36 "customFields": [
37 {
38 "name": "yourCustomField",
39 "value": "abc123"
40 }
41 ]
42}