title: Flutter Stripe Checkout: Failed to read the 'cookie' property from 'Document': Cookies are disabled inside 'data:'
body: <h2>Stripe Checkout in webview flutter app</h2>
  <p>Integrating Stripe checkout with Flutter mobile app. Worked with this in previous versions of Flutter &amp; <a href="https://pub.dev/packages/webview_flutter" rel="nofollow noreferrer">webview_flutter</a> plugin.</p>
  <p>But now its showing this error in console and stuck the webview at intial URL:</p>
  <pre><code>I/chromium(26312): [INFO:CONSOLE(1)] &quot;Stripe.js requires 'allow-same-origin' if sandboxed.&quot;, source: https://js.stripe.com/v3/ (1)
  I/chromium(26312): [INFO:CONSOLE(1)] &quot;Uncaught SecurityError: Failed to read the 'cookie' property from 'Document': Cookies are disabled inside 'data:' URLs.&quot;, source: https://js.stripe.com/v3/ (1)
  </code></pre>
  <h3>Flutter Code for Webview Stripe Checkout</h3>
  <pre class="lang-dart prettyprint-override"><code>class StripePaymentCheckout extends StatefulWidget {
    final String sessionId;
  
    const StripePaymentCheckout({Key key, this.sessionId}) : super(key: key);
    @override
    _StripePaymentCheckoutState createState() =&gt; _StripePaymentCheckoutState();
  }
  
  class _StripePaymentCheckoutState extends State&lt;StripePaymentCheckout&gt; {
    WebViewController _webViewController;
  
    String get initialUrl =&gt;
        &quot;data:text/html;base64,${base64Encode(const Utf8Encoder().convert(kStripeHTMLPage))}&quot;;
  
    static const String kStripeHTMLPage = '''
    &lt;!DOCTYPE html&gt;
    &lt;html&gt;
    &lt;script src=&quot;https://js.stripe.com/v3/&quot;&gt;&lt;/script&gt;
  
    &lt;head&gt;
        &lt;title&gt;Stripe Checkout&lt;/title&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
        &lt;div style=&quot;position: absolute; text-align: center; width:100%; height:100%; top:50%;&quot;&gt;
            &lt;h1&gt;Loading Stripe...!&lt;/h1&gt;
        &lt;/div&gt;
    &lt;/body&gt;
  
    &lt;/html&gt;
    ''';
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        resizeToAvoidBottomInset: false,
        body: SafeArea(
          child: WebView(
            initialCookies: [
              WebViewCookie(
                name: 'sessionid',
                value: widget.sessionId,
                domain: 'https://js.stripe.com/v3/',  // &lt;-- not sure what to do here.
              ),
            ],
            initialUrl: initialUrl,
            javascriptMode: JavascriptMode.unrestricted,
            onWebViewCreated: (webViewController) {
              _webViewController = webViewController;
            },
            onPageFinished: (String url) {
              if (url == initialUrl) {
                _redirectToStripe(widget.sessionId);
              }
            },
            navigationDelegate: (NavigationRequest request) {
              if (request.url.startsWith('https://success.com')) {
                Navigator.of(context).pop(&quot;success&quot;);
              } else if (request.url.startsWith('https://cancel.com')) {
                Navigator.of(context).pop('cancel');
              }
              return NavigationDecision.navigate;
            },
          ),
        ),
      );
    }
  
    Future&lt;void&gt; _redirectToStripe(String sessionId) async {
      final redirectToCheckoutJs = '''
      var stripe = Stripe('${dotenv.env['apiKey']}');
      
      stripe.redirectToCheckout({
        sessionId: '$sessionId'
      }).then(function (result) {
          result.error.message = 'Error'
      });
      ''';
  
      return await _webViewController
          .runJavascriptReturningResult(redirectToCheckoutJs);
    }
  }
  
  </code></pre>