redirect_urls vs onAuthorize/onCancel callbacks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I have a question regarding the Create Payment API. I'm a little bit confused about the redirect_urls. If I'm using PayPal Checkout components (https://github.com/paypal/paypal-checkout), under what circumstances would the user be redirected to the provided return_url / cancel_url?
As far as I understand, with these components the buyer approval flow will open up in a new browser window (pop-up) and close upon completion. After the flow is completed, the onAuthorize or onCancel callback will be fired on the window where the button was rendered. I don't see any place in this flow where any of the redirect_urls would be used though? Nevertheless, creating a payment using the API requires me to provide them.
Could someone shed light on this? Is there some kind of fallback for scenarios where the browser blocks popups that users would get full-page redirected to the payment approval page on paypal.com and then back to the provided return_url? Or is it just "legacy" field and I can trust it to never be used?
I'm wondering if I need to implement the "on authorize" / "on cancel" logic in two places, both in the onAuthorize callback and on the pages referred in redirect_urls.
For reference, this is the payload I'm sending:
{ intent: "sale", payer: { payment_method: "paypal" }, transactions: [{ amount: { total: "99.99", currency: "USD" } }], redirect_urls: { return_url: "https://mysite.com/thanks", cancel_url: "https://mysite.com/cancel" } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- PayPal Redirection Issue After Successful Payment in Photobooth Integration in Sandbox Environment
- Help Creating Order using Card Fields in SDKs
- Using the api to make payments works in Sandbox but not in Live in REST APIs
- How get the card number + expiry date on gateway callback? in PayPal Payments Standard
- when I payout , webhook URL cannot receive callbacks. in Sandbox Environment