Refund API
Refund API is used to request a refund, according to the flow below:
Work Flow
How it Works
- Merchant requests refund to PagSeguro
- PagSeguro receives the data and returns the refund identifier to the Merchant
- PagSeguro processes the data transferred by the Merchant
- PagSeguro notifies the Merchant with the status of the transaction change
- Merchant receives notification and updates order status as described in the Notify API topic
To identify whether the transaction is refundable, you can check through the query, the “refundable” parameter indicates whether the payment can be refunded. The other way is to validate which methods are refundable by PagSeguro, check the list of payment methods available by country.
Refund API URL for Production
https://api.international.pagseguro.com/v3/transactions/{transaction_code}/refunds
Method: POST
Refund API URL for Sandbox
https://api.sandbox.international.pagseguro.com/v3/transactions/{transaction_code}/refunds
Method: POST
Request
- To perform authentication, use the default authentication method defined in Authentication Section.
- Use Content-Type header with the value "application/json".
Query parameter list:
Parameters | Description | Type | Validation | Errors | Mandatory |
---|---|---|---|---|---|
transaction_code | Transaction code UUID, uppercase formatted with hyphens/dashes | String | - | - | Yes |
Body parameter list:
Parameters | Description | Type | Validation | Errors | Mandatory |
---|---|---|---|---|---|
notification_url | URL (must bind ports 80 or 443) used to send transaction status change notifications by HTTP | String | A Valid URL, Max. 200 | [*] | Yes |
amount | Amount to be refunded. If not sent, the refund will be processed for the entire value of the transaction | Float | Min. 0.01, Max. transaction amount | [*] | No. Default: transaction amount |
reference | Merchant reference | String | Max. 50 | [*] | No |
Example
To refund a transaction, make a POST request as an example.
Example URL:
https://api.international.pagseguro.com/v3/transactions/00EEE57E-2DCA-4580-A33C-76D9773C9808/refunds
{
"notification_url": "https://www.merchantwebsite.com/notify?type=refund",
"amount": 101.1,
"reference": "REF-XXX-1234567890"
}
Response
Parameters | Description | Type | Details | Details |
---|---|---|---|---|
id | Refund identifier | String | String | - |
reference | Merchant reference | String | String | - |
amount | Amount to be refunded | Float | Float | - |
status | Refund status | String | String | [*] |
created_at | Refund creation date in Coordinated Universal Time (UTC) | UTC DateTime | UTC DateTime | - |
updated_at | Refund last update date in Coordinated Universal Time (UTC) | UTC DateTime | UTC DateTime | - |
Example
Status 201 Created
{
"id": 35,
"reference": "REF-XXX-1234567890",
"amount": 100.1,
"status": "requested",
"created_at": "2021-04-12T11:16:55Z",
"updated_at": "2021-04-12T11:16:55Z"
}
Refund Status
Refund status returned by PagSeguro:
Name | Description |
---|---|
REQUESTED | Refund requested by Customer. |
PROCESSING | Refund in process. |
PROCESSED | Refund successfully completed. |
REJECTED | Refund was rejected. |
Updated over 1 year ago