Paypal IPN get subscription end date (recurring)

ⅰ亾dé卋堺 提交于 2021-02-10 14:51:01

问题


I'm developing a site that has annual or monthly paypal subscription options. From the IPN data that receives, can I determine if the subscription is annual or monthly? Doesn't seem possible.

At the moment it's set up just for monthly payments, so in my own db I store something along the lines of:

$data = array(              
              'id'                  => $ipnData['custom'],
              'subscribed'          => 1,
              'subscription_fee'    => $ipnData['mc_amount3'],
              'subscribed_until'    => date("Y-m-d H:i:s",strtotime($ipnData['subscr_date'] . '+1 Month'))
              );

You'll see I'm using the subscription_date variable and just incrementing it by a month. But now, potentially subscriptions can be annual, and I need somehow to get the date in which the next payment would be taken. This doesn't seem to be a variable? A return of the original T3 would be great.

I can do this with custom fields, but that seems a bit daft. Cheers.


回答1:


PayPal will send a notification when the subscription ends: txn_type = "subscr_eot"

The moment you receive this is the moment the subscription expires. This is when you would downgrade/cancel their account. Note that this is different from txn_type="subscr_cancel" which is triggered when a user cancels their subscription; this could be the day after they subscribe and they may have time remaining on the subscription. In this case you will still receive the subscr_eot when the time runs out.

I also found this to be a bit counter-intuitive.



来源:https://stackoverflow.com/questions/10539764/paypal-ipn-get-subscription-end-date-recurring

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