-
Notifications
You must be signed in to change notification settings - Fork 18
understanding differences from regular cordova-plugin-inappbrowser #3
Comments
If your goal is simply to support Braintree/Paypal payments in your Cordova app, you don't need this plugin. In fact you don't even need However, this plugin is designed to solve a very specific use case: that is where a remote/external webpage contains the Braintree JS SDK to facilitate a Web-based PayPal checkout flow. In this use case, the app/Cordova Webview itself does not contain any Braintree/Paypal-related code, but it is contained as the Braintree JS SDK in the remote webpage which is opening in the inapp browser (IAB), i.e. The Braintree JS SDK enables Web-based Paypal payments using a popup window via And herein lies the problem when using This cross-webview messaging problem is why Braintree created the native PopupBridge solutions, which allow native app webviews with a page containing the Braintree JS SDK to communicate with a page in the system browser containing the Paypal checkout page. This plugin takes the native Android and iOS PopupBridge solutions created by Braintree and applies them to the inapp browser webview, which enables pages loaded into the IAB which contain the Braintree JS SDK to successfully make Paypal payments by opening the PayPal "popup" in the system browser and enable cross-frame comms back the page inside the IAB webview. Hope that all makes sense. As for the build error you got, unsure what would cause that but you can try building the example project to see if it's related to your build environment vs your particular project. |
Thanks you so much for the detailed response! I thought that Yes, I'm trying to encapsulate a regular web payment form with Braintree into a webview so this project is definitely what I need. I'm using PhoneGap Build and the build log just gives a line number of a file that was generated and I can't see... I'll see if I can figure it out and come back with some more useful details. |
figured out the issue and created #4 to address it |
I think I may be confused again... I was hoping to use this to have a Braintree payment dropin within the regular webview and then have a IAB that opens to process the PayPal portion. It seems like I have to open the page with the payment dropin in an IAB using If I have control over the page with the dropin, is it possible to override |
In order to achieve PopupBridge communication from the Cordova app webview, you'd need to augment the Cordova app webview itself to support PopupBridge. This is beyond the specific-scope of this plugin which is a remote/external webpage opened in the IAB which contains the Braintree JS SDK. Even then, PopupBridge will open the PayPal webpage in the system browser, not the Inapp Browser. While all of this could technically be solved it would require extensive customisation of the native Cordova and PopupBridge code. If you plan to integrate Braintree payments directly within the Cordova app webview, you ma be better to use |
Here's what I'm trying to do: I have a page that's loaded from a server into the webview that was using the v2 Javascript dropin. The v2 one didn't have the popup so it worked fine in a regular browser or the webview. I'm trying to make the page work in both a regular browser and also the Cordova webview with the v3 dropin. I tried using I tried using I realize that what I'm doing is completely out of the scope of this project now, but I'm explaining it on the off chance you have any suggestions. I really appreciate all the time you've spent already to reply to these issues! I think I may either revert it to a v2 dropin or just prevent PayPal from being used when within Cordova. It's a shame, though, because I like how the v3 dropin works if it wasn't for this popup issue. |
I'm submitting a ... (check one with "x"):
Bug report
I'm trying to understand why this project is needed over using the regular cordova-plugin-inappbrowser . The Braintree dropin makes a call to
window.open
and expects to get results back. The regular call to window.open opens in the regular browser so it doesn't work, but doesn't using cordova-plugin-inappbrowser solve that? I think the dropin is programmed to callpopupBridge
if defined and then usewindow.open
otherwise so isn'twindow.open = cordova.InAppBrowser.open
enough? Or does the regular cordova-plugin-inappbrowser not return content properly?I'm asking these questions (and came to this repo) because I tried just using the regular cordova-plugin-inappbrowser but couldn't get it to work and am trying to understand why (still opens in browser). Also, I tried using this repo but I got compile errors (unfortunately the error only says
AAPT: error: unbound prefix.
so I'm having issues figuring out why) so wasn't able to figure out if my original problem with cordova-plugin-inappbrowser is solved here.Sorry for all the questions... It seems like Braintree's PopupBridge and cordova-plugin-inappbrowser do the same thing, so I'm confused why both are needed in combination.
The text was updated successfully, but these errors were encountered: