Skip to main content
Version: 1.0.0

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 site
  • displayMode=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 your redirectUrl

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.

GroupFields
HPP and securityurl, merchantCode, apiKey, fingerprint, timestamp
PaymentmerchantUniquePaymentId, paymentAmount, redirectUrl
CustomercustomerName, customerReference, customerEmail
Payment methodsallowBankAcOneOffPayment, allowCardOneOffPayment, allowCardTokenisePayment, allowPayIdOneOffPayment, allowPayToOneOffPayment
OptionalcallbackUrl (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 customerName or customerEmail, 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
  • paymentAmount is sent to the HPP in dollars but hashed in whole cents: multiply by 100 and drop the decimal point, so 150.53 hashes as 15053, 123.1 as 12310 and 123 as 12300. For Mode 2, hash 0 as the amount.
  • timestamp must be UTC ISO 8601 format: YYYY-MM-DDTHH:mm:ss, with no timezone suffix and no milliseconds
  • username and password are used only in the hash; they are never sent in the HPP payload
  • Each merchantUniquePaymentId + timestamp combination 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.