Parsing PayPal Subscription Ran Out

前端 未结 3 1475
北海茫月
北海茫月 2020-12-19 18:11

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 stat

相关标签:
3条回答
  • 2020-12-19 18:44

    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.

    0 讨论(0)
  • 2020-12-19 18:55

    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.

    0 讨论(0)
  • 2020-12-19 18:55

    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;
     }
    
    0 讨论(0)
提交回复
热议问题