paypal.Button.render({
payment: function() {
var booksPurchaseRequest = {};
booksPurchaseRequest.amount = 20;
return paypal.request
.post(CREATE_PAYMENT_URL, JSON.stringify(booksPurchaseRequest))
.then(function(data) {
return data.paymentId;
});
}
}, '#paypal-button');
In this approach, on the internal server, I get the data in the format application / x-www-form-urlencoded , but I need application / json . How can i achieve this? Is it possible to replace paypal.request.post () with plain $ .ajax ()?
source
share