简体   繁体   English

重复付款和Paypal后更新到期日期

[英]Update expiry date after recurring payment and Paypal

I'm looking to use Paypal to accept Credit Cards for a subscription service site. 我希望使用Paypal接受订阅服务网站的信用卡。 For example, someone would subscribe to the site and pay monthly. 例如,某人会订阅该网站并每月付款。 If they cancel, they would lose access to the site. 如果取消,则将无法访问该站点。

Customers would pay and get one month access and be billed monthly. 客户将支付并获得一个月的访问权限,并按月计费。 Upon initially subscribing, an expiry date would be stored on the user account and if expired, the customer would lose access to the site. 最初订阅后,有效期将存储在用户帐户中,如果过期,则客户将无法访问该站点。

How would I go about pushing the expiry date back one month every time a payment goes through successfully using Paypal and PHP ? 每当使用PaypalPHP成功完成Paypal ,我将如何将到期日期推迟一个月?

Is this the best way to go about handling these kinds of subscriptions? 这是处理此类订阅的最佳方法吗?

Thanks for any input! 感谢您的输入!

UPDATE : Once the subscription is made a PROFILEID number is given by Paypal and I will store it in a database. UPDATE :进行订阅后,贝宝会提供一个PROFILEID号,我将其存储在数据库中。 Whenever a user logs in, I want to query Paypal to see if they have paid using the the PROFILEID tied to the account. 每当用户登录时,我都想查询Paypal以查看他们是否已使用绑定到该帐户的PROFILEID进行了付款。

How would I go about querying Paypal for that? 我该如何查询Paypal

There are two ways for doing this:- 有两种方法可以做到这一点:

  1. Save the both dates ( start date and expiry date ) with the user in same table. 与用户将两个日期(开始日期和到期日期)保存在同一表中。 And update them both when user make payment. 并在用户付款时更新它们。 Start date would be when user make payment and you can calculate end date and save them in table. 开始日期是用户付款时,您可以计算结束日期并将其保存在表格中。
  2. Secondly, you can store both dates in different table with user's key as foreign key and and new values to this table when ever user makes payment. 其次,您可以将两个日期都存储在不同的表中,并以用户的密钥作为外键,并在用户付款时向该表存储新值。 And check for latest entry into table to check for user's subscriptions. 并检查表中的最新条目以检查用户的订阅。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM