简体   繁体   English

自定义计费周期的 Paypal 定期付款

[英]Paypal recurring payment for custom billing cycle

I am working on a website in PHP that needs custom cycle for paypal recurring payment.我正在一个 PHP 网站上工作,该网站需要自定义周期来进行贝宝定期付款。 Ex: a customer wants to receive a product in every 15 days.例如:客户希望每 15 天收到一次产品。 So paypal should process billing in every 15 days for the customer.因此,paypal 应该每 15 天为客户处理一次账单。 Others can ask for the same in 30 days, and so on.其他人可以在 30 天内提出同样的要求,依此类推。

I also need the payment status to be updated.我还需要更新付款状态。 I guess paypal will send some data when a recurring payment is done.我猜贝宝会在定期付款完成后发送一些数据。 Not getting clear instructions on implementing the recurring.没有得到关于实施重复性的明确说明。 What I am getting is to create the recurring payment button from paypal account.我得到的是从贝宝帐户创建定期付款按钮。

Can anyone help me on this?谁可以帮我这个事?

Assuming the number of days is chosen at checkout time and never changes for that particular customer's custom billing cycle...假设天数是在结帐时选择的,并且对于该特定客户的自定义计费周期永远不会改变......

Quick solution:快速解决方案:

You can generate a "Subscribe" button via http://www.paypal.com/buttons for a certain number of days, say 15 days.您可以通过http://www.paypal.com/buttons生成特定天数(例如 15 天)的“订阅”按钮。 In "Step 2", uncheck the option to save the button at PayPal.在“第 2 步”中,取消选中在 PayPal 保存按钮的选项。 Once you have generated the code, click the option to remove the code protection.生成代码后,单击删除代码保护的选项。

This will give you plain HTML, and "15" will be one of the variables there.这将为您提供纯 HTML,“15”将是那里的变量之一。 Possible variables are documented at https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/可能的变量记录在https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

So, you can change that hidden input to be of type "text" -- or alternatively to still be hidden but set by your javascript or server-side code, and have a dynamic button for X number of days.因此,您可以将该隐藏输入更改为“文本”类型——或者仍然隐藏但由您的 javascript 或服务器端代码设置,并具有 X 天的动态按钮。 The image can also be changed to one of your own, of course.当然,图像也可以更改为您自己的图像之一。

More involved solution: integrate one of PayPal's recurring subscription APIs, which will accomplish much the same thing as that HTML button.更复杂的解决方案:集成 PayPal 的定期订阅 API 之一,这将完成与 HTML 按钮大致相同的事情。 This seems to be the newest API: https://developer.paypal.com/docs/subscriptions/这似乎是最新的 API: https : //developer.paypal.com/docs/subscriptions/

(The API and the HTML button are separate products , and not interchangeable in terms of how you manage existing recurring profiles later on, so if you need a full-fledged API, best integrate it from day 1 rather than using the HTML button) (API 和 HTML 按钮是单独的产品,在以后管理现有重复配置文件的方式方面不可互换,因此如果您需要成熟的 API,最好从第一天开始集成它,而不是使用 HTML 按钮)


If the first assumption does not hold, and you need customers to be able to adjust the billing cycle at a later date after checkout, then things get more complicated.如果第一个假设不成立,并且您需要客户能够在结账后的晚些时候调整计费周期,那么事情就会变得更加复杂。


As far as getting payment status updates, you can integrate PayPal's webhook service: https://developer.paypal.com/docs/integration/direct/webhooks/至于获取付款状态更新,您可以集成 PayPal 的 webhook 服务: https : //developer.paypal.com/docs/integration/direct/webhooks/

There is also an older IPN service that is similar in function还有一个旧的IPN服务,功能类似

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

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