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

PostalCode is not sent with cardDetails #420

Closed
Brotakuu opened this issue Jul 14, 2021 · 2 comments · Fixed by #451
Closed

PostalCode is not sent with cardDetails #420

Brotakuu opened this issue Jul 14, 2021 · 2 comments · Fixed by #451
Labels
bug Something isn't working P0 Address these issues first

Comments

@Brotakuu
Copy link

Brotakuu commented Jul 14, 2021

I'm following the example in SetupFuturePaymentScreen, but I have enabled postalCodeEnabled={true} for better compliance.

<CardField
	postalCodeEnabled={true}
	onCardChange={(cardDetails) => {
	  console.log('card details', cardDetails);
	}}
	style={styles.cardField}
/>

In the example, postalCodeEnabled is false so the postalCode is set manually. But I have enabled user input for postalCode, yet the postalCode does not get sent along with the card details.


// 2. Gather customer billing information (ex. email)
const billingDetails: PaymentMethodCreateParams.BillingDetails = {
    phone: '+48888000888',
    addressCity: 'Houston',
    addressCountry: 'US',
    addressLine1: '1459  Circle Drive',
    addressLine2: 'Texas',
    // addressPostalCode: '77063', // REMOVED POSTAL CODE
}; // mocked data for tests

// 3. Confirm setup intent
const { error, setupIntent: setupIntentResult } = await confirmSetupIntent(
    clientSecret,
    {
        type: 'Card',
        billingDetails,
    }
);

The postalCode that the user inputted did not get sent to stripe. Do I need to do this manually by setting the state of the zipcode during input?


<CardField
	postalCodeEnabled={true}
	onCardChange={(cardDetails) => {
	  console.log('card details', cardDetails);
	  setPostalCode(cardDetails.postalCode)
	}}
	style={styles.cardField}
/>
@thorsten-stripe thorsten-stripe added bug Something isn't working P0 Address these issues first labels Jul 16, 2021
@tt0mmy
Copy link

tt0mmy commented Jul 20, 2021

I believe you'll need to structure your data differently. the data arg should have a shape like this:

const data: ConfirmSetupIntent.Params = {
      type: 'Card',
      billingDetails,
    }

billingDetails should look like this: https://stripe.dev/stripe-react-native/api-reference/interfaces/paymentmethods.billingdetails.html

address should look like this: https://stripe.dev/stripe-react-native/api-reference/interfaces/paymentmethods.address.html
postalCode is in the address object.

@Brotakuu
Copy link
Author

@tantommy There no issue with the structure. But how can I retrieve the postalCode that the user entered when confirming the setupIntent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 Address these issues first
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants