Hosted Payment Page

The hosted payment page allows integrators to create customers payment method in a secure manner.

1. Create a Hosted Payment Page

What each field means when building the hosted payment page address:




Can either be the "Authentication Token" (used when calling the API's
generate a hosted payment page authentication token.


Will add the country code the merchant is in:
a) AU,
b) NZ,
c) SG,
d) PH,
e) TH,
f) MY


Depending on what is allowed in the region. Example for SG and MY, this regions can only accept Credit Card transactions.

Below is the payment method type possible:

By Default, if the "paymentMethods" were not provided, it will automatically load the hosted payment page with the payment method type available for that region.

[Highly Suggested] merchantId

[Update as of 15th of June 2022]
Providing the merchant id, what is agreed between the merchant and Ezypay (regarding what payment method options is available), the hosted payment page will reflex the agreement.

If merchant A choose not to allow AMEX card transactions, providing the merchant Id as part of the condition will remove the option to add AMEX card as part of the payment option.

Merchant ID.
example : 81d62b7c-e7d4-11ec-8fea-0242ac120002

[Optional] mandateTypeId

Integrators do not need to provide the "mandateTypeId" for now, however this is schedule for change in the near future.

Mandate Type ID
example : ba3039d6-e7d4-11ec-8fea-0242ac120002


PayTO Integration (Only available in Australia)

merchantId and mandateTypeId are newly introduced fields to support PayTo Payment Methods. In order to support the PayTo payment methods, it is mandatory to provide the merchantId in the URL.

Integrator will add this page into an in their front-end code.

The page URL added into <Iframe> will be:{{HostedPaymentToken}}&countryCode={AU,NZ,SG,PH,TH,MY}&paymentMethods={BANK,VISA,MASTERCARD,AMEX}

[Update as of the 15th of June 2022]{{HostedPaymentToken}}&countryCode={AU,NZ,SG,PH,TH,MY}&merchantId={merchantId}&paymentMethods={BANK,VISA,MASTERCARD,AMEX}

**Javascript code sample**
<script type="text/javascript">

$("iframe").attr("src", "" + authenticationTok + "&countryCode=" + region + "&pageType=customer"); 


HTML code sample

<iframe id="payment-frame" style="border: 0; width: 800px; height:620px"></iframe>

Sample on how the hosted payment page looks like:

2. Submit the form once it has been filled up

Ezypay will return the newly created Payment Method Token data once the hosted payment page is submitted back to Ezypay.

<script type="text/javascript">

//Triggered by the button
 function sendPayment(e, type)
                var hostedpage = "";
                var receiver = document.getElementById('payment-frame').contentWindow;
                receiver.postMessage({ actionType: type }, hostedpage);

            $("#PostPaymentMethod").click(function (e) {
                sendPayment(e, 'create');

            function retrivePaymentTokenCreated(e) {
                window.addEventListener('message', function (e) {
                    var response = JSON.parse(;

                    if ( {
                        $("#PaymentMethodResponse").text("Payment Method Token: " + + " with Type Account: " +;
                    if (response.error) {
                        $("#PaymentMethodResponse").text("Error occured");


Did this page help you?