简体   繁体   English

使用PayPal自适应付款和即时付款通知时,我必须提供returnURL吗?

[英]Do I have to provide a returnURL when using PayPal Adaptive Payments and Instant Payment Notifications?

My app is built with Rails and I'm using the PayPal Adaptive Payments gem but this question is not specific to Rails so please don't run away, you might be able to answer it. 我的应用程序是使用Rails构建的,并且我使用的是PayPal Adaptive Payments gem,但是此问题并非特定于Rails,因此请不要逃避,您也许可以回答它。

Users of my app can transfer money from their PayPal account to their UserWallet on my site. 我的应用程序的用户可以将钱从他们的PayPal帐户转到我网站上的UserWallet。

To get to the page where I let them do this they must click on two AJAX links. 要进入我让他们这样做的页面,他们必须单击两个AJAX链接。

Because I'm using the embedded payments flow, the PayPal stuff happens in a nice modal window, but PayPal docs seem to want me to provide a returnURL so that they can perform a GET request on it when the flow completes. 因为我使用的是嵌入式付款流程,所以PayPal的东西发生在一个不错的模态窗口中,但是PayPal文档似乎希望我提供returnURL,以便他们在流程完成时可以对其执行GET请求。

I definitely don't want to redirect the browser window after the Payment has gone through. 付款完成后,我绝对不想重定向浏览器窗口。

Do I have to send a returnURL? 我必须发送returnURL吗? I've got an instant payment notifications controller to handle the PayPal response and I can use js.erb to update the page on my site myself meaning that the user won't lose the AJAX state that the calling page is in. 我有一个即时付款通知控制器来处理PayPal响应,而且我可以使用js.erb自己更新网站上的页面,这意味着用户不会丢失调用页面所在的AJAX状态。

Do I understand you correctly that you're working with Embedded Payments (within a lightbox window) and you simply want to close it rather than redirect anywhere? 我是否正确理解您正在使用嵌入式支付(在灯箱窗口中)并且只想关闭它而不是将其重定向到任何地方?

If so, all you need to do is prepare a return.rb (or whatever the extension is) with nothing but the PayPal javascript included and the following snippet. 如果是这样,您所需要做的就是准备一个return.rb(或任何扩展名),只包含PayPal javascript和以下代码段。

dgFlow = top.dgFlow || top.opener.top.dgFlow;
dgFlow.closeFlow();
top.close();

It will actually redirect to that script, which will immediately close the window leaving the user right back where they were before they started the payment process. 它实际上将重定向到该脚本,该脚本将立即关闭窗口,使用户重新回到开始付款过程之前的位置。

More details are available about your flow options here: https://developer.paypal.com/docs/classic/adaptive-payments/integration-guide/APIntro/ 有关您的流程选项的更多详细信息,请参见: https//developer.paypal.com/docs/classic/adaptive-payments/integration-guide/APIntro/

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

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