Initiate POS Payment Transaction API

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

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

ParameterDescriptionExample
key
mandatory
String The merchant key is provided by PayU and acts as a unique identifier for a specific merchant account in PayU’s database.
Reference: For more information on how to generate the Key and Salt, refer to any of the following:

Production: Generate Production Merchant Key and Sat.

Test: Generate Test Merchant Key and Salt.
Your Test Key
api_version
optional
String The API version for this API.1
txnid
mandatory
String The transaction ID is the order reference number generated by the merchant to track a particular order. It can be used only once and PayU’s system does not accept a duplicate Transaction ID.s7hhDQVWvbhBdN
amount
mandatory
float It should contain the payment amount of the particular transaction. The amount must be greater than Rs. 8000 for the cardless EMI option.10.00
productinfo
mandatory
String It should be a string containing a brief description of the product.iPhone
email
mandatory
String The email of the customer.[email protected]
phone
mandatory
String The phone number of the customer.9876543210
surl
mandatory
String Success URL(surl) – It must contain the URL on which PayU will redirect the final response if the transaction is successful.https://apiplayground-response.herokuapp.com/
furl
mandatory
String Failure URL (furl) – It must contain the URL on which PayU will redirect the final response in case of failure.https://apiplayground-response.herokuapp.com/
pg
mandatory
String The payment method is specified in this field. For POS, specify parameter as POS.CC
bankcode
mandatory
String Each payment option is identified with a unique bank code at PayU. For POS, specify the values as POS.POS
txn_s2s_flowenumm The type of transaction flow. This field is mandatory for all types of S2S flows that drive the response types of transactions. For POS, specify the value as 4.4
firstname
mandatory
String The first name of the customer.Ashish
lastname
mandatory
String The last name of the customer.Verma
address1
optional
String The first line of the billing address.H.No- 17, Block C, Kalyan Bldg, Khardilkar Road, Mumbai
address2
optional
String The second line of the billing address.34 Saikripa-Estate, Tilak Nagar
city
optional
String The city where your customer resides as part of the billing address.Mumbai
state
optional
String The state where your customer resides as part of the billing address.Maharashtra
country
optional
String The country where your customer resides.India
zipcode
optional
String Billing address zip code is mandatory for the cardless EMI option.
Character Limit-20
400004
hash
mandatory
String It is used to avoid the possibility of transaction tampering. For more information on hash generation process for POS transaction, refer to Hash calculation.eabec285da28fd
0e3054d41a4d24fe
9f7599c9d0b6664
6f7a9984303fd612
4044b6206daf831
e9a8bda28a6200d
318293a13d6c193
109b60bd4b4f8b09
c90972
udf1
optional
String User-defined fields(udf) are used to store any information corresponding to a particular transaction. Merchants can use up to 5 udfs in the post designated as udf1, udf2, udf3, udf4, udf5. For example, you can store customer's preferred paymentPayment Preference
udf2
optional
String User-defined fields(udf) are used to store any information corresponding to a particular transaction. Merchants can use up to 5 udfs in the post designated as udf1, udf2, udf3, udf4, udf5. For example, you can store customer's preferred payment.Shipping Method
udf3
optional
String User-defined fields(udf) are used to store any information corresponding to a particular transaction. Merchants can use up to 5 udfs in the post designated as udf1, udf2, udf3, udf4, udf5. For example, you can store customer's preferred payment.Shipping Address1
udf4
optional
String User-defined fields(udf) are used to store any information corresponding to a particular transaction. Merchants can use up to 5 udfs in the post designated as udf1, udf2, udf3, udf4, udf5. For example, you can store customer's preferred payment.Shipping City
udf5
optional
String User-defined fields(udf) are used to store any information corresponding to a particular transaction. Merchants can use up to 5 udfs in the post designated as udf1, udf2, udf3, udf4, udf5. For example, you can store customer's preferred payment.Shipping Zip Code
posdeviceid
mandatory
String This parameter must include the device ID registered with PayU on which transaction needs to be initiated. If the device ID is not registered, the transaction will be marked as failed.GT002341
posexpirytime
optional
String This parameter must include the time in seconds for which the transaction is active. If empty, merchant level expiry is used. If there is no merchant level
pospaymentmethod
optional
String
This parameter must include the payment option to be enforced in the device. All possible values are:

sale: It represents card transactions.

qr: It represent QR transactions.

wallet: : It represent wallet transactions.

emi: : It represent EMI transactions.

preauth: : It represent pre-authorisation transactions.

Note: If any value apart from the above-listed values is sent, all possible payment methods on the device will be visible.
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:

FieldDescriptionExample
txnIdThis parameter contains the unique transaction ID sent by merchant in request.TXN0001
referenceIdThis parameter contains the unique ID generated by PayU.7000000001
txnStatusThis parameter contains the the status of the transaction.failed, pending
unmappedStatusThis parameter returns the status of the transaction at different stages of transaction. For more information, refer to the Unmapped Status section.pending, failure
statusCodeThis parameter returns the internal status codes of PayU.E342
messageThis parameter returns the failure message if the transaction is failed.Transaction not initiated

Unmapped status

flowParameter StatusIf SuccessfulDescription
Normal transactionpendingYesRequest is successful and transaction has been initiated.
Normal transactionfailureNoRequest 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": {}
}