如何使用PayPal的javascript订阅按钮付款后重定向 [英] How to redirect after payment using PayPal's javascript subscribe button
问题描述
这是我的脚本标记:
<script src="/data/js/paypal-button.min.js?merchant=MERCHANT_CODE"
data-button="subscribe"
data-name="Product - 1 Year Subscription"
data-amount="49.99"
data-recurrence="1"
data-period="Y"
data-callback="http://url"
data-cancel_return="http://url"
data-env="sandbox"
></script>
我不知道为什么以及如何正确地做到这一点但我尝试了几个PayPal的数据像notify,return,return_url等属性似乎没什么用。
I don't know why and how I should properly do it but I tried with several of PayPal's data attributes like notify, return, return_url and more but nothing seems to work.
我支付然后进入这个页面:
I pay and then get on this page:
但没有重定向到回调页面,我在做什么错了吗?
But no redirect to the callback page, what am I doing wrong please?
谢谢你,祝你有愉快的一天!
Thanks and have a nice day!
推荐答案
试试这个:
<script src="/data/js/paypal-button.min.js?merchant=MERCHANT_CODE"
data-button="subscribe"
data-name="Product - 1 Year Subscription"
data-amount="49.99"
data-recurrence="1"
data-period="Y"
data-callback="http://url"
data-cancel_return="http://url"
data-callback="http://yourdomain"
data-return="http://yourdomain"
data-env="sandbox"
></script>
您必须在PayPal帐户中启用自动退货。否则它将忽略 return
字段。
You have to enable Auto Return in your PayPal account. Otherwise it will ignore the return
field.
来自文档:
设置自动退货:
To set up Auto Return:
- 登录并点击我的帐户下的配置文件子标签。
- 单击销售首选项下的网站付款首选项链接。
- 单击打开单选按钮以启用自动返回。
- 输入返回URL。注意:您必须符合返回网址要求
以设置自动回报。 了解更多
关于返回网址。
- Log in and click the Profile subtab under My Account.
- Click the Website Payment Preferences link under Selling Preferences.
- Click the On radio button to enable Auto Return.
- Enter the Return URL. Note: You must meet the Return URL requirements in order to set up Auto Return. Learn more about Return URL.
IPN代表即时付款通知。它将为您提供比自动返回更可靠/有用的信息。
IPN stands for Instant Payment Notification. It will give you more reliable/useful information than what you'll get from auto-return.
以下是文档的链接: https://www.paypal.com/cgi-bin/webscr?cmd=p/ mer / express_return_summary-outside
这篇关于如何使用PayPal的javascript订阅按钮付款后重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!