# API Direct Payment

# Request Base URL

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

# EndPoints

  /trade/pay

# Request Header

Parameter Required Description
Content-Type recommend application/json
Authorization yes Basic Base64(app_id:security_key)

# Request Body (JSON format)

Parameter Type Required Max Length(or Default Value) Description
app_id string yes 32 created app's id at dashboard
timestamp string yes 19 yyyy-MM-dd HH:mm:ss
out_trade_no string yes 64 ID given by the merchant in their system
method string no 32 Payment Methods
channel string no 32 sub channel(only use at method 'Wallet')
order_currency string yes 3 BRL for brazil
order_amount decimal yes 0.01 ~ 99999999.99 request payment amount
subject string yes 128 payment reason or item title
content string no 255 payment reason detail or item detail
notify_url string yes IPN URL to merchant(start with http
buyer_id string yes merchant user's id
timeout_express string no 90m m(minutes), h(hours), d(days), c(always end in currency day)
token string no credit card token(required for CreditCard)
fingerprint string no required for CreditCard
issuer string no issuer of credit card(required for CreditCard)
installments integer no 1 installments for CreditCard
bank string no Bank Code

DepositExpress: [itau,santander,bradesco,banco-do-brasil,caixa]

Cash、BankTransfer、Khipu: get from Bank List -> bank_id
language_code string no Language Code(Cash、BankTransfer: get from Bank List -> language_code
customer.name string yes user's name
customer.email string yes user's email
customer.phone string yes user's mobile phone number
customer.identify.number string yes user's ID number
customer.identify.type string yes user's ID type
address.zip_code string yes zip code
address.state string yes state
address.city string yes city
address.street_number string yes street1 number
address.street string yes street1
address.neighborhood string no street2
user_ip string no user's IP address(required for CreditCard)

# Request Sample

curl --location --request POST 'https://gateway.pagsmile.com/trade/create' \
--header 'Authorization: Basic Base64(appid:security_key)' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "app_id",
    "content": "content",
    "method": "Boleto",
    "notify_url": "notify_url",
    "order_amount": 10,
    "order_currency": "BRL",
    "out_trade_no": "{{$randomUUID}}",
    "subject": "subject",
    "timeout_express": "1h",
    "timestamp": "{{datetime}}",
    "customer": {
      "name": "name",
      "email": "email",
	  "phone": "phone",
	  "identify": {
		"number":"number",
		"type":"type“,
	  }
      ...
    },
    "address": {
      "zip_code": "zip_code",
      ...
    },
    "user_ip": "127.0.0.1"
}'

# Http Response (JSON format)

Parameter Type Description
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 request out_trade_no
trade_no string Pagsmile trade NO.
trade_status string
pay_url string pay URL; only in Boleto、Lottery、DepositExpress
barcode string Boleto barcode;only in Boleto
qr_code string only in PIX
provider_owner string bank info : account owner; only in DepositExpress
provider_owner_document string bank info : account owner document; only in DepositExpress
provider_agency string bank info : account agency; only in DepositExpress
provider_number string bank info : account number; only in DepositExpress
bank_name string bank info : bank name; only in DepositExpress
wallet_url string only in Wallet
app_link_url string only in Wallet (for APP use)

# Return Code (Success)

{
    "code": "10000",
    "msg": "Success",
    "out_trade_no": "{out_trade_no}",
    "trade_no": "{trade_no}",
    "trade_status": "{trade_status}",
    "pay_url": "{pay_url}",
    "barcode": "{barcode}",
    "qr_code": "{qr_code}",
    "provider_owner": "{provider_owner}",
    "provider_owner_document": "{provider_owner_document}",
    "provider_agency": "{provider_agency}",
    "provider_number": "{provider_number}",
    "wallet_url": "{wallet_url}",
    "app_link_url": "{app_link_url}"
}

# Return Code (Fail)

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