Вопрос

Here's my script tag:

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

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: enter image description here

But no redirect to the callback page, what am I doing wrong please?

Thanks and have a nice day!

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top