Alternative Payments
PayPal
paypal paypal is currently in beta paypal is a popular ewallet, whereby their users are able to send and receive money using funds directly from their wallet and / or from their credit / debit card link your existing paypal account to judopay, to enable an easy integration of paypal alongside other payment methods reconcile your paypal payments within the judopay portal integrating paypal (beta) integrate paypal using our web sdk contact developer support to link your production paypal account to your judopay account currently, you are only able to link your production paypal account for more details on testing , contact developer support prerequisites make sure you are using web sdk version 0 0 18 (or higher) make sure you have implemented the following prerequisites from the web sdk integration guide web sdk docid 40dwe6lbub7vdkza1qydc web sdk docid 40dwe6lbub7vdkza1qydc 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 automatically receive non breaking changes, you can pin to the minor version (0 0) rather than the current patch version ( 0 0 45 ) step one display the paypal button currently /payments (immediate capture) is supported when implementing paypal via the web sdk make sure the following parameters are the same values as those entered in web sdk docid 40dwe6lbub7vdkza1qydc otherwise the transaction will fail merchantpaymentreference merchantconsumerreference judoid currency amount this is used to cross reference the validity of the transaction your backend server should store the paymentsession response reference returned by judopay's api use this reference from the response to populate yourpaymentsession make sure you replace the paypalconfiguration object values with your own display the paypal button \<body> \<div id="#paypal button container" >\</div> \<script> const paypalconfiguration = { style {color 'blue', height 34}, merchantid 'yourpaypalmerchantid', amount '1 01', currency 'gbp', merchantpaymentreference 'yourpaymentreference', judoid 'yourjudoid', dynamicdescriptor 'dynamicdescriptor', paymentsession 'yourpaymentsession', consumer { merchantconsumerreference 'yourconsumerreference', firstname 'john', surname 'doe', emailaddress 'example\@domain com' }, billingaddress { address1 'my house', address2 'my street', city 'my city', country 'gb', postcode 'tr14 8pa', }, shippingaddress { address1 'my house', address2 'my street', city 'my city', country 'gb', postcode 'tr14 8pa', }, onsuccess handlesuccess, onerror handleerror } judo getpaypalbutton(paypalconfiguration) then(button => { button render(document getelementbyid("#paypal button container")); }) catch(error => handleerror(error)) \</script> \</body> when the paypal button is clicked, the web sdk will call the method to make the transaction for more information on the paypal button, see paypal's documentation button render options see below for more details on the parameters that create the paypalconfiguration object paypal configuration parameter descriptions parameter description style string optional optional set the style for the paypal button for a full list of styling options, see styling merchantid string optional optional your paypal merchant id to get your paypal merchant id navigate to your paypal account settings > business information > paypal merchant id amount float 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 merchantpaymentreference 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 if you set this reference it will be used otherwise a reference will be internally generated 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 dynamicdescriptor string optional optional the merchant’s ‘trading name’ that will appear on the consumer’s statement the value is returned in the response within the appearsonstatement field format maximum 25 characters in length paymentsession string required required the additional way to authenticate a 3d secure 2 payments or preauths transaction consumer object required required consumer details merchantconsumerreference firstname surname emailaddress billingaddress object optional optional billing address details address1 address2 city country see country codes docid\ xze369mfk5uvosanzm8uo for the list of valid iso 3166 1 format country codes postcode required required shippingaddress object optional optional shipping address details address1 address2 city country see country codes docid\ xze369mfk5uvosanzm8uo for the list of valid iso 3166 1 format country codes postcode required required onsuccess object required required callback invoked when the payment is successful the response object is provided as a parameter, with the following properties receiptid orderid transactiontype createdat status onerror object required required callback invoked when the payment fails the error object is provided as a parameter 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) for more information and schema on the json object, see transaction api reference docid\ bcxnm5keok nlnrztafut 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 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 } for more information on the response codes, see codes and descriptions docid zrsihomuew xnrq4pbtj