For the complete documentation index, see llms.txt. This page is also available as Markdown.

Refund

This endpoint allows you to submit a full or partial refund for an eligible payin. The example below shows a PIX refund, which is returned through the original payment route. Refund availability and support for partial refunds depend on the channel used for the original payment.

POST https://gateway-test.pagsmile.com/trade/refund

A successful API response confirms that the refund request has been accepted. Use the subsequent payment status notification to determine the final refund result.

Headers

Name
Type
Required
Constraints
Description

Content-Type

string

Yes

Fixed value: application/json; charset=UTF-8.

Media type of the request body.

Authorization

string

Yes

Use Basic Base64(app_id:security_key). The App ID in the credential must match app_id in the request body.

HTTP Basic authentication credential generated with the App ID and security key.

Request Body

Name
Type
Required
Constraints
Description

app_id

string

Yes

Must match the App ID used in the Authorization header.

Merchant application ID assigned by Pagsmile.

timestamp

string

Yes

Format: yyyy-MM-dd HH:mm:ss.

Date and time when the refund request is submitted.

trade_no

string

Conditional

Either trade_no or out_trade_no must be provided. If both are provided, the API uses trade_no to locate the original payment.

Pagsmile transaction ID of the original payment.

out_trade_no

string

Conditional

Either out_trade_no or trade_no must be provided.

Merchant order number of the original payment.

out_request_no

string

Conditional

Maximum length: 255 characters. Required for a partial refund. It must be unique for each refund request and must not be the same as the original trade_no. For a full refund, the API generates a value if this field is omitted.

Merchant-defined refund request ID.

refund_currency

string

Yes

For a PIX refund, use BRL. The value must match the order currency or payment currency of the original payment.

Currency of the refund.

refund_amount

string

Yes

Numeric string. Minimum: 0.01 BRL. Supports up to two decimal places. It must not exceed the remaining refundable amount. The API-level numeric ceiling is 9,999,999,999,999.99.

Amount to refund.

refund_reason

string

No

No request-level length validation is currently applied.

Reason for requesting the refund.

Request Sample

Response

Name
Type
Required
Description

code

string

Yes

Response code. 10000 indicates that the request was accepted successfully.

msg

string

Yes

Response message.

refund_status

string

Conditional

Returned when the refund request is accepted. Current refund status returned by the refund processor, such as REFUND_PROCESSING.

sub_code

string

No

Detailed error or processing code returned when applicable.

sub_msg

string

No

Detailed error or processing message returned when applicable.

Response Sample

Last updated