贝宝(Paypal)订阅IPN-用户多次订阅的问题 [英] Paypal subscriptions IPN - problem with users subscribing multiple times

查看:111
本文介绍了贝宝(Paypal)订阅IPN-用户多次订阅的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Paypal订阅和即时付款通知(IPN)来处理我网站上的订阅者.

I'm using paypal subscriptions and the instant payment notification (IPN) to handle subscribers on my site.

在大多数情况下,它运行良好,但偶尔会遇到一个问题.

For the most part it works well but there is one occasional problem I've encountered.

通常,如果用户取消订阅,则我将等待学期结束"(subscr_eot)通知,然后再禁止访问我的网站.

Usually if a user cancels their subscription, I wait for the "end of term" (subscr_eot) notification before disabling access to my site.

因此,如果他们预付了整个月的费用,然后立即取消,则他们仍然可以使用该月的剩余时间(应该是这样).

So if they prepay for the whole month, and then cancel right away, they still have access for the rest of the month (as it should be).

但是某些用户在以下位置遇到此问题:

But some users are having this problem where they:

  1. 取消订阅
  2. 在达到任期结束"之前,他们决定重新订阅
  3. 当他们的第一个订阅达到期限"时,我的应用会收到通知,并向用户发送一封电子邮件,其中包含您的帐户已被禁用,如果您想再次注册,可以通过单击此处重新订阅."
  4. 这使他们感到困惑,因为他们在想...那太奇怪了,我以为我像一个星期前一样订阅了(他们也这样做了).因此,他们再次订阅.现在他们有两个同时运行的对我的网站的订阅,一两个月后我会收到支持电子邮件("wtf,您本月两次向我收取了帐单!")

因此,我还没有找到解决此问题的好方法.我猜最好的解决方案是在收到期满"通知时,再进行一次API调用,询问Paypal这个人已经重新订阅了吗?".如果是这样,则无需启动该电子邮件.但是我还没有任何方法可以进行此API调用.

So I haven't found a good way to fix this. I guess the best solution would be to do an additional API call when the "end of term" notification is received which asks paypal "hey did this person already re-subscribe?". If so then no need to fire off that email. But I haven't seen any way to do this API call yet.

另一种解决方案是当他们取消帐户时立即禁用他们的帐户("subscr_cancel"通知),但随后我收到不同的愤怒支持电子邮件嘿,我预付了整月的费用,为什么我的帐户已被禁用!".

Another solution is to disable their account immediately when they cancel (the "subscr_cancel" notification) but then I get different angry support emails "hey I prepaid for the whole month why was my account disabled already!!".

还有其他人解决吗?

推荐答案

我知道这是一个老话题,但是我还没有看到这个问题的实际答案,所以如果有人像我一样想知道这个问题,这是一个解决方案.

I know this is an old thread, but I haven't seen an actual answer to this question, so if someone happens to wonder across this like I did, here's a solution.

如果有人在学期结束(subscr_eot)之前取消了其帐户(subscr_cancel),我将在数据库中对其进行设置以进行处理.例如,如果您的数据库中有一个用户"表,则只需添加一个新的"int"字段并将其命名为"Term"即可.默认情况下,此字段应设置为"0".然后,在您的IPN内部进行设置,以便如果用户在期限结束之前取消其订阅,则它将该用户的期限"字段设置为"1".如果该用户返回并重新订阅您的服务,请让IPN将该用户的期限"字段更新为"0".

If someone cancels their account (subscr_cancel) before their end of term (subscr_eot) I would set it up in my database to handle it. For instance, if you have a "Users" table in your database, just add a new "int" field and call it "Term." By default, this field should be set to "0." Then, inside of your IPN, set it up so that if a user cancels their subscription before the end of the term, it sets the "Term" field for that user to "1." If that user goes back and re-subscribes to your services, have the IPN update the "Term" field for that user back to "0."

然后,在您的邮件脚本内部,当它在学期末运行时,请检查该用户的学期"字段.如果将其设置为"0",则不要发送电子邮件.如果将其设置为"1",则发送电子邮件,说"Adios!".

Then, inside of your mailing script, just have it check the "Term" field for that user when it runs for the end of term. If it's set to "0" then don't send the email. If it's set to "1" then send the email saying, "Adios!"

这篇关于贝宝(Paypal)订阅IPN-用户多次订阅的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