Stumped On Subscriptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I understand how to create a subscription through the Rest API, but I don't see any documentation on how to get the user to approve the subscription after I create it.
So I followed the documentation's suggestion about using the Rest API to create a plan, and then use a smart button to get the user to accept the subscription (bypassing the Rest API to create the subscription).
The problem is that when using their "smart" buttons, there is no way I can tell to pass in a plan id variable:
paypal.Buttons({
style: {color: 'blue', shape: 'rect', label: 'pay', height: 40},
createSubscription: function(data, actions) {
return actions.subscription.create({ 'plan_id': 'XXXXXXXXXX', application_context: { shipping_preference: 'NO_SHIPPING' } });
},
onApprove: function(data) {
window.location.href = "<URL>?SubscriptionID=" + data.subscriptionID;
//alert('You have successfully created subscription ' + data.subscriptionID);
//document.getElementById("btnSubscriptionComplete").click();
}
}).render('#paypal-button-container');
Can someone either show me how to replace the XXXXXXXXXX with an assigned variable value or show me how to get a user to approve a subscription created via the REST API Create Subscription method?
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Subscription in Sandbox gives : We’re sorry Things don’t appear to be working at the moment in Sandbox Environment
- App selection for Subscription Button in Sandbox Environment
- Remove physical address fields in PayPal Payments Standard
- recurring payments when price maybe changed and price have 2 decimal point in REST APIs
- can we assign a unique detail to every subscription creation? in NVP/SOAP APIs