The Initiate POS Payment Transaction API is used to initiate a transaction on the POS terminal. This API is rate limited for each merchant and needs to be a server-to-server curl call request
Environments
Environment | URL |
---|---|
Test | https://test.payu.in//_payment |
Production | https://secure.payu.in/_payment |
Generate hash
The hash string can be generated using the SHA512 algorithm on the below logic. All fields are separated using the pipe (|) operator.
<valueOf(key)>|<valueOf(txnid)>|<valueOf(amount)>|<valueOf(productinfo)>|<valueOf(firstname)>|<valueOf(email)>|<valueOf(udf1)>|<valueOf(udf2)>|<valueOf(udf3)>|<valueOf(udf4)>|<valueOf(udf5)>||||||<valueOf(salt)>
Callouts
- Empty pipe values are deprecated values.
- Here, SALT (to be provided by PayU), key, txnid, amount, productinfo, firstname, and email are mandatory parameters and hence cannot be empty in the hash calculation above.
- udf1-udf5 are optional. For example, if you are not posting any/all of the udf parameters in the API request, then in the hash calculation, the respective udf field should be left empty.
Request parameters
Parameter | Description | Example |
---|---|---|
key
|
| Your Test Key |
api_version |
| 1 |
txnid |
| s7hhDQVWvbhBdN |
amount |
| 10.00 |
productinfo |
| iPhone |
email |
| |
phone |
| 9876543210 |
surl |
| |
furl |
| |
pg |
| CC |
bankcode |
| POS |
txn_s2s_flow |
| 4 |
firstname |
| Ashish |
lastname |
| Verma |
address1 |
| H.No- 17, Block C, Kalyan Bldg, Khardilkar Road, Mumbai |
address2 |
| 34 Saikripa-Estate, Tilak Nagar |
city |
| Mumbai |
state |
| Maharashtra |
country |
| India |
zipcode |
| 400004 |
hash |
| eabec285da28fd 0e3054d41a4d24fe 9f7599c9d0b6664 6f7a9984303fd612 4044b6206daf831 e9a8bda28a6200d 318293a13d6c193 109b60bd4b4f8b09 c90972 |
udf1 |
| Payment Preference |
udf2 |
| Shipping Method |
udf3 |
| Shipping Address1 |
udf4 |
| Shipping City |
udf5 |
| Shipping Zip Code |
posdeviceid |
| GT002341 |
posexpirytime |
| |
pospaymentmethod | String
| emi |
Sample request
curl --location --request POST 'https://secure.payu.in//_payment' \
--form 'key="J****g"' \
--form 'hash="bb2049c669b678f183d0bc48c450e70998924fbbe59e891117bb67edceafdae2245e6cef0a800560d3642c348ccf58e44de42333e35fb3d04145b1b6b241dc5e"' \
--form 'posdeviceid="G2004T26603"' \
--form 'txnid="pos148"' \
--form 'amount="500"' \
--form 'posexpirytime="3600 "' \
--form 'firstname="sai "' \
--form 'lastname="krishna"' \
--form 'email="[email protected] "' \
--form 'phone="9999999999"' \
--form 'address1="santiago bernabeu, madrid, spain"' \
--form 'city="madrid"' \
--form 'zipcode="28000"' \
--form 'udf3="sample 3"' \
--form 'udf4="sample 4"' \
--form 'udf5="sample 5"' \
--form 'udf1="sample 1"' \
--form 'udf2="sample 2"' \
--form 'pg="POS"' \
--form 'bankcode="POS"' \
--form 'productinfo="Integrated POS"' \
--form 'surl="www.payu.in "' \
--form 'furl="www.payu.in"' \
--form 'posenforcemethod="sale"' \
--form 'txn_s2s_flow="4"' \
--form 'additional_charges="POS:50"'
Response parameters
The metadata parameter in the response contains the following fields:
Field | Description | Example |
---|---|---|
txnId | This parameter contains the unique transaction ID sent by merchant in request. | TXN0001 |
referenceId | This parameter contains the unique ID generated by PayU. | 7000000001 |
txnStatus | This parameter contains the the status of the transaction. | failed, pending |
unmappedStatus | This parameter returns the status of the transaction at different stages of transaction. For more information, refer to the Unmapped Status section. | pending, failure |
statusCode | This parameter returns the internal status codes of PayU. | E342 |
message | This parameter returns the failure message if the transaction is failed. | Transaction not initiated |
Unmapped status
flow | Parameter Status | If Successful | Description |
---|---|---|---|
Normal transaction | pending | Yes | Request is successful and transaction has been initiated. |
Normal transaction | failure | No | Request is not successful and Transaction is failed. |
Sample response
{
"metaData": {
"message": null,
"referenceId": "39679eb1408864fc5d26b4aaae5c69cf0e633108168442c548c317ff5cfd7239",
"statusCode": null,
"txnId": "454672833901",
"txnStatus": "pending",
"unmappedStatus": "pending"
},
"result": {
"acsTemplate": "PGh0bWw+PGJvZHk+PGZvcm0gbmFtZT0icGF5bWVudF9wb3N0IiBpZD0icGF5bWVudF9wb3N0IiBhY3Rpb249IiIgbWV0aG9kPSJwb3N0Ij48L2Zvcm0+PHNjcmlwdCB0eXBlPSd0ZXh0L2phdmFzY3JpcHQnPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Lm9ubG9hZD1mdW5jdGlvbigpewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmZvcm1zWydwYXltZW50X3Bvc3QnXS5zdWJtaXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgPC9zY3JpcHQ+PC9ib2R5PjwvaHRtbD4="
}
}
{
"
""metaData":{
"
""message":"Transaction not initiated",
"
""referenceId":"39679eb1408864fc5d26b4aaae5c69cf08b672ec877f06e9f41668e3a5e6eb30",
"
""statusCode":"E342",
"
""txnId":"454672833999",
"
""txnStatus":"failed",
"
""unmappedStatus":"failure""
"
},
"
""result":{
}"
"
}
{
"metaData": {
"message": "Merchant Integration Exception occurred",
"referenceId": "78a03c334c2b487ed65758a197702386967b81a26581af15be45b3063355cc45",
"statusCode": "EX158",
"txnId": "pos148",
"txnStatus": "failed",
"unmappedStatus": "failure"
},
"result": {}
}
{
"
""metaData":{
"
""message":"Transaction not initiated",
"
""referenceId":"39679eb1408864fc5d26b4aaae5c69cf08b672ec877f06e9f41668e3a5e6eb30",
"
""statusCode":"E342",
"
""txnId":"454672833999",
"
""txnStatus":"failed",
"
""unmappedStatus":"failure""
"
},
"
""result":{
}"
"
}
{
"metaData": {
"message": "Invalid PG & Bank Code Combination",
"referenceId": "78a03c334c2b487ed65758a197702386967b81a26581af15be45b3063355cc45",
"statusCode": "E1101",
"txnId": "pos148",
"txnStatus": "failed",
"unmappedStatus": "failure"
},
"result": {}
}