Non-Seamless Debit Transaction API

The Non-Seamless Debit Transaction API allows you to debit funds from a wallet using a non-seamless integration approach. This API requires user interaction and redirection through a payment interface for transaction authorization.

Environment

EnvironmentURL
Testhttps://test.payu.in/_payment
Productionhttps://secure.payu.in/_payment

HTTP Method: POST

Request Headers

ParameterDescription
Content-Type
mandatory
String application/x-www-form-urlencoded

Request Parameters

Body Parameters

The request body is sent as form-encoded parameters.

Parameter Description Example
txnId
mandatory
String Unique transaction ID generated by the merchant RAM1234
key
mandatory
String Merchant's identifier key provided by PayU KOEfPI
productinfo
mandatory
String Information about the product or service iPhone
customer_id
optional
Numeric Unique customer ID from merchant's system 89342546
walleturn
optional
Numeric Wallet reference number (URN) 70000000008
firstName
mandatory
String Customer's first name Ravi
lastName
optional
String Customer's last name Kumar
phone
mandatory
Numeric Customer's mobile number with country code 919988776655
email
mandatory
String Customer's email address [email protected]
ws_online_response
mandatory
String Callback URL for successful transactions https://merchant.com/success
ws_failure_response
mandatory
String Callback URL for failed transactions https://merchant.com/failure
amount
mandatory
Numeric Amount to debit in implied decimals (₹41.00 → 4100) 4100
pg
mandatory
String Payment gateway constant (set to 'CLW') CLW
hash
mandatory
String SHA512 hash for request validation 6e640b...

📘

Note: Either customer_id or walleturn must be provided to identify the wallet.

Hash Calculation

The hash is calculated using SHA512 with the following string:

key|txnId|amount|productinfo|firstName|email|||||||||||||{salt}

Response Parameters

ParameterDescriptionExample
mihpayidUnique PayU-generated transaction reference number1735903830180094
modePayment method usedCLW
statusTransaction status (success, failure, pending)success
keyMerchant's key (echoed back)KOEfPI
txnidTransaction ID (echoed back)RAM1234
amountTransaction amount41.00
net_amount_debitNet amount debited from the wallet41.00
productinfoProduct information (echoed back)iPhone
firstnameCustomer's first nameRavi
lastnameCustomer's last nameKumar
emailCustomer's email[email protected]
phoneCustomer's phone number919988776655
addedonTransaction date and time2025-01-13 18:24:06
hashResponse hash for verificationabc123...
PG_TYPEPayment gateway typeCLW
errorError message (if transaction failed)Insufficient balance
error_MessageDetailed error descriptionWallet balance is insufficient

Sample Request

curl --location --request POST 'https://test.payu.in/_payment' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'key=KOEfPI' \
--data-urlencode 'txnid=RAM1234' \
--data-urlencode 'amount=41.00' \
--data-urlencode 'productinfo=iPhone' \
--data-urlencode 'firstname=Ravi' \
--data-urlencode '[email protected]' \
--data-urlencode 'phone=919988776655' \
--data-urlencode 'ws_online_response=https://merchant.com/success' \
--data-urlencode 'ws_failure_response=https://merchant.com/failure' \
--data-urlencode 'pg=CLW' \
--data-urlencode 'walleturn=70000000008' \
--data-urlencode 'hash=6e640b...'

Sample Response

Successful Transaction

{
  "mihpayid": "1735903830180094",
  "mode": "CLW",
  "status": "success",
  "key": "KOEfPI",
  "txnid": "RAM1234",
  "amount": "41.00",
  "net_amount_debit": "41.00",
  "productinfo": "iPhone",
  "firstname": "Ravi",
  "lastname": "Kumar",
  "email": "[email protected]",
  "phone": "919988776655",
  "addedon": "2025-01-13 18:24:06",
  "hash": "def456ghi789...",
  "PG_TYPE": "CLW"
}

Failed Transaction

{
  "mihpayid": "1735903830180095",
  "mode": "CLW",
  "status": "failure",
  "key": "KOEfPI",
  "txnid": "RAM1235",
  "amount": "41.00",
  "productinfo": "iPhone",
  "firstname": "Ravi",
  "lastname": "Kumar",
  "email": "[email protected]",
  "phone": "919988776655",
  "error": "Insufficient balance",
  "error_Message": "Wallet balance is insufficient for this transaction",
  "hash": "xyz789abc123..."
}

HTTP Status Codes

Status CodeDescription
200OK - Request processed successfully
400Bad Request - Invalid request parameters
401Unauthorized - Authentication failed
500Internal Server Error

Transaction Flow

  1. Initiate Transaction: Send a POST request with all required parameters
  2. User Redirection: User is redirected to PayU's payment interface for authorization
  3. User Authorization: User confirms the transaction on the payment page
  4. Callback: PayU sends the result to either ws_online_response or ws_failure_response
  5. Verification: Use the response hash to verify the authenticity of the callback

Difference from Seamless Debit

FeatureNon-SeamlessSeamless
User InteractionRequires redirection and user authorizationNo user interaction required
FlowManual redirection through PayU interfaceDirect server-to-server communication
Callback URLsUses ws_online_response and ws_failure_responseUses different callback mechanism
User ExperienceMore friction due to redirectionSmoother, no redirection
Use CaseConsumer-facing transactions requiring authorizationBackend transactions or auto-debit scenarios

Best Practices

  1. Hash Security: Protect your salt key and never expose it in client-side code
  2. Callback Handling: Implement proper callback URL handlers for success and failure scenarios
  3. Transaction Verification: Always verify the response hash for authenticity
  4. Error Handling: Implement comprehensive error handling for different failure scenarios
  5. User Experience: Provide clear messaging during the redirection flow
  6. Reconciliation: Use the enquiry API to verify final transaction status

Common Error Scenarios

ErrorDescriptionSolution
Insufficient balanceWallet doesn't have enough fundsAsk customer to load wallet first
Invalid walletCustomer ID or wallet URN not foundVerify customer details
Transaction limit exceededAmount exceeds allowed limitsCheck transaction limits
Wallet blockedCustomer wallet is temporarily blockedContact support
Hash mismatchInvalid hash in requestVerify hash calculation

Security Considerations

  1. Use HTTPS for all API communications
  2. Validate all input parameters before processing
  3. Implement rate limiting to prevent abuse
  4. Store sensitive data securely
  5. Monitor for suspicious transaction patterns
  6. Implement proper logging for audit trails
Ask AI Beta

Hi! I am an AI Assistant. Ask me about PayU and get help with your integration.
Responses are generated by AI, may contain some mistakes.

EXAMPLE QUESTIONS