使用 PayPal 实施免费试用期不会返回任何自定义参数

发布于 2024-11-27 23:15:47 字数 2059 浏览 1 评论 0原文

最近两天一直被这个问题困扰。

场景

我们有一个基于网络的产品,用户可以免费注册 14 天,此后每月订阅费用为 60.00 美元。一旦用户点击“使用 Paypal 付款”按钮,页面将把用户带到 Paypal,一旦他们完成付款,它就会重定向回我们的网站。所有传递的参数看起来都很好,因为我作为商家和用户使用沙箱进行了测试。我们在“网站支付首选项”下的商家资料设置中使用“返回 URL”属性。

研究

最类似的问题是使用PayPal实施免费试用期和< a href="https://stackoverflow.com/questions/4244134/paypal-subscription-free-Trial-isnt-working">Paypal 订阅免费试用不起作用,但我的问题有点不同。而且第一个问题中指向的文件也不是有效的链接。

问题

当用户返回到我们的网站时,我们无法检索在初始重定向到 PayPal 期间传入的自定义变量。基本上它只是一个空白重定向,没有任何查询字符串或 post 参数。但后来我尝试在前 14 天收取一定费用而不是免费,然后返回所有查询字符串。我们的流程取决于自定义参数,我们将支付宝 ID 与实际客户数据进行映射。

我们的代码看起来像,

<form name='paypal' action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='business' value='[email protected]'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='cmd' value='_xclick-subscriptions'>
<input type='hidden' name='a3' value='60.00'>
<input type='hidden' name='item_name' value='Product A'>"
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='custom' value='parameter1|parameter2'>
<input type='hidden' name='item_number' value='PlanCode'>
<input type='hidden' name='p3' value='1'>"
<input type='hidden' name='t3' value='M'>"
<input type='hidden' name='a1' value='0'>" 
<input type='hidden' name='p1' value='14'>" 
<input type='hidden' name='t1' value='D'> 
</form>

我尝试添加,

<input type='hidden' name='rm' value='1'>

但没有运气。

请问

  1. 为什么“a1=0”14天都拿不到回调参数?但是如果我将“a1”设置为大于 0,相同的代码会起作用吗?
  2. 我是否缺少任何参数?或者我在回电时使用了错误的方法? (我正在使用返回 URL)
  3. 使用 IPN 怎么样?我从 PayPal 网站了解到 IPN 不是实时的。由于我们的应用程序依赖于下一个注册流程的自定义数据,我想知道可以使用它吗?如果是这样,首先要研究的文档是什么?

Got stuck with this issue for last 2 days.

Scenario

We have a web based product where users can signup for free for 14 days and thereafter monthly subscription of say $60.00. Once users clicked "Pay with Paypal" button out page will taken users to Paypal and once they have done the payment it redirects back to our website. All the parameters were passed looks fine, since i tested with sandbox as merchant and user. we were using Return URL property on merchant profile setting under Website Payment Preferences.

Research

Most similar questions are Implementing a free trial period with PayPal and Paypal subscription free trial isn't working but my issue is bit different. And also the document pointed in the first question is not a valid link.

Issue

When user's being returned back to our website, we can not retrieve custom variable which we passed in during initial redirection to PayPal. Basically it was just a blank redirection without any query-string or post parameter. But then i try to charge an amount for first 14 days instead of free, then all query string returned. Our flow is depend on the custom parameter where we map pay pal id with actual customer data.

Our code looks like,

<form name='paypal' action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='business' value='[email protected]'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='cmd' value='_xclick-subscriptions'>
<input type='hidden' name='a3' value='60.00'>
<input type='hidden' name='item_name' value='Product A'>"
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='custom' value='parameter1|parameter2'>
<input type='hidden' name='item_number' value='PlanCode'>
<input type='hidden' name='p3' value='1'>"
<input type='hidden' name='t3' value='M'>"
<input type='hidden' name='a1' value='0'>" 
<input type='hidden' name='p1' value='14'>" 
<input type='hidden' name='t1' value='D'> 
</form>

I tried by adding,

<input type='hidden' name='rm' value='1'>

But no luck.

Questions

  1. why i couldn't get callback parameters when "a1=0" for 14 days? But the same code works if i set "a1" bigger than 0?
  2. Am i missing any parameter? or i am using wrong approach on call back? (I am using Return URL)
  3. What about using IPN? I understood from PayPal site IPN is not real-time. Since our application relies on custom data for next signup flow, i wonder is it ok to use it? If so what would be the initial doc to be studied?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒解孤独 2024-12-04 23:15:47

我从贝宝论坛得到了这个问题的答复。我将其添加为答案,因为这将在将来帮助其他开发人员。另外一个很好的 IPN 的起点

响应是,

“如果您使用 PDT,那么什么都不会因为没有付款,所以信息才会被发送回来,我建议使用 IPN 来返回。不返回,例如他们的浏览器窗口意外崩溃并关闭,或者他们只是将其关闭,不会发回任何信息并且会丢失,这就是为什么 rm 变量和 PDT 更多地用于创建动态收据,因为它不会。依靠买家返回您的网站。”

“如果需要,您还可以通过 IPN 将数据重新发送到您的系统,并且您还可以在付款后立即在您的帐户中查看您的 IPN 历史记录。完全的。”

请参阅原始问题

I got response from paypal forum for this question. I am adding this as answer as this will help other developers in future. Also good starting point for IPN

Response was,

"If you are using PDT, then nothing will be sent back as no payment is taking place. Information will only be sent back if you are making a payment. I would recommend using IPN. Both the rm variable and PDT are dependent on the buyer returning back to your site. If the buyer does not return, such as their browser window unexpectedly crashes and closes, or they simply shut it no information will be sent back and it will be lost. This is why the rm variable and PDT are used more for creating dynamic receipts. IPN is more used for updating your system as it does not rely on the buyer returning back to your site. "

"Also with IPN you can resend the data to your system if you need to, and you can also view your IPN history from within your account. IPN usually takes place right after the payment is completed."

Please Refer for Original question

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文