Checkout.js Methods and Parameters

Checkout.js Methods

Checkout.js has multiple methods you can invoke to process transactions through Converge or through one of our supported digital wallet providers. The following reference lists the available Checkout.js methods, a quick summary of their function, and their accepted parameters.

ConvergeEmbeddedPayment.pay(paymentFields, callback)

Description: Send payment information to have Converge process a payment. Can process credit card, gift card, or ACH payment.

Parameters

  • paymentFields : Values gathered from fields that customers enter their information into.

ConvergeEmbeddedPayment.dccDecision(dccOption, callback)

Description: Decision to use or not use Dynamic Currency Conversion.

Parameters

  • dccOption:
    • true: Pay with cardholder currency.
    • false: Pay with transaction currency.

ConvergeEmbeddedPayment.threeDSecureReturn(pares, callback)

Description: Call after 3D Secure returns callback.

Parameters

  • pares: 3D Secure redirect back parameter.

ConvergeEmbeddedPayment.initApplePay(buttonId, paymentFields, callback)

Description: Initiate ApplePay.

Parameters

  • buttonId: ID of HTML tag will be rendered by ApplePay.

ConvergeEmbeddedPayment.initPayPal(buttonId, paypalCredit, paymentFields, callback)

Description: Initiate PayPal.

Parameters

  • buttonId: ID of HTML tag will be rendered by PayPal.
  • paypalCredit:
    • true: PayPal Credit.
    • false: PayPal Express Checkout.

ConvergeEmbeddedPayment.initMasterPass(buttonId, paymentFields, callback)

Description: Initiate Click to Pay.

Parameters

  • buttonId: The ID of the HTML tag Click to Pay will render.

ConvergeEmbeddedPayment.getEFSToken(paymentFields, callback)

Description: Retrieve an EFS token to initiate a 3D Secure 2.0 challenge flow.

Parameters

  • paymentFields : Values gathered from fields that customers enter their information into.

ConvergeEmbeddedPayment.creditSurchargeDecision(option, callback)

Description: Handle Surcharge

Parameters

  • true: Proceed with Surcharge
  • false: no Surcharge

Common Parameters

Several Checkout.js methods require an object containing multiple pieces of data. The following reference lists these parameters and a decription of the required object properties they should contain.

paymentFields

Description: Object containing Converge payment fields. For information on required information by transaction type, see our Transaction Types.

note

ssl_txn_auth_token is mandatory for

  • pay
  • initApplePay
  • initPayPal
  • initVisaCheckout
  • initMasterPass

ssl_callback_url is mandatory for initMasterPass, ssl_callback_url is not documented in the developer guide because it’s a merchant url to accept Click to Pay redirects back.

callback

Description: Object contains callback functions.

var callback = {
        onError: function (error) {
                // An Error happened during transaction processing.
                // Checkout JS will expire session tokens after 5 declines and return an error. The user should write the onError function in their callback object to initiate a new session token to avoid failed transactions.
        },
        onDeclined: function (responseFields) {
                // The Transaction declined, responseFields contains fields returned by Converge.
        },
        onApproval: function (responseFields) {
                // Transaction approved, responseFields contains fields returned by Converge.
        },
        onCancelled: function () {
                // For Digital Wallets only. Customer cancelled transaction.
        },
        onDCCDecision: function (responseFields) {
                // DCC eligible, responseFields contains DCC related fields,
                // merchant should show DCC option, call ConvergeEmbeddedPayment.dccDecision base on customer selection
        },
        onThreeDSecure: function (responseFields) {
                // 3D Secure eligible, responseFields contains 3D Secure related fields,
                // merchant redirect page to 3D 3Secure web site using URL in responseFields,
                // When 3D Secure redirect back to merchant, retrieve response parmaeters and call ConvergeEmbeddedPayment.threeDSecureReturn
        };