{"id":171931,"date":"2022-03-15T14:53:15","date_gmt":"2022-03-15T13:53:15","guid":{"rendered":"https:\/\/www.podartis.com\/paypal\/"},"modified":"2022-03-15T14:53:15","modified_gmt":"2022-03-15T13:53:15","slug":"paypal","status":"publish","type":"page","link":"https:\/\/www.podartis.com\/en\/paypal\/","title":{"rendered":"PayPal"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"171931\" class=\"elementor elementor-171931 elementor-1510\" wpc-filter-elementor-widget=\"1\" data-elementor-post-type=\"page\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-9b14a69 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"9b14a69\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-wider\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6aae9f1\" data-id=\"6aae9f1\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7f32c31 elementor-widget elementor-widget-html\" data-id=\"7f32c31\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div id=\"smart-button-container\">\r\n    <div class=\"paypal-div\">\r\n        <label class=\"paypal-label\" for=\"description\">Company name<\/label><input class=\"paypal-input\" type=\"text\" name=\"descriptionInput\" id=\"description\" maxlength=\"127\" value=\"\">\r\n    <\/div>\r\n    <span class=\"paypal-error\" id=\"descriptionError\">Please enter a company name<\/span>\r\n    \r\n    <div class=\"paypal-div\">\r\n        <label class=\"paypal-label\" for=\"amount\">VAT amount included <\/label><input class=\"paypal-input\" name=\"amountInput\" type=\"number\" id=\"amount\" value=\"\" ><span> EUR<\/span>\r\n    <\/div>\r\n    <span class=\"paypal-error\" id=\"priceLabelError\">\r\nPlease enter an amount<\/span>\r\n    \r\n    <div class=\"paypal-div\" id=\"invoiceidDiv\"><label class=\"paypal-label\" for=\"invoiceid\">Invoice number <\/label><input class=\"paypal-input\" name=\"invoiceid\" maxlength=\"127\" type=\"text\" id=\"invoiceid\" value=\"\" ><\/div>\r\n    <span class=\"paypal-error\" id=\"invoiceidError\">Please enter the invoice number<\/span>\r\n    \r\n    <div class=\"paypal-button\" id=\"paypal-button-container\"><\/div>\r\n<\/div>\r\n\r\n<style>\r\n    .paypal-div {\r\n        display: flex!important;\r\n        align-items: center;\r\n        flex-wrap: wrap;\r\n        gap: 20px;\r\n    }\r\n    \r\n    .paypal-error {\r\n        visibility: hidden;\r\n        color:red;\r\n        text-align: center;\r\n        display: block;\r\n    }\r\n    \r\n     .paypal-button {\r\n        text-align: center;\r\n        margin-top: 0.625rem;\r\n    }\r\n    \r\n    .paypal-label {\r\n        min-width: 220px;\r\n    }\r\n    \r\n    .paypal-input {\r\n        flex-grow: 1;\r\n    }\r\n<\/style>\r\n\r\n<script src=\"https:\/\/www.paypal.com\/sdk\/js?client-id=AZvyXqAPy4YLiSsMUHtevzPCrw1pZRiK0qnQbABjCmt1lJYsqyinEoI6XlXOZB3h59FkuX2qvzsmu9Y3&enable-funding=venmo&currency=EUR\" data-sdk-integration-source=\"button-factory\"><\/script>\r\n<script>\r\n    function initPayPalButton() {\r\n        var description = document.querySelector('#smart-button-container #description');\r\n        var amount = document.querySelector('#smart-button-container #amount');\r\n        var descriptionError = document.querySelector('#smart-button-container #descriptionError');\r\n        var priceError = document.querySelector('#smart-button-container #priceLabelError');\r\n        var invoiceid = document.querySelector('#smart-button-container #invoiceid');\r\n        var invoiceidError = document.querySelector('#smart-button-container #invoiceidError');\r\n        var invoiceidDiv = document.querySelector('#smart-button-container #invoiceidDiv');\r\n\r\n        var elArr = [description, amount];\r\n\r\n        if (invoiceidDiv.firstChild.innerHTML.length > 1) {\r\n            invoiceidDiv.style.display = \"block\";\r\n        }\r\n\r\n        var purchase_units = [];\r\n        purchase_units[0] = {};\r\n        purchase_units[0].amount = {};\r\n\r\n        function validate(event) {\r\n            return event.value.length > 0;\r\n        }\r\n\r\n        paypal.Buttons({\r\n            style: {\r\n                color: 'gold',\r\n                shape: 'pill',\r\n                label: 'pay',\r\n                layout: 'vertical',\r\n    \r\n            },\r\n\r\n            onInit: function (data, actions) {\r\n                actions.disable();\r\n\r\n                if(invoiceidDiv.style.display === \"block\") {\r\n                    elArr.push(invoiceid);\r\n                }\r\n\r\n                elArr.forEach(function (item) {\r\n                    item.addEventListener('keyup', function (event) {\r\n                        var result = elArr.every(validate);\r\n                        if (result) {\r\n                            actions.enable();\r\n                        } else {\r\n                            actions.disable();\r\n                        }\r\n                    });\r\n                });\r\n            },\r\n\r\n            onClick: function () {\r\n                if (description.value.length < 1) {\r\n                    descriptionError.style.visibility = \"visible\";\r\n                } else {\r\n                    descriptionError.style.visibility = \"hidden\";\r\n                }\r\n\r\n                if (amount.value.length < 1) {\r\n                    priceError.style.visibility = \"visible\";\r\n                } else {\r\n                    priceError.style.visibility = \"hidden\";\r\n                }\r\n\r\n                if (invoiceid.value.length < 1 && invoiceidDiv.style.display === \"block\") {\r\n                    invoiceidError.style.visibility = \"visible\";\r\n                } else {\r\n                    invoiceidError.style.visibility = \"hidden\";\r\n                }\r\n\r\n                purchase_units[0].description = description.value;\r\n                purchase_units[0].amount.value = amount.value;\r\n\r\n                if(invoiceid.value !== '') {\r\n                    purchase_units[0].invoice_id = invoiceid.value;\r\n                }\r\n            },\r\n\r\n            createOrder: function (data, actions) {\r\n                return actions.order.create({\r\n                    purchase_units: purchase_units,\r\n                });\r\n            },\r\n\r\n            onApprove: function (data, actions) {\r\n                return actions.order.capture().then(function (orderData) {\r\n\r\n                    \/\/ Full available details\r\n                    console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));\r\n                    \r\n                    \/\/ Show a success message within this page, e.g.\r\n                    \/\/ const element = document.getElementById('paypal-button-container');\r\n                    \/\/ element.innerHTML = '';\r\n                    \/\/ element.innerHTML = '<h3>Payment successfully made!<\/h3>';\r\n                    actions.redirect('https:\/\/www.podartis.com\/en\/paypal\/paypal-thank-you\/');\r\n                    \r\n                });\r\n            },\r\n\r\n            onError: function (err) {\r\n                console.log(err);\r\n            }\r\n        }).render('#paypal-button-container');\r\n    }\r\n\r\n    initPayPalButton();\r\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Company name Please enter a company name VAT amount included EUR Please enter an amount Invoice number Please enter the invoice number<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"class_list":["post-171931","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.podartis.com\/en\/wp-json\/wp\/v2\/pages\/171931","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.podartis.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.podartis.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.podartis.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.podartis.com\/en\/wp-json\/wp\/v2\/comments?post=171931"}],"version-history":[{"count":1,"href":"https:\/\/www.podartis.com\/en\/wp-json\/wp\/v2\/pages\/171931\/revisions"}],"predecessor-version":[{"id":171932,"href":"https:\/\/www.podartis.com\/en\/wp-json\/wp\/v2\/pages\/171931\/revisions\/171932"}],"wp:attachment":[{"href":"https:\/\/www.podartis.com\/en\/wp-json\/wp\/v2\/media?parent=171931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}