Web
...
Web SDK
SaveCard Request
creating a savecard request with the web sdk if you do not want to perform a pre authorisation check on a customer's account, use this call to tokenise the card information into an encrypted string 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 request docid\ vool6a4nsy9s0gyjpmbst functionality prerequisites make sure you are using web sdk version 0 0 43 (or higher) make sure you have implemented the following from the web sdk integration guide, you have completed the following web sdk docid 40dwe6lbub7vdkza1qydc you do not need to include the amount or currency fields in your request body web sdk docid 40dwe6lbub7vdkza1qydc step one making a save card request define the savecardconfiguration object ensure the details used when creating the paymentsession match the values set in the savecardconfiguration object save card configuration object const savecardconfiguration = { judoid "yourjudoid", yourconsumerreference "yourconsumerreference", currency "gbp" billingaddress { address1 "my house", address2 "my street", town "my town", state "my state", //mandatory for us and canada postcode "tr14 8pa", cardholdername "consumer name", country "826" } } see below for more details on the parameters that create the savecardconfiguration object 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 yourconsumerreference string required required unique reference to anonymously identify your customer advisable to use guids must be below 40 characters currency string optional optional the currency of the transaction any iso 4217 alphabetic currency code gbp usd eur 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 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 2\ in a function, add the invokesavecard call this will make a save card request using the paymentsession and savecardconfiguration invoke save card call function handlesavecardbuttonclick() { judo invokesavecard(paymentsession, savecardconfiguration) then(handlesuccess) catch(handleerror) } 3\ to call the invokesavecard function (in step 2 above) to make the save card request, add the onclick attribute to the payment button \<div> \<button id="submit payment button" onclick="handlesavecardbuttonclick()"> save 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 save card instead of pay now step two handle the response once the save card request is complete you will receive either fulfilled you will receive a json object response (a judopay receipt object) for more information and schema on the json object, see api transaction response 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 for more information on error responses returned, see payment form error messages docid\ qfxawpaql 2evfp8y94d the consumer should be redirected to an error page save card response example const handlesuccess = (response) => { //if the save card request was successful //if the result value in the response object is 'success', you could store the card token //the card token can be used in the future for token payments } const handleerror = (error) => { //inform the user that their card could not be saved } for more information on the response codes, see codes and descriptions docid zrsihomuew xnrq4pbtj