Manage subscriptions with REST API and handle errors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to manage subscriptions using the REST API based on this link https://developer.paypal.com/docs/subscriptions/integrate/#4-create-a-subscription. To create and approve the subscription I first create a product and plan server side using the REST API and then give the user the paypal button experience: paypal.Buttons( ... createSubscription ... .render('#paypal-button-container');
The user is redirected to the paypal checkout and after approve the subscription, a callback function is called (onApprove) and back to my website.
With the returned information from paypal, I update my website with the subscription id and state, in case of an error, how do I obtain the subscription details if my website, somehow isn't able to record the subscription ID?
I have the plan informaiton because it is created server side with REST API calls but, I can't find relation between the plan id and the subscriptions. As soon as the user takes control and approves the subscription, if anything fails, I no longer can obtain the subscription state.
Thank you
Best regards
- Labels:
-
Future Payments REST APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This API command will return the subscription with the plan ID: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_get
Also webhooks.
However there's no way to record custom data, so if the smart button fails then there's no way to know which user it was that signed up!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, thank you for your quick reply.
I've tried to use the get method https://api.sandbox.paypal.com/v1/billing/subscriptions/P-56608679GK7201450LXJKKKQ where the id is the plan ID but with no success. Is this link correct?
I've obtained the following responde:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No you give it the subscription ID to get the details of the subscription. That includes the plan ID.
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Error: "Unable to change shipping method. Please try again." in PayPal popup in REST APIs
- Simple Paypal button integration results in 404 error in Sandbox Environment
- How to Process PayPal Subscription Refund With API? in REST APIs
- I Have PayPal API Billing Authentication Failure Python-Flask in REST APIs
- IPN SHOWS NO HTTP RESPONSE - LISTENER WORKS WITH LOCAL FORM POST in Sandbox Environment