Developers
...
Developer Hub
Developer Tutorials
Adding the Payment iFrame to your web page Tutorial
adding the payment iframe this tutorial is for your client side this tutorial will cover how to import the web sdk and add the judopay payment iframe to your web page this iframe can render a payment form which can be used to securely capture a consumer’s card details ensure you have already watched the below tutorial creating a payment session tutorial docid 5ge2zudogtatdfdl7xegc full tutorial we have created video chapters from the full tutorial, to help you easily re watch different parts of the tutorial we have included an overview and example code snippets for each section below when using the code snippets, ensure to replace any field values with your own values 1\ intro 2\ importing and creating an instance of judopay's web sdk library importing the web sdk and creating an instance of the library, which will later be used to call web sdk functions import and create instance //in your html \<head> element \<script src="https //web judopay com/js/0 0/judopay min js">\</script> //in a html \<script> tag or javascript file var judo = new judopay("yourapitoken", true) //where true uses the test environment 3\ rendering the iframe onto the web page defining where the payment iframe will render on your page render the iframe //in your html \<body> element \<div id="payment iframe" width="100%">\</div> //in your html \<script> tag or javascript file var judo = new judopay("yourapitoken", true) //where true uses the test environment judo createcarddetails("payment iframe") 4\ customising the iframe customising the look and behaviour of the payment iframe, using the iframe configuration object customise the iframe //n your html \<script> tag or javascript file const iframeconfiguration = { isgeolocationgatheringallowed true, iframe { language "en", errorfieldid 'judopay errors', showcardtypeicons true, layout "vertical", cardtypeiconright "10px", cardtypeicontop " 2px", backgroundcolor "#ffffff", enabledpaymentmethods \['card'], defaultcountrycode 'uk', iscountryandpostcodevisible false, iscardholdernamevisible true, errorsdisplay "show all", disableunderline false, shouldautofocus true } } judo createcarddetails("payment iframe", iframeconfiguration) 5\ adding the payment button adding the payment button to the web page and setting the id to inherit behaviour add the payment button //in your html \<body> element \<button id="submit payment button"> pay now \</button> 6\ displaying payment form errors displaying errors caused by the card form input, which can be shown within, or outside the payment iframe (optional) display payment form errors //fields in the iframe configuration object(see chapter 4) errorsdisplay "show all" // other values hide under fields, hide under fields, hide all errorfieldid 'judopay errors' //(optional) id of div where you want errors shown outside of iframe //to show errors outside of judopay payment iframe (optional) //in your html \<body> element \<div class="judopay errors">\</div> 7\ recap following the completion of this tutorial, you will have a customised judopay payment iframe rendered on your payment page, which can capture and validate card details you also have a payment button, which will be used in the next tutorial handling a transaction, to trigger the transaction resources web sdk docid 40dwe6lbub7vdkza1qydc creating a payment session tutorial docid 5ge2zudogtatdfdl7xegc handling a transaction tutorial docid\ wc705scaxt4snkefgxqr7