CheckCard Request
Creating a CheckCard Request with the Web SDK
The Web SDK’s Check Card functionality can be used to perform a zero amount pre-authorisation (0 Auth). Check Card enables you to check the validity of the card, to be used for future payments.
Do you have a stored card wallet for existing customers? If validation is successful, a card token is returned as part of the response object. This token can then be stored and used for a payments / preauths request in the future, using the Web SDK’s Token Payment functionality.
Prerequisites
Make sure you are using Web SDK Version 0.0.34 (or higher).
From the Web SDK integration guide, you have completed the following:
- You do not need to include the amount or currency fields in your request body.
Step One: Making a Check Card Request
- Define the checkCardConfiguration object.
Ensure the details used when creating the paymentSession match the values set in the checkCardConfiguration object.
const checkCardConfiguration = {
judoId: "yourJudoId",
phoneCountryCode: "44",
challengeRequestIndicator: "challengeAsMandate",
initialRecurringPayment: false,
yourConsumerReference: "yourConsumerReference",
yourPaymentReference: "yourPaymentReference",
billingAddress: {
address1: "My house",
address2: "My street",
town: "My town",
state: "My state", //Mandatory for US and Canada
postCode: "TR14 8PA",
country: "826"
},
mobileNumber: "07999999999",
emailAddress: "[email protected]",
}See below for more details on the parameters that create the checkCardConfiguration object:
*Mastercard Recommends: These fields are recommended rather than mandatory. Transactions will continue to be processed if not supplied. See, Mastercard Recommended 3D Secure 2 Fieldsdd.
Parameter | Description |
|---|---|
judoId String Required | Unique ID supplied by Judopay. Specific to a merchant and/or location. Format:
|
yourConsumerReference String Required | Unique reference to anonymously identify your customer. Advisable to use GUIDs. Must be below 40 characters. |
yourPaymentReference String Required | Your unique reference for this payment. Format:
This value should be unique in order to protect your customers against duplicate transactions. With a server side integration, if a payment reference is not supplied, the transaction will not be processed. |
phoneCountryCode String Recommended * | The country code of the consumer's phone. Format:
Must be set if mobileNumber is set. If not set, default = 44 |
mobileNumber String Recommended * | Consumer’s valid mobile number. Mastercard recommends providing at least one contact method for Mastercard 3D Secure authenticated transactions. Format:
Must be set if phoneCountryCode is set. |
cardHolderName String Recommended * | The card name of the consumer If the cardHolderName field is displayed to the user in the payment form (isCardHolderNameVisible: true is set in the iFrame config), the value entered in the payment form will overwrite this value. |
challengeRequestIndicator String Optional | Indicates the type of challenge request you wish to apply. Set this to one of the following strings:
This should not be included in the same configuration object as scaExemption. |
scaExemption String Optional | To apply for an exemption from SCA, for a customer initiated transaction. Set this to one of the following strings:
This should not be included in the same configuration object as challengeRequestIndicator. |
initialRecurringPayment Boolean Optional | Indicates if this initial payment is part of a recurring payment. |
billingAddress Object Optional | Card holder's billing address. Properties:
If the billingAddress is provided, the postcode is required. |
emailAddress String Recommended * | Consumer’s valid email address. Mastercard recommends providing at least one contact method for Mastercard 3D Secure authenticated transactions. |
2. In a function, add the invokeCheckCard call. This will make Check Card request using both the paymentSession and checkCardConfiguration.
function handleCheckCardButtonClick() {
judo.invokeCheckCard(paymentSession, checkCardConfiguration)
.then(handleSuccess)
.catch(handleError)
}3. To call the invokeCheckCard function (in step 2 above) to make the Check Card request, add the onclick attribute to the payment button <div>: <button id="submit-payment-button" onclick="handleCheckCardButtonClick()"> Check Card </button>
This is the same button that is used for payments, however you can update the button label to reflect it’s functionality. For example: Check Card instead of Pay Now.
Step Two: Handle the Response
All the Judopay Web SDK transaction methods return a promise. Once the authorisation is complete, the promise will be either fulfilled or rejected.
Fulfilled
- You will receive a JSON object response (a Judopay receipt object).
- Depending on the result the consumer should be redirected to the appropriate outcome page.
- For example, if the result = SUCCESS redirect the consumer to the Success Page.
- This page should display the necessary transaction information (found in the Judopay receipt object).
Rejected
- You will receive an error object
- The consumer should be redirected to an Error Page.
const onFulfillment = (receiptObject) => {
const { result } = receiptObject
//redirect to appropriate page depending on the result (success/failure/declined page)
}
const onRejection = (error) => {
//redirect to error page and handle error
}For more information on the response codes, see Codes.