How to redirect after payment using PayPal's javascript subscribe button

自作多情 提交于 2019-12-04 21:18:31
Athar Ahmed

Try this:

<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>

You have to enable Auto Return in your PayPal account. Otherwise it will ignore the return field.

From the documentation:

To set up Auto Return:

  1. Log in and click the Profile subtab under My Account.
  2. Click the Website Payment Preferences link under Selling Preferences.
  3. Click the On radio button to enable Auto Return.
  4. 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 stands for Instant Payment Notification. It will give you more reliable/useful information than what you'll get from auto-return.

Here is the link to the documentation: https://www.paypal.com/cgi-bin/webscr?cmd=p/mer/express_return_summary-outside

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!