#Raghav.elements-billing
1 messages · Page 1 of 1 (latest)
Hey there! Which Elements are you using? The answer is generally no, unless you're using the Payment Element and the selected payment method requires address info
i am using the payment element @sage oyster to collect my customer's card details using the setupIntent
So you can't require the billing fields, only set them to be automatically determined by the selected payment method: https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-fields
Complete reference documentation for the Stripe JavaScript SDK.
If you need to capture billing address, then you'll need to do that separately
then what is the use of useElements() hook
That hook is used to pass the payment details collect by the payment element to the confirmPayment function.
so do you guys have any example code that uses stripe-react ShippingAddressElement @stark trellis
I'm not sure off the top of my head, let me see what I can find.
Alright let me also do some quick googling from my side
Also if i directly use the component i am getting the following err
Uncaught IntegrationError: A valid Element name must be provided. Valid Elements are:
card, cardNumber, cardExpiry, cardCvc, postalCode, paymentRequestButton, iban, idealBank, p24Bank, auBankAccount, fpxBank, afterpayClearpayMessage; you passed: shippingAddress.
I'm pretty sure shippingAddress is more of an object than an element
But it's naming conventions suggests that it's an element
Apologies for the confusion, it seems that element is still in the works and isn't ready for consumption yet.
well, what is the alternative that I can use? @stark trellis
Apologies, there may not be a way, but I'm still working on double checking that.
Thank you for your patience while I confirmed things.
So there isn't a way to force the Payment Element to collect billing information. It will collect these details if they are necessary for the payment method selected, but otherwise it won't. You will need to collect these details elsewhere in your flow.