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

Add currencyCode support to initPaymentSheet for Google Pay & Setup Intents #774

Conversation

brendanm-stripe
Copy link
Collaborator

Necessary to support Setup Intents including Google Pay

const { error } = await initPaymentSheet({
      customerId: customer,
      customerEphemeralKeySecret: ephemeralKey,
      setupIntentClientSecret: setupIntentClientSecret,
      customFlow: false,
      merchantDisplayName: 'Example Inc.',
      applePay: true,
      merchantCountryCode: 'US',
      currencyCode: 'USD', // this is required for setup intents
      style: 'automatic',
      googlePay: true,
      testEnv: true,
      primaryButtonColor: '#635BFF', // Blurple
      returnURL: 'stripe-example://stripe-redirect',
      defaultBillingDetails: billingDetails,
      allowsDelayedPaymentMethods: true,
    });

@brnunes-stripe
Copy link

This fix is correct.
Google Pay requires a currency code and Setup Intents don't have that field, so we need the user to tell us in the Google Pay configuration.
I'm not familiar with the React codebase, but it would be good to document that somewhere, similar to how we do on the Android SDK.

@brendanm-stripe
Copy link
Collaborator Author

While there is not currently an example screen for Payment Sheet + Setup Intent, the non-Payment Sheet Google Pay docs do mention this currencyCode requirement:
https://github.com/stripe/stripe-react-native/blob/master/docs/GooglePay.md#present-google-pay-sheet

and this is also noted in the Android SDK docs: https://stripe.com/docs/payments/save-and-reuse?platform=android&ui=payment-sheet#add-google-pay

In parallel to this PR, I've got a draft of changed to add this to the RN docs here: https://stripe.com/docs/payments/save-and-reuse?platform=react-native&ui=payment-sheet#add-google-pay

@julestruong
Copy link

Hey guyz, thx a lot for this PR this could save my day.
Any update on the ETA ?

Copy link
Collaborator

@charliecruzan-stripe charliecruzan-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this fix 🙏 just one small question

src/types/PaymentSheet.ts Show resolved Hide resolved
@charliecruzan-stripe charliecruzan-stripe merged commit 403f37e into stripe:master Feb 1, 2022
@brendanm-stripe
Copy link
Collaborator Author

Docs updated here: https://stripe.com/docs/payments/save-and-reuse?platform=react-native&ui=payment-sheet#react-native-google-pay

const { error, paymentOption } = await initPaymentSheet({
  // ...
  googlePay: true,
  merchantCountryCode: 'US',
  currencyCode: 'USD', // currency must be specified for setup mode
  testEnv: true, // use test environment
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants