Create Payment
Request URL
HTTP
https://{{gateway_domain}}/pg/v2/payment/createRequest Parameters
HTTP Method
POST
HTTP Header
| Field | Data Type | Length Limit | Required | Description |
|---|---|---|---|---|
| Content-Type | String | N/A | YES | This field value only supports application/json. |
| Accept | String | N/A | YES | This field value only supports application/json. |
| Authorization | String | YES | Authorization: {type} {credentials}, refer to the Signature specifications section for details. |
HTTP Body
| Field | Data Type | Length Limit | Required | Description |
|---|---|---|---|---|
| merchantTradeNo | String | 50 | YES | The order number generated by the merchant. It is recommended that the merchant ensures its uniqueness. |
| amount | String | 18 | YES | Amount size: integer with 1-15 digits, with 2 decimal places, e.g., '100.05'. |
| currency | String | 3 | YES | International standardized currency abbreviation, indicating the currency of the amount, refer to the country currency table. |
| description | String | 80 | YES | The order title, which may be displayed in some scenarios if the consumer sees the order information. |
| payer | JSON Object | YES | Payer Information | |
| payMethod | JSON Object | YES | Payment Method Information | |
| tradeEnv | JSON Object | User Transaction Environment Information | ||
| merchantAttach | String | 255 | NO | If this field is used, synchronous/asynchronous notifications and the order query api will return the field value as is. |
| notifyUrl | String | 255 | YES | When the order is successfully paid, the payment platform will call this URL through the background to notify the merchant. |
| returnUrl | String | 255 | YES | When 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
| Field | Data Type | Length Limit | Required | Description |
|---|---|---|---|---|
| userId | String | 64 | YES | Payer Id |
| name | String | 80 | YES | Payer's Name |
| String | 80 | YES | Payer's Email | |
| phone | String | 20 | YES | The mobile phone number of the payer |
| documentType | String | 20 | NO | The type of identification document of the payer |
| document | String | 64 | NO | The 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.
| currency | Valid 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
| Field | Data Type | Length Limit | Required | Description |
|---|---|---|---|---|
| type | String | 20 | YES | The value is CHECKOUT |
- The description of tradeEnv field
| Field | Data Type | Length Limit | Required | Description |
|---|---|---|---|---|
| deviceId | String | 50 | Payer device ID | |
| ip | String | 32 | The IP address of the payer's device |
Response Data
HTTP Header
| Field | Data Type | Required | Description |
|---|---|---|---|
| Content-Type | String | YES | This field value only supports application/json. |
| Authorization | String | YES | Authorization: {type} {credentials}, refer to the Signature specifications section for details. |
HTTP Body
| Field | Data Type | Required | Description |
|---|---|---|---|
| code | String | YES | |
| errorMessage | String | NO | error message |
| data | JSON Object | NO |
The description of data field
| Field | Data Type | Required | Description |
|---|---|---|---|
| paymentNo | String | YES | The transaction serial number of the payment platform |
| merchantTradeNo | String | YES | The order number generated by the merchant |
| amount | String | YES | The amount of the order |
| currency | String | YES | The currency of the order |
| action | JSON Object | YES | Variable 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"
}
}
}