Session configure()

configure()

The configure( ) function allows you to configure Hosted Session interactions. You can choose to collect the payment details either using proxy card fields hosted by ANZ eGate payment gateway and rendered within an iFrame, or through a digital wallet interaction.


Usage Copied to clipboard

PaymentSession.configure(configuration)


Example Copied to clipboard

PaymentSession.configure({
    fields: {
        // Attach hosted fields to your payment page
        cardNumber: "#card-number",
        securityCode: "#security-code",
        expiryMonth: "#expiry-month",
        expiryYear: "#expiry-year"
    },
    frameEmbeddingMitigation: ["javascript", "x-frame-options", "csp"],
    callbacks: {
        initialized: function(response) {
            //handle initialization response
            if(response.status === "ok") {
                // ...
            } else if (response.status === "system_error") {
                console.log(response.message);
            }
        },
        formSessionUpdate: function(response) {
            //handle session update response
        },
        visaCheckout: function(response) {
            //handle Visa Checkout response
        }
    },
    order: {
        amount: 10.00,
        currency: "AUD"
    },
    wallets: {
        visaCheckout: {
            enabled: true
            // Add Visa Checkout API specific attributes here
            countryCode: "AU",
            displayName: "Display name",
            locale: "en_au",
            logoUrl: "http://logo.logo",
            payment: {
                cardBrands: [
                    "VISA"
                ]
            },
            review: {
                buttonAction: "Pay",
                message: "Message"
            },
            shipping: {
                acceptedRegions: [
                    "AU"
                ],
                collectShipping: true
            }
        }
    }
})
  

Arguments Copied to clipboard

configuration Copied to clipboard Object

The object parameter to specify the configuration for the Hosted Session interaction.

session Copied to clipboard String

The unique identifier for the session. If you do not provide a sessionID the client library creates one.

fields Copied to clipboard Object

An object containing selectors for the card fields you want to replace with the corresponding proxy fields, which are hosted by ANZ eGate payment gateway and rendered within an iFrame. The proxy fields will have the same look and feel as the replaced fields.

cardNumber Copied to clipboard String

A selector for the card number field.

securityCode Copied to clipboard String

A selector for the security code field.

expiryMonth Copied to clipboard String

A selector for the expiry month field.

expiryYear Copied to clipboard String

A selector for the expiry year field.

frameEmbeddingMitigation Copied to clipboard String REQUIRED

Specifies the mitigation option(s) for clickjacking prevention. For more information, see Implementing a Hosted Session Integration.

formatCard Copied to clipboard Enum

If set to true, this field controls the formatting and the validation of input in the hosted Card Number field provided by Hosted Session. By default, this field is set to false.

  • American Express Cards: input will display in the standard American Express card number format of 4 6 5 (for example, 9999 999999 99999)
  • all other cards: input will display in the standard 4 4 4 4 card number format (for example, 9999 9999 9999 9999 999)

Only numbers are accepted in the hosted Card Number field.

wallets Copied to clipboard Object

An object containing the configuration for a wallet interaction. Currently, you can only initiate a Visa Checkout interaction.

visaCheckout Copied to clipboard Object

An object containing configuration for a Visa Checkout wallet interaction. See Visa Checkout integration guidelines on how to retrieve the payment details from a Visa Checkout interaction.

enabled Copied to clipboard Boolean

Set this to true if you wish to enable Visa Checkout wallet. By default, the value is set to false.

order Copied to clipboard Object

An object containing order data required for the wallet interaction. Optionally, you can provide this order data in the session.

amount Copied to clipboard Decimal

Amount

currency Copied to clipboard String

Currency

callbacks Copied to clipboard Object

An object that specifies functions to be invoked for various Hosted Session events.

initialized Copied to clipboard Function

A function to be invoked when a wallet interaction is initialized.

formSessionUpdate Copied to clipboard Function

A function to be invoked when the session is updated.

visaCheckout Copied to clipboard Function

A function to be invoked when the Visa Checkout interaction is completed.


Return Value Copied to clipboard

None