简体   繁体   English

贝宝订阅-IPN处理和网站流量?

[英]PayPal Subscriptions - IPN Handling and Site Flow?

For my membership site, I've got the IPN handler done. 对于我的会员网站,我已经完成了IPN处理程序。 My question is one of site "flow". 我的问题是网站“流程”之一。

Here's how it goes: User -> Landing -> SignUp -> Verify -> PayPal -> ThankYou 流程如下:用户->登陆->注册->验证->贝宝-> ThankYou

So here's the problem (which could just all be in my head). 这就是问题所在(可能全在我脑海中)。 Let's say you've signed up and verified your account. 假设您已经注册并验证了您的帐户。 Then you click the "Subscribe!" 然后单击“订阅!” link and are sent to paypal - where you complete payment and get sent to the "Thank You" page. 链接并发送到贝宝-您在此完成付款并发送到“谢谢”页面。

What if the IPN doesn't arrive back to my site quickly? 如果IPN不能快速返回我的站点怎么办? The subscribe link will still be there, and users may click it again thinking they've not subscribed (even though they have, it's just taking time). 订阅链接仍将存在,并且用户可能会再次点击它,以为他们尚未订阅(即使他们已经订阅,这只是花时间)。

If I combat this by updating their profile to say... "Activating..." when they click the "Subscribe" link, and they don't complete the PayPal process... it could be forever saying "Activating...". 如果我通过在单击“订阅”链接时更新他们的个人资料以说“正在激活...”来解决这个问题,而他们没有完成PayPal流程,那么可能永远会说“正在激活...” ”。

Just curious, as this is my first time integrating PayPal: 很好奇,因为这是我第一次集成PayPal:

  • How do you handle the state between the time the user clicks the subscribe link and it takes for the IPN process to complete? 在用户单击订阅链接到完成IPN流程之间,您如何处理状态?

  • Have you ever had any issues with IPN's not arriving quickly? 您是否曾经遇到IPN赶不上的问题?

I've never had any issue with IPN not arriving quickly, but then again I have never really had a huge website with a lot of users. 我从来没有遇到过IPN不能很快到达的问题,但是我再也没有真正拥有过一个拥有大量用户的大型网站。 I also didn't make any significant changes to a user account until I received the IPN. 在收到IPN之前,我也没有对用户帐户进行任何重大更改。

I made a paid registration for one of my websites using the paypal API. 我使用Paypal API对我的一个网站进行了付费注册。 A user would fill out their username, password, etc. and I would pass the variables to the paypal API. 用户将填写其用户名,密码等,然后将变量传递给Paypal API。 The data wouldn't be acted on until I did receive the IPN. 在收到IPN之前,不会对数据进行处理。

You could always associate a timestamp with a pending payment if you feel the status "Activating..." is important within a user profile. 如果您认为用户个人资料中的状态“正在激活...”很重要,则可以始终将时间戳与待处理的付款相关联。 A pending payment could timeout after 10 minutes. 待处理的付款可能会在10分钟后超时。

Your question suggests that the connection to the remote server is asynchronous (ajax)? 您的问题表明与远程服务器的连接是异步的(ajax)?

It's probably easier to write it in a synchronous manner, so the IPN is guaranteed to return. 以同步方式编写它可能更容易,因此可以保证IPN可以返回。 If it doesn't, it means that: 如果不是,则表示:

a) The user closed the browser after being redirected to the remote server; a)用户重定向到远程服务器后关闭了浏览器;
b) The remote server did not respond. b)远程服务器没有响应。

Good payment gateways will redirect the user back to your site if they click maybe the "Cancel" button, but a return is never guaranteed, so you need to handle it correctly. 优质的支付网关会在用户单击“取消”按钮时将用户重定向到您的站点,但是永远不能保证返回,因此您需要正确处理它。

I would have a separate table to log the transactions for a given user; 我将有一个单独的表来记录给定用户的交易; that is: 那是:

one user, many transactions 一个用户,很多交易

Some payment gateways allow you to define as callback to your server when a transaction is completed. 某些支付网关允许您将交易完成时定义为对服务器的回调。 That is, the connection is initiated by the gateway -- it does not run the browser, as the user can close the tab/window -- where it does a post to your callback URL, and then you update the status of the transaction. 也就是说,连接是由网关启动的-它不运行浏览器,因为用户可以关闭选项卡/窗口-在该处向您的回调URL发布信息,然后更新事务状态。

I'm not sure if PayPal does allow for such things, but so far, I've never had issues with PayPal because I've always written it in a synchronous manner. 我不确定PayPal是否允许这些事情,但是到目前为止,我从未遇到过PayPal的问题,因为我始终以同步方式编写它。

Of course, if asynchronous is required, then your ajax function has to have a timeout/error handler -- I recommend jQuery, of course. 当然,如果需要异步,那么您的ajax函数必须具有超时/错误处理程序-当然,我建议使用jQuery。

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

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