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:
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:
- 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 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
来源:https://stackoverflow.com/questions/18178474/how-to-redirect-after-payment-using-paypals-javascript-subscribe-button