#anstev
1 messages · Page 1 of 1 (latest)
Hi there one moment
Unfortunately that doesn't look like it's possible
You can see the docs for PaymentSheet here: https://stripe.dev/stripe-react-native/api-reference/index.html#initPaymentSheet
Documentation for @stripe/stripe-react-native
And then go through the options you can pass
Thanks nonetheless, appreciate it
No problem
Can it be preset if I know it beforehand?
Yep there's a billing details option within SetupParams
Just follow the docs I linked
https://stripe.dev/stripe-react-native/api-reference/index.html#initPaymentSheet ->
https://stripe.dev/stripe-react-native/api-reference/modules/PaymentSheet.html#SetupParams ->
https://stripe.dev/stripe-react-native/api-reference/interfaces/BillingDetails.html ->
https://stripe.dev/stripe-react-native/api-reference/interfaces/Address.html
Saw that. Tried it as follows:
const { error } = await initPaymentSheet({
customerId: customer,
customerEphemeralKeySecret: ephemeralKey,
paymentIntentClientSecret: clientSecret,
merchantDisplayName: merchantDisplayName,
appearance: customAppearance,
defaultBillingDetails: {
name: cartData.billing_first_name+" "+cartData.billing_last_name,
email: cartData.email,
address: {
city: cartData.bill_address_city,
country: cartData.bill_address_country,
line1: cartData.bill_address_address1,
line2: cartData.bill_address_address2,
postalCode: cartData.bill_address_postal_code,
state: cartData.bill_address_province
}
}
});
the billing adress country and zip in the payment sheet were not set accordingly after initialization
Everything else was preset though?
This is what the sheet rendered as
And you logged all the cartData prior to initializing the payment sheet to verify that data isn't null
the data is not null, correct. It might be a string mismatch issue, (e.x. abbreviation vs non-abbreviation). I'm going to log the address object right now.
{"city": "Mississauga", "country": "Canada", "line1": "2392 Street Avenue", "line2": null, "postalCode": "123 456", "state": "ON"}
Hm i'm not sure off-hand if that would affect things. Try manually passing in data to the initPaymentSheet function. And try "CA" for the country instead
Cool cool