Create referenced refund
Use this method to refund a bank transfer payment that is in a closed batch.
To refund a bank transfer payment, you need its paymentId. Our gateway returned the paymentId in the response of the [Create Payment](https://docs.payroc.com/api/schema/bank-transfer-payments/payments/create) method.
**Note:** If you don’t have the paymentId, use our [List Payments](https://docs.payroc.com/api/schema/bank-transfer-payments/payments/list) method to search for the bank transfer payment.
If your refund is successful, our gateway returns the payment amount to the customer's account.
**Things to consider**
- If the merchant refunds a bank transfer payment that is in an open batch, our gateway reverses the bank transfer payment.
- Some merchants can run unreferenced refunds, which means that they don’t need a paymentId to return an amount to a customer. For more information about how to run an unreferenced refund, go to [Create Refund](https://docs.payroc.com/api/schema/bank-transfer-payments/refunds/create).
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.
Path parameters
paymentId
Unique identifier that our gateway assigned to the payment.
Headers
Idempotency-Key
Unique identifier that you generate for each request. You must use the [UUID v4 format](https://www.rfc-editor.org/rfc/rfc4122) for the identifier. For more information about the idempotency key, go to [Idempotency](https://docs.payroc.com/api/idempotency).
Request
This endpoint expects an object.
amount
Total amount of the refund. The value is in the currency's lowest denomination, for example, cents.
description
Description of the refund.
Response
Successful request. We refunded the payment.
paymentId
Unique identifier that we assigned to the payment.
processingTerminalId
Unique identifier that we assigned to the terminal.
order
Object that contains information about the transaction.
bankAccount
Object that contains information about the bank account.
transactionResult
Object that contains information about the transaction.
customer
Object that contains information about the customer.
refunds
List of refunds issued against the payment.
returns
List of returns issued against the payment.
representment
List of re-presented payments linked to the return.
customFields
Array of customField objects.