3

I saw some websites open new tab on paypal button click. I'm trying to implement the same behaviour but cannot find the way how to do that. It always opens the pop-up on the same page. Is there a way of doing it with JavaScript intagration.

The method I use https://developer.paypal.com/docs/checkout/#

If you go by the link above and click on paypal button (demo example) it will open a popup where you do your payment and then it closes. I want the same to happen in new tab instead of popup.

Tyler Mc
  • 228
  • 1
  • 7
Ararat Harutyunyan
  • 916
  • 1
  • 8
  • 19
  • I believe if you add `target="_blank"` to the PayPal form element, it will work as you desire – marsnebulasoup Aug 17 '20 at 13:20
  • More info: [submit a form in a new tab](https://stackoverflow.com/questions/5709590/submit-a-form-in-a-new-tab) – marsnebulasoup Aug 17 '20 at 13:22
  • @MarsNebulaSoup there is no form I use the following method https://developer.paypal.com/docs/checkout/# – Ararat Harutyunyan Aug 17 '20 at 13:23
  • 2
    _“I use the following method”_ - maybe the sites you saw this on are using something different then? Just because those buttons looked similar, must not necessarily mean they are the same thing. (I don’t think these buttons are _made_ for the kind of flow you want. Even if you managed to open this in a popup, the _result_ would then probably also “happen” inside the popup, and you would need to take additional steps to get the necessary info/data back to your main page.) – CBroe Aug 17 '20 at 13:27
  • @CBroe from the point of view of Javascript there is no difference between opening a popup or new tab. I thought there can be an option to define it that I cannot find in docs – Ararat Harutyunyan Aug 17 '20 at 13:30
  • Well, there are slight differences. Not sure if we are talking about either of them to begin with though - your phrasing _“It always opens the pop-up on the same page”_ sounds like there is not actual popup involved in the first place, but you are rather talking about a _redirect_ to paypal and then back, in the current, existing window …? – CBroe Aug 17 '20 at 13:35
  • @CBroe yes the phrasing maybe is not so well. I will try to explain the problem better here. If you go by the link included in the question and click on paypal button (demo example) it will open a popup where you do your payment and then it closes. I want the same to happen in new tab instead of popup and not redirect the current page. – Ararat Harutyunyan Aug 17 '20 at 13:44
  • That already opens in a new tab for me, because I have my browser configured that way. I doubt there is any way for you to influence this for other users though; PayPal does not seem to offer any options in that regard. – CBroe Aug 17 '20 at 13:52

1 Answers1

2

You would need to not integrate with the PayPal Checkout JS, and instead create your own button and write your own JS to open the Orders V2 API redirect_url in a new tab when your button is clicked.

There is no reason you should want to do this, however. The popup is in fact a better, modern "in context" experience that keeps your site open and loaded in the background. It is in fact more user-friendly in this respect. I remember from the days when this popup was first released, PayPal spent spent a lot of effort getting the experience right and making sure it performed better, i.e. resulted in more users going through with and completing the checkout, than going away to a new separate tab (that might be unfamiliar). You can trust PayPal on this, it's the company's bread and butter.

Preston PHX
  • 27,642
  • 4
  • 24
  • 44