I am currently integrating Paypal subscriptions into my ReactJS WebApp.
A user shall be able to subscribe (and pay a small fee) to use premium features.
I wonder how to handle cancellations. What I would expect is when a user subscribes for a one-year period and then immediately cancels, he/she shall still be able to use the service for the paid period (one year).
With my current solution, however, upon cancelling, the access to premium features vanish immediately and does not let the user to access the service he paid for(and cancelled later).
My current solution looks like this:
- Subscribing already works by using this paypal button: https://www.npmjs.com/package/react-paypal-button-v2#subscription-example-usage
- Cancelling also works using this API call: https://developer.paypal.com/docs/subscriptions/full-integration/subscription-management/#cancel-subscription
This also triggers a webhook of my app with the event
BILLING.SUBSCRIPTION.CANCELLED
. Then immediately the account is cancelled and the user cannot use the features he already paid for.
How do the events BILLING.SUBSCRIPTION.CANCELLED
, BILLING.SUBSCRIPTION.EXPIRED
, BILLING.SUBSCRIPTION.SUSPENDED
, BILLING.SUBSCRIPTION.ACTIVATED
relate to each other ? I did not find any documentation about his.
Is there an event or a workflow that I can use to accomplish what I intend ? I currently develop this using the sandbox features.
Or do I have to implement the necessary logic by myself?