Reverse a bank transfer payment

If a customer requests a refund and the payment is still in an open batch, the merchant can use their POS to look up the bank transfer payment and cancel the transaction.

To find the paymentId of the bank transfer payment that the merchant wants to reverse, they can retrieve a list of all the bank transfer payments that meet the search criteria that the merchant provides. They can then find the transaction that they want in the list of returned results.

Note: If the merchant runs a referenced refund on a bank transfer payment that is in an open batch, our gateway automatically reverses the payment.

Integration steps

Step 1. (Optional) List bank transfer payments.
Step 2. Reverse the bank transfer 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 GET 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.
$curl
>-H "Content-Type: application/json"
>-H "Authorization: <Bearer token>"

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) List bank transfer payments

To retrieve a list of bank transfer payments, send a GET request to our Bank Transfer Payments endpoint.

Use our filters to narrow down the search results.

Request parameters

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

Query parameters

processingTerminalIdstringRequired>=4 characters<=50 characters
Filter payments by the unique identifier that our gateway assigned to the terminal.
orderIdstringOptional>=1 character<=24 characters
Filter payments by the order ID.
nameOnAccountstringOptional>=1 character<=50 characters
Filter payments by the account holder's name.
last4stringOptionalformat: "[0-9]{4}"
Filter payments by the last four digits of the account number.
typelist of enumsOptional
Filter payments by transaction type.
statuslist of enumsOptional
Filter by the status of the payment.
dateFromstringOptionalformat: "date-time"
Filter by payments that the merchant ran after a specific date. The date follows the ISO 8601 standard.
dateTostringOptionalformat: "date-time"
Filter by payments that the merchant ran before a specific date. The date follows the ISO 8601 standard.
settlementStateenumOptional
Filter by the settlement status of the payment.
Allowed values:
settlementDatestringOptionalformat: "date"
Filter by payments settled on a specific date. The format is in **YYYY-MM-DD**.
paymentLinkIdstringOptional=10 characters
Unique identifier that our gateway assigned to the payment link.
beforestringOptional
Points to the resource identifier that you want to receive your results before. Typically, this is the first resource on the previous page.
afterstringOptional
Points to the resource identifier that you want to receive your results after. Typically, this is the last resource on the previous page.
limitintegerOptional<=100Defaults to 10
States the total amount of results the response is limited to.

Example request

GET
/v1/bank-transfer-payments
1curl -G https://api.payroc.com/v1/bank-transfer-payments \
2 -H "Authorization: Bearer <token>" \
3 -d processingTerminalId=1234001 \
4 -d orderId=OrderRef6543 \
5 --data-urlencode nameOnAccount=Sarah%20Hazel%20Hopper \
6 -d last4=7890 \
7 -d type=payment \
8 -d status=ready \
9 --data-urlencode dateFrom=2024-07-01T00:00:00Z \
10 --data-urlencode dateTo=2024-07-31T23:59:59Z \
11 -d settlementState=settled \
12 -d settlementDate=2024-07-15 \
13 -d before=2571 \
14 -d after=8516 \
15 -d limit=25

Response fields

If your request is successful, we retrieve a list of the bank transfer payments and return a response. The response contains the following fields:

Response

datalist of objectsRequired
Array of payments.
countintegerOptional
Number of results that we returned.
hasMorebooleanOptional
Indicates that further results are available.
limitintegerOptional
Maximum number of results that we return for each page.

Example response

