stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

Cannot import CollectionMode and AddressCollectionMode

Open zdnk opened this issue 1 year ago • 2 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce

import { AddressCollectionMode, CollectionMode } from '@stripe/stripe-react-native/lib/typescript/src/types/PaymentSheet';

Unable to resolve "@stripe/stripe-react-native/lib/typescript/src/types/PaymentSheet"

import { AddressCollectionMode, CollectionMode } from '@stripe/stripe-react-native'; does not work either

Additional context Stripe RN version: 0.27.2

zdnk avatar May 29 '23 14:05 zdnk

Just found out the correct access is document here: https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#collect-billing-details

      billingDetailsCollectionConfiguration: {
        address: PaymentSheet.AddressCollectionMode.NEVER,
        email: PaymentSheet.CollectionMode.NEVER,
        name: PaymentSheet.CollectionMode.NEVER,
        phone: PaymentSheet.CollectionMode.NEVER,
      },

I am just gonna note that it is not intuitive since IDEs will probably hint to import from @stripe/stripe-react-native/lib/typescript/src/types/PaymentSheet

zdnk avatar May 29 '23 14:05 zdnk

this import also works:

import { AddressCollectionMode, CollectionMode } from '@stripe/stripe-react-native/src/types/PaymentSheet';

micaww avatar Jun 27 '23 01:06 micaww