Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Pay amount displaying 0 in confirmPlatformPaySetupIntent #1436

Closed
Filippo39 opened this issue Jun 27, 2023 · 15 comments · Fixed by #1511 or #1524
Closed

Google Pay amount displaying 0 in confirmPlatformPaySetupIntent #1436

Filippo39 opened this issue Jun 27, 2023 · 15 comments · Fixed by #1511 or #1524
Labels
android blocked Don't start work on this until label is removed

Comments

@Filippo39
Copy link

In my application, setupIntent is used for payment management, where in some cases the price is known and in others it is not. In Android, the confirmPlatformPaySetupIntent function does not allow setting the displayed amount (it always shows €0.00) nor a label to provide more details to the user.
After doing some research, I noticed that a similar issue has already been resolved for Flutter.
flutter-stripe/flutter_stripe#1250

I was wondering if it would be possible to get the same modification for React Native.

  • Device: Redmi Note 10
  • OS: Android
  • Version 11
  • SDK version 0.27.2
@charliecruzan-stripe
Copy link
Collaborator

hi @Filippo39 ! Could you provide some more info for me to reproduce Google Pay showing 0 for the price? On my device the price isn't showing (either for payment intents or setup intents) and in Google's docs, it states "This price is not displayed to the user." so they state you should show the price in your own UI.

@charliecruzan-stripe charliecruzan-stripe added android reproduce Try and reproduce the issue labels Aug 4, 2023
@Filippo39
Copy link
Author

Filippo39 commented Aug 4, 2023

@charliecruzan-stripe I'm using:

const { error } = await confirmPlatformPaySetupIntent(
  res.data.clientSecret,
  getStripeConfirmParam(...)
)

where getStripConfirmParam returns for google:

  googlePay: {
    testEnv: testEnv,
    merchantName: 'Test SRL',
    merchantCountryCode: 'IT',
    currencyCode: 'EUR',
    existingPaymentMethodRequired: false,
  },

and it shows: 2023-08-04_14-13

@charliecruzan-stripe
Copy link
Collaborator

thanks! It was the merchantCountryCode- I guess Google shows this for EU countries. I've asked the stripe-android team about this, but in the meantime you can use createPlatformPayPaymentMethod which does let you set an amount

@charliecruzan-stripe charliecruzan-stripe added blocked Don't start work on this until label is removed and removed reproduce Try and reproduce the issue labels Aug 4, 2023
@tillh-stripe
Copy link

Hi @Filippo39 👋 I’m from Stripe’s Android team. We reached out to our contacts at Google to understand whether we can just pass in a null amount for setup intents. If that’s possible, it would hide the Pay merchant line entirely. I’ll let you know once we hear back.

@Filippo39
Copy link
Author

Hi @tillh-stripe, it would be nice to have the possibility to show a custom amount for android, in order to keep consistency with ios:

applePay: {
    cartItems: [
      ...cartItems.map(
        (item) =>
          ({
            label: item.label,
            amount: X,
            paymentType: PlatformPay.PaymentType.Immediate,
          } as PlatformPay.CartSummaryItem)
      ),
      {
        label: 'Total',
        amount: totalAmount,
        paymentType: PlatformPay.PaymentType.Immediate,
      },
    ],
    merchantCountryCode: 'IT',
    currencyCode: 'EUR',
  },

@tillh-stripe
Copy link

Makes sense. I’ll look into making that possible!

@dmengelt
Copy link

@tillh-stripe passing in a null amount is not possible. I believe what @Filippo39 suggested (aligning with Apple Pay) is the best solution going forward.

Technically, there is a way to "hide" the Pay merchant line by setting totalPriceStatus=NOT_CURRENTLY_KNOWN. However, this should not be used for EEA countries and therefore isn't a solution in this case.

@tillh-stripe
Copy link

Gotcha, thanks for confirming, @dmengelt.

@Filippo39 I’ll look into adding support for a custom amount on Android.

@tillh-stripe
Copy link

We just merged the necessary change on Android: stripe/stripe-android#7191

Once @charliecruzan-stripe adds the necessary React Native support, you’ll be able to provide a custom amount (and a custom label!) for setup intents.

@Filippo39
Copy link
Author

Unfortunately, despite this change, I continue to see €0, perhaps there is a block on the part of Google Pay

  googlePay: {
    testEnv: testEnv,
    merchantName: 'Test SRL',
    merchantCountryCode: 'IT',
    currencyCode: 'EUR',
    existingPaymentMethodRequired: false,
    amount: 10,
    label: 'Label'
  },

@charliecruzan-stripe
Copy link
Collaborator

hi @Filippo39 , this is working for me on the most recent version, using the same code you shared above-
Screenshot 2023-09-28 at 7 57 19 AM

Are you sure you're on the most recent version?

@Filippo39
Copy link
Author

Yes it works, I had to clear the node modules after updating the library, thanks

@Filippo39
Copy link
Author

@charliecruzan-stripe
I still have two questions:

  • There is a reason why on Android an amount of amount: 100 corresponds to 1€ while on iOS an amount: 100 corresponds to €100
  • Also according to GooglePayBaseParams the amount and label should be two optional fields, but if I avoid settings them, a crash occurs
    image

@charliecruzan-stripe
Copy link
Collaborator

There is a reason why on Android an amount of amount: 100 corresponds to 1€ while on iOS an amount: 100 corresponds to €100

Different behaviors of Apple Pay/Google Pay. I'll reflect that in the docs.

Also according to GooglePayBaseParams the amount and label should be two optional fields, but if I avoid settings them, a crash occurs

Fixed this, sorry about that!

@tuanlevi95
Copy link

There is a reason why on Android an amount of amount: 100 corresponds to 1€ while on iOS an amount: 100 corresponds to €100

Different behaviors of Apple Pay/Google Pay. I'll reflect that in the docs.

Also according to GooglePayBaseParams the amount and label should be two optional fields, but if I avoid settings them, a crash occurs

Fixed this, sorry about that!

what is the docs of Different behaviors of Apple Pay/Google Pay.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android blocked Don't start work on this until label is removed
Projects
None yet
5 participants