payu-hosted-hash-tool
v3.1.0
Published
PayU SHA-512 hashes across 14 modes: hosted checkout, _payment v19, SI/TPV/split requests, generic API commands, reverse verification, subscription webhooks and closed-loop wallet callbacks. CLI, Node API, and web UI.
Maintainers
Readme
PayU Hosted Checkout – Hash Generator
Generate PayU SHA-512 hashes for hosted checkout and related flows. Same chains as the bundled web UI (index.html). Available as:
- CLI –
payu-hash/npx payu-hosted-hash-tool - Node.js API –
require('payu-hosted-hash-tool') - Web tool – open
index.htmlor runnpm run web
Hash modes (CLI: --mode=… or env PAYU_MODE; API: generateHashForMode(mode, params)):
| Mode | Use |
|------|-----|
| forward-udf | Hosted payment request (default): key|txnid|…|udf5||||||salt |
| forward-v19 | _payment API api_version=19 extended chain (udf1–10, user token, offer fields, cart, extra charges, phone) |
| forward-si-details | Subscriptions / SI registration (cards SI, NB SI, UPI autopay) with si_details JSON |
| forward-beneficiary-tpv | TPV – NEFT / net banking / UPI with beneficiarydetail JSON |
| forward-split-request | Split settlement request with splitRequest JSON appended after salt |
| forward-api-command | Generic API command: key|command|var1|salt (verify_payment, cancel_refund_transaction, etc.) |
| reverse-normal | Response verification (regular reverse) |
| reverse-add-charges | Reverse with additional_charges prefix |
| reverse-split | Reverse with splitInfo |
| reverse-split-add | Reverse with additional_charges and splitInfo |
| reverse-si-details | TPV autopay / subscription response with si_details |
| reverse-beneficiary | TPV response with beneficiarydetail |
| webhook-subscription | Subscriptions webhook signature (status, authpayuId, notificationType, billingAmount, …) |
| callback-pg-load-clw | Closed-loop wallet PG load callback (merchantCode, clientTxnId, loadAmount, …) |
Forward reference: PayU – Generate Hash (PayU Hosted). Subscriptions, TPV, split settlement and webhook formulas follow the chains documented in Authentication with PayU APIs and the respective product pages.
Install
npm install payu-hosted-hash-toolOr run without installing:
npx payu-hosted-hash-toolCLI usage
Default mode is forward-udf (same as v1.0).
payu-hash --key=gtKFFx --txnid=123321 --amount=100.00 --productinfo=Groceries \
--firstname="Palguna" [email protected] --salt=YOUR_SALT
# Other modes
payu-hash --mode=forward-v19 --key=… --txnid=… --amount=… --productinfo=… \
--firstname=… --email=… --salt=… \
--udf6= --udf7= --udf8= --udf9= --udf10= \
--user_token= --offer_key= --offer_auto_apply= --cart_details= --extra_charges= --phone=
payu-hash --mode=reverse-normal --salt=S --status=success \
--udf1= --udf2= --udf3= --udf4= --udf5= \
[email protected] --firstname=F --productinfo=P --amount=10 --txnid=1 --key=K
# Show the pipe-separated string (stderr)
payu-hash --key=… --salt=… --show-stringOptions
| Option | Description |
|--------|-------------|
| --mode | One of the 14 modes listed above |
| --key … --salt | Forward / v19 fields (see web tool for full list) |
| --status, --additional-charges, --split-info, --split-request | Reverse and split modes |
| --si-details, --beneficiarydetail | JSON parameters for SI / TPV modes |
| --command, --var1 | Generic API command (forward-api-command) |
| --authpayuid, --notification-type, --billing-amount, --payment-start-date, --payment-end-date, --message, --event-date | Subscription webhook fields |
| --merchant-code, --client-txn-id, --load-amount, --accosa-ref-no, --accosa-transaction-id, --response-code, --response-message, --merchant-salt | Closed-loop wallet callback fields |
| --show-string | Print concatenated string to stderr |
| -h, --help | Help |
Environment: standard PAYU_* envs for all parameters above (e.g. PAYU_SI_DETAILS, PAYU_BENEFICIARYDETAIL, PAYU_SPLIT_REQUEST, PAYU_COMMAND, PAYU_VAR1, PAYU_AUTHPAYUID, PAYU_MERCHANTCODE, …). Arguments override env.
Node.js API
const {
HASH_MODES,
generateHash,
buildHashString,
generateHashForMode,
buildHashStringForMode,
} = require('payu-hosted-hash-tool');
// Default / legacy: hosted forward (forward-udf)
const { hash, hashString } = generateHash(
{
key: 'gtKFFx',
txnid: '123321',
amount: '100.00',
productinfo: 'Groceries',
firstname: 'Palguna',
email: '[email protected]',
udf1: '',
},
'YOUR_SALT'
);
// Any mode: flat params object (keys match CLI / README)
const rev = generateHashForMode('reverse-normal', {
salt: 'S',
status: 'success',
udf1: '',
udf2: '',
udf3: '',
udf4: '',
udf5: '',
email: '[email protected]',
firstname: 'F',
productinfo: 'P',
amount: '10',
txnid: '1',
key: 'K',
});HASH_MODES– array of allowed mode stringsgenerateHash(params, salt)/buildHashString(params, salt)–forward-udfonly (backward compatible)generateHashForMode(mode, params)/buildHashStringForMode(mode, params)– all modes;paramsmust includesaltwhere the formula uses it
Web tool
- Open
index.html, or from the package directory:npm run web→ http://localhost:8080 - Deploy the folder (e.g. Netlify) for a shared URL. Publishing to npm does not update a Netlify site—redeploy the static site separately.
Security
- Production: Generate hashes on your server. Never expose salt to the client or in the payment POST body.
- CLI and web UI are for integration and debugging.
License
MIT
