Subscription - How can i sent the request from Client to Server
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to create subscription from JS Call and getting Json error. Please check: IS there any document which uses smart button and send the request to API Call and get the reponse.
JS CODE
paypal.Buttons({
createSubscription: function (data, actions) {
return fetch('/AuthorizedNet/CreateSubscription/', {
method: 'post',
//headers: {
// 'content-type': 'application/json'
//}
}).then(function (res) {
//return { subscriptionID: res };
return res.json();
}).then(function (data) {
debugger;
return data.Id;
});
},
// Finalize the transaction
onApprove: function (data, actions) {
return fetch('/AuthorizedNet/PaypalCallBack/' + data.subscriptionID, {
method: 'post'
}).then(function (res) {
var a = JSON.parse(res);
return res.json();
}).then(function (details) {
// Show a success message to the buyer
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- User is asked for shipping address when creating a credit card order in REST APIs
- When I do PayPal capture Order, I keep on getting Invalid Request Connection in REST APIs
- Error: "Unable to change shipping method. Please try again." in PayPal popup in REST APIs
- webhook not send update notification in REST APIs
- Can't process subscription on Wordpress website in PayPal Payments Standard