Skip to content

Create Payment

Request URL

HTTP
https://{{gateway_domain}}/pg/v2/payment/create

Request Parameters

HTTP Method

POST

HTTP Header

FieldData TypeLength LimitRequiredDescription
Content-TypeStringN/AYESThis field value only supports application/json.
AcceptStringN/AYESThis field value only supports application/json.
AuthorizationStringYESAuthorization: {type} {credentials}, refer to the Signature specifications section for details.

HTTP Body

FieldData TypeLength LimitRequiredDescription
merchantTradeNoString50YESThe order number generated by the merchant. It is recommended that the merchant ensures its uniqueness.
amountString18YESAmount size: integer with 1-15 digits, with 2 decimal places, e.g., '100.05'.
currencyString3YESInternational standardized currency abbreviation, indicating the currency of the amount, refer to the country currency table.
descriptionString80YESThe order title, which may be displayed in some scenarios if the consumer sees the order information.
payerJSON ObjectYESPayer Information
payMethodJSON ObjectYESPayment Method Information
tradeEnvJSON ObjectUser Transaction Environment Information
merchantAttachString255NOIf this field is used, synchronous/asynchronous notifications and the order query api will return the field value as is.
notifyUrlString255YESWhen the order is successfully paid, the payment platform will call this URL through the background to notify the merchant.
returnUrlString255YESWhen the order is paid, if the upstream supports synchronous redirects, the payment platform will redirect the user's page to this URL.
  • The description of payer field
FieldData TypeLength LimitRequiredDescription
userIdString64YESPayer Id
nameString80YESPayer's Name
emailString80YESPayer's Email
phoneString20YESThe mobile phone number of the payer
documentTypeString20NOThe type of identification document of the payer
documentString64NOThe identification document number of the payer
  • The description of the payMethod field

    • payMethod is a dynamic parameter that contains a fixed field type, as well as different fields depending on the type
    • Please select the appropriate type parameter value according to the specified currency parameter.
currencyValid values for the type field
USD[CHECKOUT]
RUB[CHECKOUT]
INR[UPI,UPI_COLLECT,UPI_INTENT]
BRL[PIX,PIX_QRCODE]
PKR[CHECKOUT]
  • The detailed description of the payMethod parameter
FieldData TypeLength LimitRequiredDescription
typeString20YESThe value is CHECKOUT
  • The description of tradeEnv field
FieldData TypeLength LimitRequiredDescription
deviceIdString50Payer device ID
ipString32The IP address of the payer's device

Response Data

HTTP Header

FieldData TypeRequiredDescription
Content-TypeStringYESThis field value only supports application/json.
AuthorizationStringYESAuthorization: {type} {credentials}, refer to the Signature specifications section for details.

HTTP Body

FieldData TypeRequiredDescription
codeStringYES
errorMessageStringNOerror message
dataJSON ObjectNO

The description of data field

FieldData TypeRequiredDescription
paymentNoStringYESThe transaction serial number of the payment platform
merchantTradeNoStringYESThe order number generated by the merchant
amountStringYESThe amount of the order
currencyStringYESThe currency of the order
actionJSON ObjectYESVariable return field

The description of action field

TIP

The action is a variable field that returns different values depending on the payMethod.type field

JSON
{
    "action": {
        "payMethodType": "CHECKOUT",
        "url": "https://{{pg_domain}}/pg/checkout/redirect/e6df5e061d21401d8941fff14df4df09",
        "method": "GET",
        "type": "REDIRECT"
    }
}

Examples

Request

Shell
curl https://{{gateway_domain}}/pg/v2/payment/create \
  -X POST \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H 'Authorization: V2_SHA256 appId=1111b620f93b48c5904210ff47bb1111,sign=9e494e8a91bcdd08f18ad5b2cfdbfd5654f5c00c89f8216eebd7c1637b6ce01b,timestamp=1714128828114,nonce=C7CA27DC6D55DA935DFC8450C721CC99' \
  -d '{
  "merchantTradeNo": "MTU-1161",
  "amount": "1.00",
  "currency": "INR",
  "description": "payment test",
  "payer": {
    "userId": "test_id",
    "name": "testName",
    "email": "[email protected]",
    "phone": "00000000"
  },
  "payMethod": {
    "type": "CHECKOUT",
    "method": "credit_card"
  },
  "tradeEnv": {
    "ip": "127.0.0.1",
    "deviceId": "02efc74d-3988-4f0d-8cc8-0cb78bded719"
  },
  "merchantAttach": "merchant attach",
  "notifyUrl": "https://webhook.example.com/notifyurl",
  "returnUrl": "https://example.com/returnurl"
}'

Response

Shell
HTTP/1.1 200 OK
Content-Type: application/json
Server: nginx/1.18.0
Date: Mon, 06 Mar 2024 12:00:00 GMT
Authorization: V2_SHA256 appId=1111b620f93b48c5904210ff47bb1111,sign=ac6ae72f8c46f5c2092c3dab9bb0e08b6cdb6d5e7ff8ad190499a8955d57f297,timestamp=1714128245401,nonce=28FA11BF8FD1309767551B4FD8A57BD5

{
    "code": "OK",
    "errorMessage": null,
    "data": {
        "paymentNo": "20240423220624300800001097000004",
        "merchantTradeNo": "MTU-1161",
        "amount": "1.00",
        "currency": "INR",
        "action": {
            "payMethodType": "UPI",
            "type": "REDIRECT",
            "url": "https://{{pg_domain}}/pg/checkout/upi/e6df5e061d21401d8941fff14df4df09",
            "method": "GET"
        }
    }
}