Search code examples
paypalpaypal-ipnpaypal-subscriptions

How to get notification about user cancel the sunbscription in paypal api?


I am using paypal ipn. I am getting the data and store it in the db. 1. But how to get the notification that user have canceled the subscription? The GetRecurringPaymentsProfileDetails is not working for me. 2. Does the "payment_date" from the IPN updates every month with ipn notification if there is a subscription? So I can use this date to find the canceled user if there is no "payment_date" update for more than 32 days? Thanks.


Solution

  • This is pretty simple if you have already implemented the PayPal IPN part.

    According to documentation here PayPal IPN variables

    1. You receive an IPN call with txn_type = recurring_payment_profile_cancel or some other transaction types for example subscr_cancel based on what happened.

      There will be a payer_id and recurring_payment_id that you can use to identify the user and agreement maybe.

    2. About the date and other information some IPN contain the next payment date also but you should give some days after expiry as paypal may take some time to send you an IPN.

    Do take a look at documentation for more transaction types available.

    Hope these points clear your doubts. other IPN variables worth consideration are : recurring_payment_skipped , recurring_payment_suspended , recurring_payment_suspended_due_to_max_failed_payment , subscr_cancel subscr_failed