question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Iframe with allowpaymentrequest property does not allow express payment methods

See original GitHub issue

Summary

stripe.paymentRequest does not have the same result as the native PaymentRequest when calling canMakePayment within an Iframe. The Iframe has the allowpaymentrequest attribute as specified in the documentation.

Other information

Sample stripe code

const paymentRequest = stripe.paymentRequest({
      country: 'US',
      currency: 'usd',
      total: {
        label: 'Demo total',
        amount: 0,
      },
      requestPayerName: true,
      requestPayerEmail: true,
      requestPayerPhone: true,
      requestShipping: true,
      shippingOptions: [],
    });

    paymentRequest.canMakePayment().then(result => {
      if (result) {
        // Always null
      }
    });

Sample native PaymentRequest code

new window.PaymentRequest(
      [
        {
          supportedMethods: 'https://google.com/pay',
          data: {
            ...
          }
        },
      ],
      {
        total: {
          label: 'Total',
          amount: {
            currency: 'USD',
            value: '0.00',
          },
        },
      },
    )
      .canMakePayment()
      .then(canPay => {
        // Returns true
      });

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hofman-stripecommented, Oct 3, 2020

There hasn’t been any changes that would cause Google Pay to stop working if it was before, neither in Chrome nor in Stripe.js. The main reason Google Pay wouldn’t work is if the Google Pay Payment Handler is not installed (Google Pay never used before on the browser), or if no cards are saved in the Google Pay wallet. You can verify the former by checking if a service worker with scope https://pay.google.com/gp/p/ is installed in chrome://serviceworker-internals/

0reactions
wesleyyeecommented, Oct 3, 2020

@hofman-stripe So has anything changed recently? The google pay functionality used to work but no longer does

Read more comments on GitHub >

github_iconTop Results From Across the Web

Payment Request API - W3C
This specification standardizes an API to allow merchants (i.e. web sites selling physical or digital goods) to utilize one or more payment ......
Read more >
HTMLIFrameElement.allowPaymentRequest - Web APIs | MDN
The allowPaymentRequest property of the HTMLIFrameElement interface returns a boolean value indicating whether the Payment Request API may ...
Read more >
Apple Pay Payment Request API iframe - Stack Overflow
The allowPaymentRequest property of the HTMLIFrameElement interface returns a Boolean indicating whether the Payment Request API may be ...
Read more >
Spreedly iFrame Payment Form
Spreedly's iFrame payment form is a pure, JavaScript library that provides two Spreedly-managed, fields for collecting the credit card number and CVV (the...
Read more >
HTML Iframes - GeeksforGeeks
An inline frame is used to embed another document within the current HTML document. The HTML iframe name attribute is used to specify...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found