Refund

MethodRefund TypeRequire user_infoRequire bank_info

Pix

Refund to original source

N/A (Refund to original source)

N/A (Refund to original source)A

Boleto

Refund through banktransfer

Require

Not Require. System will send email to user when bank_info is empty

Lottery

Refund through banktransfer

Require

Not Require. System will send email to user when bank_info is empty

SPEI

Refund through SPEI banktransfer

Require

Require

Wallet

Refund to original source

N/A (Refund to original source)

N/A (Refund to original source)

CreditCard

Refund to original source

N/A (Refund to original source)

N/A (Refund to original source)

Request Base URL

  Test Environment : https://gateway-test.pagsmile.com
  Prod Environment : https://gateway.pagsmile.com

EndPoints

  /trade/refund

Request Header

ParameterRequiredDescription

Content-Type

Recommended

Application/json

Authorization

Yes

Basic Base64(app_id:security_key)

Request Body (JSON format)

ParameterTypeRequiredMax Length(or Default Value)Description

app_id

string

yes

32

App's ID is in dashboard

timestamp

string

yes

19

yyyy-MM-dd HH:mm:ss

trade_no

string

yes

64

Pagsmile trade NO.(can NOT be empty with out_trade_no at same time)

out_trade_no

string

yes

64

ID given by the merchant in their system (can NOT be empty with trade_no at same time)

out_request_no

string

no

16

refund request unique NO.(can NOT be empty when request a partial refund)

refund_currency

string

yes

3

refund_amount

decimal

yes

0.01 ~ 99999999999999.99

refund_reason

string

no

128

user_info.identify.number

string

yes (not require for PIX, Wallet and CreditCard)

16

User ID

user_info.identify.type

string

no

16

User's ID type

user_info.name

string

yes (not require for PIX, Wallet and CreditCard)

64

User's name

user_info.email

string

yes (not require for PIX, Wallet and CreditCard)

64

User's email

user_info.phone

string

no

64

User's phone

bank_info.bank_id

string

no (required for SPEI)

64

User's bank ID. Check here

bank_info.bank_name

string

no (required for SPEI)

64

User's bank name to receive the refund

bank_info.agency

string

no

64

User's bank agency to receive the refund

bank_info.type

string

no

64

User's bank type to receive the refund

bank_info.number

string

no (required for SPEI)

64

User's bank number to receive refund. For SPEI refund, fill CLABE number.

Request Sample

curl --location --request POST 'https://gateway.pagsmile.com/trade/refund' \
--header 'Authorization: Basic Base64(appid:security_key)' \
--header 'Content-Type: application/json' \
--data-raw '{
    * "app_id": "app_id",
    * "timestamp": "",
    * "content": "content",
      "trade_no": "trade_no", //Require when "out_trade_no" is empty
      "out_trade_no": "", //Require when "trade_no" is empty
      "out_request_no": "", //Require for partial refund
    * "refund_amount": 10,
    * "refund_currency": "BRL",
      "out_trade_no": "{{$randomUUID}}",
      "user_info": {
          "identify": {
              "number": "**********",
              "type": "document type"
          },
          "name": "refund name",
          "email": "refund@email.com" //If bank_info is empty, system will send email to this address to collect bank_info
      },
      "bank_info": {
          "bank_id": "****",
          "bank_name": "bank name",
          "number": "**********"
      }
}'

Http Response (JSON format)

ParameterTypeDescription

code

string

Return code

msg

string

Return msg

sub_code

string

Return sub code(only error)

sub_msg

string

Return sub msg(only error)

out_trade_no

string

trade_no

string

refund_currency

string

refund_amount

decimal

refund_status

string

Return Sample (Success)

{
    "code": "10000",
    "msg": "Success",
    "out_trade_no": "{out_trade_no}",
    "trade_no": "{trade_no}",
    "refund_currency": "{refund_currency}",
    "refund_amount": "{refund_amount}",
    "refund_status": "{refund_status}"
}

Return Sample (Fail)

{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "invalid-signature",
    "sub_msg": "invalid signature"
}

Last updated