Hi, I'm doing the paypal integration in the server side, using java, got stuck in the following code in the front end with the javascript erro of - 'fetch' is undefined The paypal popup screen appears then disappears. Any help please? <script src="https://www.paypal.com/sdk/js?client-id=my-idxxxxxxxx"></script> <div id="paypal-button-container"></div> <script> paypal.Buttons({ createOrder: function() { return fetch('<%=request.getContextPath()%>/paypalCreateOrder.htm', { method: 'post', headers: { 'content-type': 'application/json' } }).then(function(res) { return res.json(); }).then(function(data) { return data.orderID; }); }, onApprove: function(data) { return fetch('<%=request.getContextPath()%>/paypalCaptureOrder.htm', { method: 'post', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ orderID: data.orderID }) }).then(function(res) { return res.json(); }).then(function(details) { alert('Transaction approved by ' + details.payer_given_name); }); } }).render('#paypal-button-container'); </script>
... View more