Response
1{
2 "data": [
3 {
4 "paymentId": "M2MJOG6O2Y",
5 "processingTerminalId": "1234001",
6 "order": {
7 "amount": 4999,
8 "currency": "USD",
9 "orderId": "OrderRef6543",
10 "breakdown": {
11 "subtotal": 4347,
12 "tip": {
13 "type": "percentage",
14 "amount": 435,
15 "percentage": 10
16 },
17 "taxes": [
18 {
19 "name": "Sales Tax",
20 "rate": 5,
21 "amount": 217
22 }
23 ]
24 },
25 "dateTime": "2024-07-02T15:30:00Z",
26 "description": "Large Pepperoni Pizza"
27 },
28 "bankAccount": {
29 "type": "pad",
30 "nameOnAccount": "Sarah Hazel Hopper",
31 "accountNumber": "*******3159",
32 "transitNumber": "76543",
33 "institutionNumber": "543"
34 },
35 "transactionResult": {
36 "type": "payment",
37 "status": "ready",
38 "responseMessage": "Payment Approved",
39 "authorizedAmount": 4999,
40 "currency": "USD",
41 "responseCode": "A"
42 },
43 "customer": {
44 "notificationLanguage": "en",
45 "contactMethods": [
46 {
47 "type": "email",
48 "value": "[email protected]"
49 }
50 ]
51 }
52 },
53 {
54 "paymentId": "E29U8OU8Q4",
55 "processingTerminalId": "1234001",
56 "order": {
57 "amount": 3999,
58 "currency": "USD",
59 "orderId": "OrderRef7654",
60 "breakdown": {
61 "subtotal": 3477,
62 "tip": {
63 "type": "percentage",
64 "amount": 348,
65 "percentage": 10
66 },
67 "taxes": [
68 {
69 "name": "Sales Tax",
70 "rate": 5,
71 "amount": 174
72 }
73 ]
74 },
75 "dateTime": "2024-07-02T15:30:00Z",
76 "description": "test"
77 },
78 "bankAccount": {
79 "type": "pad",
80 "nameOnAccount": "Sarah Hazel Hopper",
81 "accountNumber": "*******7890",
82 "transitNumber": "76543",
83 "institutionNumber": "543"
84 },
85 "transactionResult": {
86 "type": "payment",
87 "status": "ready",
88 "responseMessage": "Payment Approved",
89 "authorizedAmount": 3999,
90 "currency": "USD",
91 "responseCode": "A"
92 },
93 "customer": {
94 "notificationLanguage": "en",
95 "contactMethods": [
96 {
97 "type": "email",
98 "value": "[email protected]"
99 }
100 ]
101 },
102 "customFields": [
103 {
104 "name": "yourCustomField",
105 "value": "abc123"
106 }
107 ]
108 }
109 ],
110 "count": 2,
111 "hasMore": true,
112 "limit": 2,
113 "links": [
114 {
115 "rel": "next",
116 "method": "get",
117 "href": "https://api.payroc.com/v1/bank-transfer-payments?limit=2&processingTerminalId=1234001&after=E29U8OU8Q4"
118 },
119 {
120 "rel": "previous",
121 "method": "get",
122 "href": "https://api.payroc.com/v1//bank-transfer-payments?limit=2&processingTerminalId=1234001&before=M2MJOG6O2Y"
123 }
124 ]
125}

Step 2. Reverse the bank transfer payment

To reverse a bank transfer payment, send a POST request to the Bank Transfer Payments endpoint.
If the merchant wants to reverse only part of the transaction, send the amount that they want to reverse in the amount parameter.

Request parameters

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

Path parameters

paymentIdstringRequired=10 characters
Unique identifier that our gateway assigned to the payment.

Example request

POST
/v1/bank-transfer-payments/:paymentId/reverse
1curl -X POST https://api.payroc.com/v1/bank-transfer-payments/ \
2 -H "Idempotency-Key: 8e03978e-40d5-43e8-bc93-6894a57f9324" \
3 -H "Authorization: Bearer <token>"

Response fields

If your request is successful, we reverse the bank transfer payment and return a response. The response contains the following fields:

Response

paymentIdstringRequired=10 characters
Unique identifier that we assigned to the payment.
processingTerminalIdstringRequired>=4 characters<=50 characters
Unique identifier that we assigned to the terminal.
orderobjectRequired
Object that contains information about the transaction.
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.
refundslist of objectsOptional
List of refunds issued against the payment
returnslist of objectsOptional
List of returns issued against the payment
representmentobjectOptional
Object that contains information about a payment.
customFieldslist of objectsOptional
Array of customField objects.

Example response

Response
1{
2 "paymentId": "M2MJOG6O2Y",
3 "processingTerminalId": "1234001",
4 "order": {
5 "amount": 4999,
6 "currency": "USD",
7 "orderId": "OrderRef6543",
8 "breakdown": {
9 "subtotal": 4347,
10 "tip": {
11 "type": "percentage",
12 "percentage": 10
13 },
14 "taxes": [
15 {
16 "name": "VAT",
17 "rate": 5,
18 "amount": 217
19 }
20 ]
21 },
22 "dateTime": "2024-07-02T15:30:00Z",
23 "description": "Large Pepperoni Pizza"
24 },
25 "bankAccount": {
26 "type": "pad",
27 "nameOnAccount": "Sarah Hazel Hopper",
28 "accountNumber": "*******7890",
29 "transitNumber": "76543",
30 "institutionNumber": "543"
31 },
32 "transactionResult": {
33 "type": "payment",
34 "status": "reversal",
35 "responseMessage": "Payment Approved",
36 "authorizedAmount": 4999,
37 "currency": "USD",
38 "responseCode": "A"
39 },
40 "customer": {
41 "notificationLanguage": "en",
42 "contactMethods": [
43 {
44 "type": "email",
45 "value": "[email protected]"
46 }
47 ]
48 },
49 "customFields": [
50 {
51 "name": "yourCustomField",
52 "value": "abc123"
53 }
54 ]
55}