I have a web application and I am looking to implement the following flow:
- Merchants log in to PayPal as described here.
- I obtain the authorization code and exchange it for an access token.
- With the access token, I make calls to the Payments REST API to create payments on behalf of the merchant.
I successfully tested this flow using Postman. Now, as I integrate it into my web app, I want to open the authorize dialog in a new window when a merchant clicks on the "Connect Paypal" button within my app using window.open(). However, when I expected PayPal to redirect in the same popup window, it actually closes the popup window and redirects in the parent window instead.
I have attempted setting childWindow.opener as null, but this only resulted in PayPal closing the popup window without any redirects.
Below is an example of the code I am using to open the window:
var child = window.open('https://www.sandbox.paypal.com/signin/authorize?client_id=<client_id>&response_type=code&redirect_uri=<redirect_url_in_my_app>');
Does anyone have suggestions on how to ensure all redirects occur in the child popup window rather than the parent one?