Merchant Token Generator
Generate SHA-256 merchant tokens for Nicepay payment gateway. Supports registration, payment, cancel, and inquiry API endpoints.
About
Payment gateway API authentication relies on hash-based message verification. A malformed merchant token causes transaction rejection, failed refunds, or silent payment capture errors that surface only during reconciliation. This tool computes the SHA-256 digest of concatenated parameters - timeStamp, iMid, referenceNo, amt, and merchantKey - matching the Nicepay V2 specification. The hash is produced via the native Web Crypto API, not a polyfill. Parameter order is rigid: transposing iMid and referenceNo yields a completely different digest. This tool assumes UTC+7 (WIB) timestamp convention unless overridden. It does not validate whether your iMid is sandbox or production - that distinction is yours to track.
Formulas
The merchant token is a SHA-256 cryptographic hash of a concatenated input string. The concatenation order is fixed and must not be altered.
Where timeStamp = transaction timestamp in YYYYMMDDHHmmss format (14 digits), iMid = merchant ID assigned by Nicepay (e.g., IONPAYTEST), referenceNo = unique merchant order reference, amt = transaction amount as a string with no decimal separators (e.g., 10000), and merchantKey = secret key provided by Nicepay. The output is a 64-character lowercase hexadecimal string. The digest function maps an arbitrary-length input to a fixed 256-bit output. Changing a single character in any parameter produces a completely different hash due to the avalanche property of SHA-256.
Reference Data
| API Operation | Token Formula | Required Parameters | HTTP Method | Endpoint Path |
|---|---|---|---|---|
| Registration | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/direct/v2/registration |
| Payment | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/direct/v2/payment |
| Cancel / Void | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/direct/v2/cancel |
| Inquiry (Check Status) | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/direct/v2/inquiry |
| Notification (Push) | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST (callback) | Your callback URL |
| VA Registration | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/direct/v2/registration |
| E-Wallet | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/direct/v2/registration |
| Payout | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/api/direct/v2/requestPayout |
| QRIS | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/direct/v2/registration |
| Convenience Store | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/direct/v2/registration |
| Credit Card 3DS | SHA256(timeStamp + iMid + referenceNo + amt + merchantKey) | timeStamp, iMid, referenceNo, amt, merchantKey | POST | /nicepay/direct/v2/registration |