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 create a paymentsession docid 40dwe6lbub7vdkza1qydc add the payment form to your website 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 50 ) 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 creating a paymentsession 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 https //developer paypal com/docs/business/javascript sdk/javascript sdk reference/#paypalbuttonsrender container see below for more details on the parameters that create the paypalconfiguration object paypal configuration parameter descriptions parameter description style string \<font color="#42cbd4">optional\</font> set the style for the paypal button for a full list of styling options, see styling https //developer paypal com/docs/business/checkout/reference/style guide/#customize the payment buttons merchantid string \<font color="#42cbd4">optional\</font> your paypal merchant id to get your paypal merchant id navigate to your paypal account settings > business information > paypal merchant id amount float \<font color="#ef5b2e">required\</font> the amount to process format two decimal places for currencies using a different structure please contact judopay for support currency string \<font color="#ef5b2e">required\</font> the currency of the transaction any iso 4217 alphabetic currency code gbp usd eur merchantpaymentreference string \<font color="#ef5b2e">required\</font> 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 \<font color="#ef5b2e">required\</font> 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 \<font color="#42cbd4">optional\</font> 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 \<font color="#ef5b2e">required\</font> the additional way to authenticate a 3d secure 2 payments or preauths transaction consumer object \<font color="#ef5b2e">required\</font> consumer details merchantconsumerreference firstname surname emailaddress billingaddress object \<font color="#42cbd4">optional\</font> billing address details address1 \<font color="#ef5b2e"> \</font> address2 city \<font color="#ef5b2e"> \</font> country \<font color="#ef5b2e"> \</font> see here docid\ xze369mfk5uvosanzm8uo for the list of valid iso 3166 1 format country codes postcode \<font color="#ef5b2e"> \</font> \<font color="#ef5b2e">required \</font> shippingaddress object \<font color="#42cbd4">optional\</font> shipping address details address1 \<font color="#ef5b2e"> \</font> address2 city \<font color="#ef5b2e"> \</font> country \<font color="#ef5b2e"> \</font> see here docid\ xze369mfk5uvosanzm8uo for the list of valid iso 3166 1 format country codes postcode \<font color="#ef5b2e"> \</font> \<font color="#ef5b2e">required \</font> onsuccess object \<font color="#ef5b2e">required\</font> 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 \<font color="#ef5b2e">required\</font> 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 api transaction response 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 web sdk error responses 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 docid zrsihomuew xnrq4pbtj paypal webhooks during the paypal checkout flow, the redirect that takes place means we recommend setting up webhook notifications to receive transaction status updates prerequisites if you are already receiving webhook notifications from judopay, there are no additional steps required to begin receiving webhooks for paypal if you are not currently configured to receive webhooks from judopay, you can enable webhooks via the judopay portal for more information, see enable webhooks docid\ mqjiizxmcro1cpvauawud webhook notification examples preauth example { "receiptid" "879332866188656640", "paymentmethod" "paypal", "siteid" "100817485", "orderdetails" { "orderid" "apm zsmrswunsgul0cr4quftiq", "orderstatus" "authorised", "timestamp" "2022 08 23t11 56 17 908z", "currency" "gbp", "amount" 25, "refundedamount" 0, "capturedamount" 0 }, "merchantpaymentreference" "2d6dae09 33fd 46f3 bc36 989396bec766", "merchantconsumerreference" "brielle" } partial capture example { "receiptid" "879333769331359744", "paymentmethod" "paypal", "siteid" "100817485", "orderdetails" { "orderid" "apm zsmrswunsgul0cr4quftiq", "orderstatus" "partially captured", "timestamp" "2022 08 23t11 58 30 016z", "currency" "gbp", "amount" 25, "refundedamount" 0, "capturedamount" 20 }, "merchantpaymentreference" "4f89ddf1 cf23 4877 88f0 8bfaac56ce64", "merchantconsumerreference" "brielle" } full capture example { "receiptid" "879333941989892096", "paymentmethod" "paypal", "siteid" "100817485", "orderdetails" { "orderid" "apm zsmrswunsgul0cr4quftiq", "orderstatus" "fully captured", "timestamp" "2022 08 23t11 59 10 930z", "currency" "gbp", "amount" 25, "refundedamount" 0, "capturedamount" 25 }, "merchantpaymentreference" "af1934a7 1ef0 4115 bff9 38671503fed9", "merchantconsumerreference" "brielle" } payment example { "receiptid" "879322869014740992", "paymentmethod" "paypal", "siteid" "100817485", "orderdetails" { "orderid" "apm sja5crper1 87cch1xxaw", "orderstatus" "fully captured", "timestamp" "2022 08 23t11 16 11 388z", "currency" "gbp", "amount" 21, "refundedamount" 0, "capturedamount" 21 }, "merchantpaymentreference" "385af203 6658 4b5a 961d d67824b891d2", "merchantconsumerreference" "jarrell", "merchantpaymentmetadata" { "field 1" "merchant meta data" } } partial refund collected funds outstanding example { "receiptid" "879331999045672960", "paymentmethod" "paypal", "siteid" "100817485", "orderdetails" { "orderid" "apm sja5crper1 87cch1xxaw", "orderstatus" "partially refunded", "timestamp" "2022 08 23t11 51 27 509z", "currency" "gbp", "amount" 21, "refundedamount" 10, "capturedamount" 21 }, "merchantpaymentreference" "385af203 6658 4b5a 961d d67824b891d2", "merchantconsumerreference" "jarrell", "merchantpaymentmetadata" { "field 1" "merchant meta data" } } partial refund all collected funds example { "receiptid" "879331999045672960", "paymentmethod" "paypal", "siteid" "100817485", "orderdetails" { "orderid" "apm sja5crper1 87cch1xxaw", "orderstatus" "refunded", "timestamp" "2022 08 23t11 51 27 509z", "currency" "gbp", "amount" 21, "refundedamount" 10, "capturedamount" 10 }, "merchantpaymentreference" "385af203 6658 4b5a 961d d67824b891d2", "merchantconsumerreference" "jarrell", "merchantpaymentmetadata" { "field 1" "merchant meta data" } } full refund example { "receiptid" "879332209947860992", "paymentmethod" "paypal", "siteid" "100817485", "orderdetails" { "orderid" "apm sja5crper1 87cch1xxaw", "orderstatus" "closed", "timestamp" "2022 08 23t11 52 17 529z", "currency" "gbp", "amount" 21, "refundedamount" 21, "capturedamount" 21 }, "merchantpaymentreference" "385af203 6658 4b5a 961d d67824b891d2", "merchantconsumerreference" "jarrell", "merchantpaymentmetadata" { "field 1" "merchant meta data" } } webhook parameter descriptions parameter description receiptid string unique id that references the payment siteid string unique id supplied by judopay specific to a merchant and / or location transactiontype string type of transaction values payment preauth collection refund paymentmethod string payment method used values paypal orderdetails object details of the order properties orderdetails orderid unique id for the order orderdetails orderstatus authorised your authorisation request has been successfully processed you may now capture or void the authorised funds subsequent operations capture void partially captured your order has been partially captured, there are captured funds now available to refund further authorised funds remain available to capture or void subsequent operations capture void refund fully captured your authorisation has been fully captured, there are no further authorised funds available to capture the captured funds in this order can be refunded subsequent operations refund failed sorry, an error has occurred whilst processing your request cancelled the payee has abandoned the transaction during the paypal redirect flow partially refunded your order has been partially refunded, there are further captured funds available to refund subsequent operations capture void refund refunded your order has been fully refunded, there are no outstanding captured funds available to refund there are authorised funds available to capture or void subsequent operations capture void closed your order is now closed, all funds have been collected and subsequently refunded there are no further operations available in regards to this order orderdetails timestamp the time of the transaction orderdetails currency the currency of the transaction orderdetails amount the amount of the transaction orderdetails refundedamount the refund amount orderdetails capturedamount the amount captured merchantpaymentreference string the unique reference for this payment merchantconsumerreference string unique reference to anonymously identify your customer merchantpaymentmetadata string additional data for this payment