#_andriiko
1 messages ยท Page 1 of 1 (latest)
Hi ๐ our Elements can't be used to collect custom data that they don't already collect. You will need to include your own fields to collect and provide those details.
With regards to part 1, what does your flow look like currently? When do you surface the address element, and where are you hoping to put the information that it collects?
Hi ๐ our Elements can't be used to collect custom data that they don't already collect. You will need to include your own fields to collect and provide those details.
Sure, if I create my custom field, how can I send its value to Stripe when confirming payment usingstripe.confirmPayment()?
Right now, I'm exposing an AddressElement with the Billing type. In the Stripe dashboard, I can see this address in the Payment method section, but it's not appearing in the downloaded invoice.
It depends on the information the field is collecting. If it's supporting by billing_details then you can provide it when confirming the payment:
https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method_data-billing_details
If the data is directly related to a payment though, such as the VAT number you referenced, additional flows will need to be built.
Are you hoping to collect VAT details to influence the amount of the Invoice you're processing a payment for? If so, that data will need to collected sooner, because once the Invoice is finalized it can't be updated.
I believe the bill to section on the Invoice pulls from the Customer object. If you update the address on the Customer object before finalizing their Invoice, do you then see the address included on the Invoice?
https://stripe.com/docs/api/customers/update#update_customer-address
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Checking
Are you hoping to collect VAT details to influence the amount of the Invoice you're processing a payment for?
No, I just want to display a custom field in invoice file after customer payment
I can't figure out how to use the entered information from AddressElement in stripe.confirmPayment() so that it reflects in the invoice after payment.
Gotcha, in that case, you will need to take the value you collected from your custom VAT field, provide it to your backend server, and then make a request to update the associated Invoice's custom fields with that value:
https://stripe.com/docs/api/invoices/update#update_invoice-custom_fields
I don't recall offhand if custom_fields are still editable for a finalized Invoice, and you may encounter an error if that field does get locked on finalization. If that is the case, those values will need to be provided before the Invoice is finalized.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Okay, and what about Address Element in billing mode. How to get data from AddressElement in invoice?
I don't believe the Address Element is able to pump the data it collects into an Invoice directly, because Invoices pull billing details from Customer objects but the Address Element provides the information it collects to Payment Methods.
I would recommend trying the following:
- Pull the information collected from the Address Element:
https://stripe.com/docs/js/elements_object/get_value_address_element - Use that information to update the Customer the Invoice was created for
- Download a new copy of the Invoice PDF to see if it picked up the new address details.