Hi, I'm trying the JavaScript SDK integration and copied the following from the PP instructions but get this PHP syntax error ..... Parse error: syntax error, unexpected '{' on line 2 (the start of the code). I'm a bit of a noob and don't see why. paypal.Buttons({
env: 'sandbox', // sandbox | production
// payment() is called when the button is clicked
createOrder: function() {
return fetch('/my-server/create-paypal-transaction')
.then(function(res) {
return res.json();
}).then(function(data) {
return data.orderID;
});
},
// onAuthorize() is called when the buyer approves the payment
onApprove: function(data, actions) {
return fetch('/my-server/capture-paypal-transaction', {
body: JSON.stringify({
orderID: data.orderID
})
}).then(function(res) {
return res.json();
}).then(function(details) {
alert('Transaction funds captured from ' + details.payer_given_name);
});
}
}).render('#paypal-button-container');
... View more