本文介绍了Paypal IPN 获取订阅结束日期(重复)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个具有年度或每月贝宝订阅选项的网站.从收到的 IPN 数据中,我可以确定订阅是年度还是月度订阅吗?似乎不可能.

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'))
              );

您会看到我正在使用 subscription_date 变量并将其增加一个月.但是现在,潜在的订阅可能是每年一次,我需要以某种方式获得下一次付款的日期.这似乎不是一个变量?原始 T3 的回归会很棒.

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.

推荐答案

PayPal 将在订阅结束时发送通知:txn_type = "subscr_eot"

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

您收到此信息的那一刻就是订阅到期的那一刻.这是您降级/取消他们的帐户的时候.请注意,这与用户取消订阅时触发的 txn_type="subscr_cancel" 不同;这可能是他们订阅后的第二天,他们可能还有时间订阅.在这种情况下,当时间用完时,您仍然会收到 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.

这篇关于Paypal IPN 获取订阅结束日期(重复)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 13:42