I'm setting recurrent payments using Paypal Rest API V1. I'm doing all integration on a rest API, I'm not using any SDK on frontend. This is how my app is working:
1 - An unlogged and unregistered user clicks on a button which will create a paypal subscription.
2 - The frontend redirects the user to the url returned from the created subscription response (paypal API).
3 - User ends the checkout then my API register an account to it with ones e-mail checkout and a random password.
But some problems came in:
If for some reason user cancels the subscription then sign it again, can I just create a new subscription for this customer? and how can BILLING.PLAN.ACTIVATED webhook tell my API this user was a subscriptor before?
When the subscription is created, add a custom_id
field with a value that identifies the user that is subscribing. This custom_id value will be returned in future webhooks.
You can build all your logic off the PAYMENT.SALE.COMPLETED
webhook alone; the BILLING.PLAN.ACTIVATED webhook is less useful.
Instead of redirecting away from your site, adding the JS SDK for an in-context approval flow is a superior user experience.