stripe / stripe-js

Loading wrapper for Stripe.js
https://stripe.com/docs/js
MIT License
636 stars 157 forks source link

[BUG]: Google Pay PaymentRequestButtonElement subscribe #571

Closed amovsisyan closed 7 months ago

amovsisyan commented 9 months ago

What happened?

<PaymentRequestButtonElement options={{ style: {paymentRequestButton: {type: 'subscribe'}} }} /> PaymentRequestButtonElement does not provide type: 'subscribe' for a Google Pay

in payment-request-button.d.ts I can find this related to type

Google Pay: default, buy, or donate. Apple Pay: default, book, buy, donate, check-out, subscribe, reload, add-money, top-up, order, rent, support, contribute, tip

Why there is a limitation for type: 'subscribe' for Google Pay?

This is happening even in the latest version (3.+)

Environment

Version 121.0.6167.85 (Official Build) (arm64)

Reproduction

No response

fruchtose-stripe commented 8 months ago

Hi @amovsisyan. My apologies for the delay. I am looking into this.

awalker-stripe commented 7 months ago

Hello @amovsisyan,

Unfortunately this is a limitation with just the Payment Request Button. Since the Payment Request Button is one of our legacy Elements, we aren't able to offer some of these other ways of customizing.

If you are working on a brand new integration, I encourage you to check out the Express Checkout Element, which offers subscribe for Google Pay (along with many other types), additional payment methods such as Paypal and Amazon Pay, and more. You can view a full integration guide here: https://docs.stripe.com/elements/express-checkout-element

Our PaymentRequest library also supports showing a custom button, where you can display your own Google Pay button and call paymentRequest.show() once the user clicks on it. Depending on what you're after, this may be able to offer more customizability as well: https://docs.stripe.com/stripe-js/elements/payment-request-button?client=react#react-own-button