Building the Payload
Configuration choices before you build the payload
Display modes
displayMode=0(Modal / iframe, default): payment UI opens in a modal overlay, hosted payment page is embedded via iframe, customer remains on your sitedisplayMode=1(Redirect): the HPP returns the checkout address instead of opening a modal. You can show that address in your own modal in an iframe, embed it directly on your page, or send the customer to it as a full-page redirect. The customer completes payment on the ZenPay hosted page, then ZenPay redirects back to yourredirectUrl
Operating modes
- Mode 0 (One-off payment): normal one-off payment. The amount you send in the payload is locked: once the HPP opens, the customer cannot change it. Start here for most integrations.
- Mode 1 (Tokenise): capture and store payment details for later reuse without charging immediately.
- Mode 2 (Custom payment): you send the amount in the payload, and the customer can change it on the hosted payment page before paying.
- Mode 3 (Preauthorisation): place a hold on funds for later capture or void.
Building the payload
Your backend returns a payload to the frontend. Your frontend should not assemble sensitive values itself.
These are the fields Mode 0 needs. The input parameters list the fields for the other modes.
| Group | Fields |
|---|---|
| HPP and security | url, merchantCode, apiKey, fingerprint, timestamp |
| Payment | merchantUniquePaymentId, paymentAmount, redirectUrl |
| Customer | customerName, customerReference, customerEmail |
| Payment methods | allowBankAcOneOffPayment, allowCardOneOffPayment, allowCardTokenisePayment, allowPayIdOneOffPayment, allowPayToOneOffPayment |
| Optional | callbackUrl (to receive a callback), mode, displayMode |
Treat customerName, customerEmail and merchantUniquePaymentId as required in every integration:
- Without
merchantUniquePaymentId, the payment page does not open. - Without
customerNameorcustomerEmail, the page opens, but the payment fails when the customer proceeds.
Card issuers are beginning to mandate customerEmail with payments.
HPP url for the environment and program selected at the top of this site: https://pay.sandbox.travelpay.com.au/Online/v5
const payment = $.zpPayment({
url,
merchantCode,
apiKey,
fingerprint,
timestamp,
mode: 0,
redirectUrl,
callbackUrl,
merchantUniquePaymentId,
customerName,
customerReference,
customerEmail,
paymentAmount,
displayMode: 0,
});
payment.init();
Generating the fingerprint
The fingerprint parameter is a SHA3-512 hash of 7 pipe-separated fields, generated server-side only:
apiKey|username|password|mode|paymentAmount|merchantUniquePaymentId|timestamp
Rules:
- All credentials are case-sensitive
paymentAmountis sent to the HPP in dollars but hashed in whole cents: multiply by 100 and drop the decimal point, so150.53hashes as15053,123.1as12310and123as12300. For Mode 2, hash0as the amount.timestampmust be UTC ISO 8601 format:YYYY-MM-DDTHH:mm:ss, with no timezone suffix and no millisecondsusernameandpasswordare used only in the hash; they are never sent in the HPP payload- Each
merchantUniquePaymentId+timestampcombination must be unique per attempt
Test your implementation with the Fingerprint Generator and the Fingerprint Validator.
Timing tip: generate the fingerprint on button press, not page load. It has a 15-minute lifespan based on its timestamp, so generating it too early risks an
E03(expired) error if the user waits before clicking Pay, or closes and reopens the modal.