Redirect onApprove of Subscription
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to add a redirect to a specific page after a user has successfully subscribed. Below is the code I would like to modify with the example I made. Any help would be greatly appreciated.
PayPal pre-created code :
onApprove: function(data, actions) {
alert(data.subscriptionID); // You can add optional success message for the subscriber here
}
My example of what I'm trying to do:
onApprove: function(data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture().then(function(details) {
//After payment is taken, we redirect the user to the success page.
window.location.replace("/success.php?id=<?php echo intval($id); ?>");
});
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good day @DEPDESIGN
Thank you for posting to the PayPal community.
I would recommend including an option to input the return URL during the subscription creation process.
I kindly request that you refer to the detailed guide linked below for further assistance:
https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_create
If your still facing issues, please create an MTS ticket via - https://www.paypal-support.com/s/?language=en_US with the detailed information and error details.
Sincerely,
Kavya
PayPal MTS
If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Change the button from Sandbox to Production in REST APIs
- Simple Paypal button integration results in 404 error in Sandbox Environment
- I Have PayPal API Billing Authentication Failure Python-Flask in REST APIs
- Buyer has not agreed to subscription in REST APIs
- Can i create subscription and plans directly in JavaScript on the page ? in PayPal Payments Standard