var notifyUrl = "BurgerJointIPN.php"; paypal.Buttons({ createOrder: function(data, actions) { return actions.order.create({ "purchase_units": [{ "amount":{ "value":"22.00" }, "item_list": { "items": [{ "name": 'hat', "quantity":'5', "price":'2.00' },{ "name": 'bat', "quantity":'2', "price":'20.00' }] }, "NOTIFYURL": "@notifyUrl" }] }); }, onError: function (err) { // Show an error page here, when an error occurs alert(err); }, onApprove: function(data, actions){ return actions.order.capture().then(function(details) { alert('Transaction completed by ' + details.payer.name.given_name); // Call your server to save the transaction return fetch('/PPTest/BurgerJoint/GetOrder.php', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ orderID: data.orderID }) }); }); } }).render('#paypal-button-container');
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)