Parsing PayPal Subscription Ran Out

我的梦境 提交于 2019-11-28 05:31:45

问题


On PayPal subscriptions, it appears that all I need to do is treat it like a regular IPN except look at the txn_type field. When I see one of the following status codes, I send an email to the admin to consider expiring that member manually in the admin panel of my software I'm building in PHP.

The statuses appear to be one of the following to indicate the customer either cancelled, had an end of term, or simply isn't paying anymore. Can anyone confirm that these are the right statuses to check for, or have I included a couple that aren't right?

  • subscr_cancel
  • subscr_eot
  • subscr_failed
  • recurring_payment_failed
  • recurring_payment_suspended_due_to_max_failed_payment
  • recurring_payment_outstanding_payment_failed
  • recurring_payment_profile_cancel
  • recurring_payment_expired

回答1:


If you've gone through the subscription button mechanism, and it's not one of the pre-approved recurring payment things then you'll only see the "subscr" prefixed ones, I think.

I personally don't respond to "subscr_cancel" in my app. The IPN for that is sent the moment the users cancels. I don't want to disable their access at that point so I wait for the "subscr_eot" one and do it then.

So if they sign up for a year, and cancel the next day, they still have access to the end of the year, which is when PayPal will send the "subscr_eot". They'll always send both.




回答2:


I found that these are the ones to watch regarding "end of membership" type reactions in my code:

  • subscr_cancel
  • subscr_eot
  • recurring_payment_profile_canceled
  • recurring_payment_expired

All others are just "noise" regarding "end of membership" status. For instance, to react to any payment "failure" type IPNs would be wrong because eventually PayPal may rectify that problem with the customer after a reattempt, and so cancellation and expiration events are really what you should look for.




回答3:


I know i'm kind of late in this post, but here is a quick solution (php) for your question:

switch ($_POST['txn_type']) {
    case 'cart':
          //for products without subscription
     break;
    case 'subscr_payment':
        //subscription payment recieved
        break;

    case 'subscr_signup':
        //subscription bought payment pending
        break;

    case 'subscr_eot':
       //subscription end of term
        break;

    case 'subscr_cancel':
        //subscription canceled
        break;
 }


来源:https://stackoverflow.com/questions/13855287/parsing-paypal-subscription-ran-out

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!