Token Payment Request
Supports token payment and token preAuth.
Do you have a stored card wallet for existing customers, making use of card tokens? Using our Web SDK, you will also be able to invoke a customer-initiated payment using a card token, to handle:
- payments
- preAuths
- 3D Secure challenges
To invoke a customer-initiated transaction using a card token, follow the below steps from Creating a 3D Secure 2 Payment with the Web SDK:
The payment form iFrame must be loaded onto the page in order for payments to work. However displaying the form to the consumer is not required for this transaction type.
To hide the payment form iFrame, use: <div id="payment-iframe" style="position:absolute;width:0;height:0;border:0;"></div>
To make a token transaction:
- Define the tokenConfiguration object for the token payment or token preAuth.
Ensure the details used when creating the paymentSession match the values set in the following configuration:
See below for more details on the parameters that create the tokenConfiguration object:
Parameter | Description |
---|---|
cardToken String Required | A randomly generated string linked to the saved card stored in Judopay’s system. |
shouldVerifySecurityCode Boolean Optional | Indicates if the consumer will be prompted to enter their security code. Default value = true |
securityCode String Optional | The 3/4 digit security code associated with the consumer’s saved card. This value will be overwritten if the user is prompted to enter their own value: (shouldVerifySecurityCode=true). |
cardHolderName String Optional | Allows you to provide the consumers' name without needing to prompt them to enter it. Note: You can use cardHolderName OR shouldVerifyCardHolderName - NOT both. |
shouldVerifyCardHolderName Boolean Optional | Indicates if the consumer will be prompted to enter their card holder name. If the user is prompted to enter their card holder name AND you have provided cardHolderName in the config, the config value will be overwritten. Default value = false |
2. In a function, add the invokeTokenPayment call. This will invoke a payment using the paymentSession and tokenPaymentConfiguration.
To invoke a preAuth, change the above code to .invokeTokenPreauth.
To customise the style of the Token Details Modal Input, add an extra parameter to the invokeTokenPayment call: judo.invokeTokenPayment(paymentSession, tokenConfiguration, tokenDetailsModalStyle)
The tokenDetailsModalStyle is an object defining the style of the modal. For example:
This object has been updated to include the fields: labelTextContent2 and inputPlaceholder2, which can be used to set the style for the cardHolderName input.
An example of the tokenDetailsModalStyle object:
4. Add a token payment button: <button id="submit-token-payment-button" onclick="handleTokenPaymentButtonClick()"> Pay Now </button> When clicked, the function that invokes the token payment or token preAuth is called (in step 2 above).
Putting it all together to set up the Web SDK and make a token transaction: