Testing your Integration
...
Testing Overview
Testing your Web SDK Integrati...
Testing Web SDK - Card Payments
testing web sdk card payments with judopay’s web sdk solution, a minimal integration is all that is required to enable you to take a card payment take a card preauth take a card token payment take a card token preauth check the validity of a card, using checkcard prerequisites before attempting web sdk test transactions, ensure the following steps have been implemented web sdk docid 40dwe6lbub7vdkza1qydc web sdk docid 40dwe6lbub7vdkza1qydc defined the payment configuration , token configuration and check card configuration objects as required card payment scenarios (positive flow) important to consider yourpaymentreference is your unique reference for each transaction ensure you generate a unique yourpaymentreference and unique paymentsession for each transaction this will avoid duplicate transactions when making token payments, yourconsumerreference must match the original reference when the token was initially created ensure the following information in your configuration object(s) matches the information in the paymentsession judoid currency amount yourconsumerreference yourpaymentreference if this does not match, you will receive an error suggested test scenario expected outcome tip process a successful web sdk card checkcard request this will check the card is valid 200 successful ensure you have defined the check card configuration object the checkcard response provides the cardtoken yourconsumerreference ensure you use the correct cardtoken and yourconsumerreference to make future token payments , otherwise they will fail process a successful web sdk card payment / preauth request 200 successful ensure you have defined the payment configuration object the payment /preauth response provides the cardtoken yourconsumerreference process a web sdk card token payment / preauth with the cv2 / cvv security code included in the request this will check the cv2 / cvv and card token are valid and match the stored card details 200 successful the consumer will not be prompted to enter the security code ensure you have defined the token configuration object where securitycode is set and shouldverifysecuritycode = false when making token payments or preauths, the cardtoken and yourconsumerreference must match the original reference when the token was initially created process a web sdk card token payment prompting the consumer to enter just their cardholder name set shouldverifycardholdername true shouldverifysecuritycode false if cardholdername is provided in the configuration object, it will be overwritten with the value entered here when making token payments or preauths, the cardtoken and yourconsumerreference must match the original reference when the token was initially created process a web sdk card token payment prompting the consumer to enter just their card security code set shouldverifysecuritycode true shouldverifycardholdername false if securitycode is provided in the configuration object, it will be overwritten with the value entered here when making token payments or preauths, the cardtoken and yourconsumerreference must match the original reference when the token was initially created process a web sdk card token payment prompting the consumer to enter both their cardholder name and security code set shouldverifycardholdername true shouldverifysecuritycode true when making token payments or preauths, the cardtoken and yourconsumerreference must match the original reference when the token was initially created 3d secure 2 flows for each 3d secure 2 scenario, different calls are made from the front end to the back end it is advised to be aware of the different results from each flow and how your app will handle these process a web sdk card payment prompting the frictionless flow testing 3d secure 2 authentication docid\ bdcgiyqdm3mle ubxp1yr ensure judopay has enabled 3d secure 2 on your sandbox tokens if 3d secure 2 is not enabled on your tokens, the test transaction will be successful, however it will not have followed the 3d secure 2 verification process process a web sdk card payment prompting the non frictionless flows testing 3d secure 2 authentication docid\ bdcgiyqdm3mle ubxp1yr ensure judopay has enabled 3d secure 2 on your sandbox tokens if 3d secure 2 is not enabled on your tokens, the test transaction will be successful, however it will not have followed the 3d secure 2 verification process for more information on api credentials and permissions, see introduction docid\ s 8hoamytkgy13t0p657 test data to simulate a successful web payments request, use the test cards docid obafnuc1umhk vihhs5d to trigger specific 3d secure 2 user journeys , include the cardholdername as specified in the testing 3d secure 2 authentication docid\ bdcgiyqdm3mle ubxp1yr the cardholdername is case sensitive and corresponds to an expected transaction result request parameters taking a card payment or preauth define the configuration object for the payment or preauth add the invokepayment call to invoke a payment using the paymentsession and configuration object add the invokepreauth call to invoke a preauth using the paymentsession and configuration object making a check card request define the configuration object for the checkcard add the invokecheckcard call to make a check card request using the paymentsession and configuration object taking a card token payment or token preauth define the configuration object for the token payment or token preauth add the invoketokenpayment call to invoke a payment using the paymentsession and configuration object add the invoketokenpreauth call to invoke a preauth using the paymentsession and configuration object header parameters these header parameters are to be used when creating the testing web sdk card payments docid\ a33b4pwt6brofejpghdh2 request to our transaction api for more information, see authentication methods docid\ ylkw5coh5nqnfq3j wjk2 api version 6 22 for the latest version of the judopay transaction api, see transaction api reference docid\ bcxnm5keok nlnrztafut content type application/json accept application/json authorization method tokensecretauth in the authorization header supply basic { authstring } example basic txpfdpdrszwmsgk4djhxetpjbts4yjq5otdkzmo7ctk1yte0oweymdg1mmy3ywyyzweyztcwymqyzgy3o replace { authstring } with base64 encoding of api token api token (username) colon colon api secret (password) example mzpdkqk1mgi8v3ky mzpdkqk1mgi8v3ky y158n4732dfc7595a149a20381f7af2ea2e70gr6df794b8rnwc019cc5f799kk3 body parameters web sdk payment / preauth / checkcard / token payment configuration parameter descriptions parameter description judoid string required required unique id supplied by judopay specific to a merchant and/or location format 100100100 maximum length 9 characters do not include spaces or dashes amount decimal required required the amount to process format two decimal places for currencies using a different structure please contact judopay for support currency string required required the currency of the transaction any iso 4217 alphabetic currency code gbp usd eur yourconsumerreference string required required unique reference to anonymously identify your customer advisable to use guids must be below 40 characters yourpaymentreference string required required your unique reference for this payment format maximum length 50 characters 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 optional optional the country code of the consumer's phone format maximum length 3 characters only numbers allowed do not include special characters or spaces should be set if mobilenumber is set if not set, default = 44 mobilenumber string optional optional consumer’s valid mobile number format maximum length 15 characters only numbers allowed do not include special characters or spaces must be set if phonecountrycode is set cardholdername string optional optional 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 optional indicates the type of challenge request you wish to apply set this to one of the following strings nopreference nochallenge no challenge required challengepreferred a challenge is preferred for this transaction challengeasmandate must challenge this transaction this should not be included in the same configuration object as scaexemption initialrecurringpayment boolean optional optional indicates if this initial payment is part of a recurring payment billingaddress object optional optional card holder's billing address properties address1 address2 (optional) town state (only required if country is usa/canada) format string iso alpha 2 code (e g california = " ca ") country format string see country codes docid\ xze369mfk5uvosanzm8uo for the list of valid iso 3166 1 format country codes postcode if the billingaddress is provided, the postcode is required emailaddress string optional optional consumer’s valid email address it is recommended but not required for 3d secure 2 authentication primaryaccountdetails object optional optional this is mandatory mandatory for merchants who have an mcc code of 6012 6012 properties name this is the surname accountnumber postcode delayedauthorisation boolean optional optional for preauths only set to true to authenticate a card holder with 3d secure, without performing payment authorisation when set to true, the 3d secure authentication status is returned in the response the payment authorisation is carried out at the stage when you are ready to collect the amount from the consumer the default value = false the configuration object for token payments takes the same parameters as the paymentconfiguration object, along with the additional token specific parameters to be included, as listed below cardtoken string required required a randomly generated string linked to the saved card stored in judopay’s system shouldverifysecuritycode boolean optional optional indicates if the consumer will be prompted to enter their security code default value = true securitycode string optional 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 ) shouldverifycardholdername boolean optional 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 request example const paymentconfiguration = { judoid "yourjudoid", amount 1 01, currency "gbp", phonecountrycode "44", challengerequestindicator "challengeasmandate", initialrecurringpayment false, yourconsumerreference "yourconsumerreference", yourpaymentreference "yourpaymentreference", billingaddress { address1 "my house", address2 "my street", town "my town", postcode "tr14 8pa", country "826" }, mobilenumber "07999999999", emailaddress "contact\@judopay com", primaryaccountdetails { name "doe", accountnumber "9999999", dateofbirth "1989 09 19", postcode "ab1 2cd" } } response example 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 } card payment scenarios (negative flow) declines can occur for various reasons, it can be impossible to simulate all the negative flows in a sandbox environment important to consider how your app handles negative flows your customer's experience should a negative flow occur logic to communicate error messages customise how your app responds how to maintain application consistency follow our suggested guidelines to simulate negative scenarios, to test your app’s error handling suggested negative test scenario expected error code error description attempt to perform a web sdk card payment / preauth / checkcard request decline using the following cardnumber 4221690000004963 cv2 452 expirydate 12/24 declined card declined attempt to perform a web sdk card payment / preauth / checkcard request gateway error using the following cardnumber 4976350000006891 cv2 341 expirydate 12/25 the transaction request has passed all judopay's validation checks the next step in the payment flow is for the gateway to perform their checks a gateway error occurs when for example, the gateway verifies the request details with the issuing bank, who declines the request as there are not enough funds in the account this response contains the receiptid declined card declined attempt a web sdk card payment / preauth with the incorrect currency entered for the specified transaction default currency = gbp 72 sorry, we're currently unable to route this transaction please check your account details and try again if this issue persists, please contact customer services this is a codes and descriptions docid zrsihomuew xnrq4pbtj attempt to perform a web sdk card payment 3d secure 2 challenge flow, where the user taps the cancel button on the challenge screen ensure you have set the correct flags to control the 3d secure 2 challenge scenarios 165 unable to process transaction card authentication failed with 3ds server attempt to perform a web sdk card payment / preauth / checkcard request with the incorrect environment (live or sandbox) for your api token and api secret and configuration 7 sorry, we were unable to authorize this request please check your details and permissions before trying again attempt to perform a duplicate transaction, re using a yourpaymentreference that has already been used in a previous transaction 86 sorry, this payment has been stopped as it is a duplicate transaction attempt to perform a web sdk card payment / preauth / checkcard request where the amount set in the configuration object is different to the amount set in the paymentsession 12 sorry, we were unable to process your payment please check your details and try again attempt to perform a web sdk card payment / preauth / checkcard request where the card type used, is not supported on your judopay account for example, if amex is not enabled on your account, use card type = amex 73 sorry, but this card type is not currently supported on this account attempt to perform a web sdk card payment / preauth / checkcard request where the card scheme used, is not defined in the iframe configuration object for example, if amex is not defined, use card scheme = amex //an array of card schemes that are accepted by the merchant //if this field is set, an error will appear if an unsupported card scheme is entered allowedcardschemes \['visa','mastercard'], for the purpose of this exercise the class is named judopay errors, and sets a style to be red you can add any custom style you wish in your css file \<div class="judopay errors" style="color\ red">error location\</div> for more information, see web sdk docid 40dwe6lbub7vdkza1qydc where the codes remain fixed, the descriptions may change you should not build any error handling logic based on these descriptions for a list of possible error codes, types and descriptions, see codes and descriptions docid zrsihomuew xnrq4pbtj