Click to Pay SDK overview
The click-to-pay.js JavaScript library allows you to add support for Click to Pay to your payment page.
Click to Pay is an intelligent, password-free online checkout option that provides a quick and easy checkout experience designed to make 'guest checkout' for a payer faster and easier across all devices.
Click to Pay provides a single checkout button and a standardized checkout flow for all participating card schemes.
For the previous version of the srci.js, please click here.
Supported only in DirectAPI version 62 and later.
URL Copied to clipboard
https://ap-gateway.mastercard.com/static/click-to-pay/click-to-pay.min.jsFunctions Copied to clipboard
configure()
Configuration method for initializing the API.
isEnrollmentAvailableForCardPrefix()
Allows you to determine if you can offer the payer to enroll the card in Click to Pay if they have provided a card number with the provided 10-digit card prefix.
isEnrollmentAvailableForScheme()
Allows you to determine if you can offer the payer to enroll the card in Click to Pay if they have provided a card with this scheme.
checkoutWithNewCard()
Allows you to trigger the Click to Pay checkout with a card that has not yet been enrolled in SRC.
checkoutWithExistingCard()
Allows you to trigger the Click to Pay checkout when the payer has selected a card that is already enrolled in SRC.
unbindCookies()
Use this function when the payer clicks the 'Not you?' link to delete the cookies you are using to recognize the payer.
initiatePayerInteraction()
Allows you to trigger the Click to Pay interaction with the payer separately from initializing the Click to Pay interaction using the configure() function.
updateConfiguration()
Allows the merchant to modify configuration after Click To Pay has been configured.
Callbacks Copied to clipboard
onComplete
Triggered when the payer has completed the Click to Pay interaction.
onStateChange
Triggered when the payer email changes it changes if the payer's device is recognized
onError
Triggered if an error occurs during checkout.