braintree / braintree-web

A suite of tools for integrating Braintree in the browser
https://developer.paypal.com/braintree/docs/start/hello-client/javascript/v3
MIT License
444 stars 134 forks source link

Syntax Error: Failed to Execute on Window: Invalid target origin: null #728

Open seankang92129 opened 1 month ago

seankang92129 commented 1 month ago

General information

Issue description

How to set the origin when the cc hosted fields are inside an iframe of a flutter web application?

image image braintree_v3_widget.dart.pdf

seankang92129 commented 1 month ago

In the deprecated v2 SDK documentation there is an enableCORS option when creating the braintree.setup, is there a way to pass this kind of similar options to the v3 SDK when I instantiate the client?

braintree.client.create({

authorization: 'sandbox_MYSANDBOXTOKENIZATIONKEY'

}, function (clientErr, clientInstance) { }

seankang92129 commented 1 month ago

i also tried to run a sample v3 javascript running on a separate ec2, and I enabled CORS on the express node js server. the page loads, but when I try to generate the nonce, it get the same error.

seankang92129 commented 1 month ago

directly interacting with my nodejs server via a separate stand alone browser, it works

seankang92129 commented 1 month ago

i think I found the culprit -- if I replace the webview_flutter plugin for flutter with a different webview https://pub.dev/packages/webview_all, and point the webview to a separate CORS enabled web site, then the issue above about the null target origin goes away.