{"id":675,"date":"2022-12-29T22:56:20","date_gmt":"2022-12-29T14:56:20","guid":{"rendered":"https:\/\/hqwav.net\/?page_id=675"},"modified":"2023-01-03T17:21:59","modified_gmt":"2023-01-03T09:21:59","slug":"paypal-top-up","status":"publish","type":"page","link":"https:\/\/hqwav.net\/en\/paypal-top-up","title":{"rendered":"Paypal Top Up"},"content":{"rendered":"<div class=\"paypal-but-top\">\n<div id=\"coforpaypal-button-container-6a0465b33677a\" style=\"max-width: 300px;\"><div id=\"coforpaypal-button-6a0465b33677a\" style=\"max-width: 300px;\"><\/div><\/div>    <script>\n    jQuery(document).ready(function() {\n            \n        function initPayPalButton6a0465b33677a() {\n            var description = \"Recharge: USD 1.45, a total of 10 gold coins can be obtained\";\n            var amount = \"1.45\";\n            var totalamount = 0;\n            var shipping = \"\";\n            var currency = \"USD\";\n            var break_down_amount = false;\n            \n            var purchase_units = [];\n            purchase_units[0] = {};\n            purchase_units[0].amount = {};\n            \n            paypal.Buttons({\n                style: {\n                    layout: 'vertical',\n                    color: 'gold',\n                    shape: 'rect'\n                },\n                onInit: function (data, actions) {\n\n                },  \n                \n                onClick: function () {\n                    purchase_units[0].description = description;\n                    purchase_units[0].amount.value = amount;\n                    if(break_down_amount){\n                        purchase_units[0].amount.breakdown = {};\n                        purchase_units[0].amount.breakdown.item_total = {};\n                        purchase_units[0].amount.breakdown.item_total.currency_code = currency;\n                        purchase_units[0].amount.breakdown.item_total.value = amount;\n                    }\n                    if(shipping.length !== 0 && !isNaN(shipping)){\n                        purchase_units[0].amount.breakdown.shipping = {};\n                        purchase_units[0].amount.breakdown.shipping.currency_code = currency;\n                        purchase_units[0].amount.breakdown.shipping.value = shipping;\n                        totalamount = parseFloat(amount)+parseFloat(shipping);\n                    }\n                    if(totalamount > 0){\n                        purchase_units[0].amount.value = String(totalamount);\n                    }\n                },    \n                    \n                createOrder: function(data, actions) {\n                    return actions.order.create({\n                        purchase_units: purchase_units,\n                            \n                    });\n                },\n                            \n                onApprove: function(data, actions) {\n                    return actions.order.capture().then(function(details) {\n                        \/\/console.log('Transaction completed by ' + details.payer.name.given_name);\n                        \/\/console.log(details);\n                        var data = {\n                            'action': \"coforpaypal_ajax_process_order\",\n                            'coforpaypal_ajax_process_order': \"1\",\n                            'details': details \n                        };  \n                        jQuery.ajax({\n                            url : \"https:\/\/hqwav.net\/wp-admin\/admin-ajax.php\",\n                            type : \"POST\",\n                            data : data,\n                            success: function(response) {\n                                \/\/console.log(response);\n                                window.location.replace(\"https:\/\/hqwav.net\/paypal-top-up-contact\/\");\n                            }\n                        });\n                    });\n                },\n                                    \n                onError: function (err) {\n                    console.log(err);\n                },\n                                    \n                onCancel: function (data) {\n                    \n                }\n                    \n            }).render('#coforpaypal-button-6a0465b33677a');\n        }\n        initPayPalButton6a0465b33677a();\n    });                     \n    <\/script>        \n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-675","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/hqwav.net\/en\/wp-json\/wp\/v2\/pages\/675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hqwav.net\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hqwav.net\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hqwav.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hqwav.net\/en\/wp-json\/wp\/v2\/comments?post=675"}],"version-history":[{"count":0,"href":"https:\/\/hqwav.net\/en\/wp-json\/wp\/v2\/pages\/675\/revisions"}],"wp:attachment":[{"href":"https:\/\/hqwav.net\/en\/wp-json\/wp\/v2\/media?parent=675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}