Reputation: 191
I'm creating an website where you have to pay 1 dollar/month to use an account. Ok, it is working, but the person who uses it can access paypal website and cancel the recurring payment, but still use the account. How can I solve it? The codes that I'm using: https://github.com/hrendoh/PayPal-Recurring-Payment-example
Upvotes: 0
Views: 124
Reputation: 26036
You'll need to setup Instant Payment Notification (IPN) to handle that.
Any time any transaction hits your PayPal account (whether it's a payment, a new subscription, a failed payment, a suspended profile, a refund, a customer dispute, etc.) the PayPal server will POST data about that transaction to a script you have sitting on your server.
Your script can receive that data and process it however you need to, so in this case you would get an IPN with a txn_type=recurring_payment_profile_cancel. Based on that, you could then update your own database to show their account is canceled and then not allow them to login.
Alternatively, you could use the GetRecurringPaymentsProfileDetails API to check the current status of the profile each time somebody logs in to your app, and if it's not Active, react accordingly.
Upvotes: 2