#victoria - invoice custom field
1 messages ยท Page 1 of 1 (latest)
Hello! Just starting a thread for you -- I'll review and respond as soon as I can ๐
Custom fields are a bit tricky in their shape
oh hang on, there are two things here
first, you're trying to set that within metadata -- metadata values can only be strings (not objects)
If you want to set the custom fields you should be updating the custom_fields parameter:
https://stripe.com/docs/api/invoices/update#update_invoice-custom_fields
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Note that this is an array of hashes with name and value
so you'd need to send:
custom_fields=[{"name": "payment_identifier", "value": "01"}]
or something similar
Or if you do mean to use metadata, then you need to flatten the value to a string
oohh right!
ok, that makes sense now!
im going to test this way and see if it works
๐
thanks in advance!
NP!
ok, this works! but where can i see this custom field in my stripe dashboard?
Hmm it doesnt appear to be on the invoice page, but you can see it on the invoice pdf:
and how can i get this pdf?
Or you can get the URL in the Invoice object: https://stripe.com/docs/api/invoices/object#invoice_object-invoice_pdf
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Great, happy to help ๐
hey another question!
now im trying to get this payment_identificator from the event response in my webhook method (webhook is working just fine already)
im getting the attribute payment_identificator in the right way?
HI ๐ I'm stepping in for @chilly ore . What is it you are trying to accomplish here? I don't think customer_fields is a valid parameter on any Stripe objects. Based on the description above you need to reference metadata first.
i dont think i get it, im trying to use this attribute for invoice object
it is not correct?
Right, sorry I was thinking Payment Intents. In that case I think your approach will work but I'd advise testing it.
yeah, it works already
This will fail if the object returned is not an invoice though
im just having trouble to retrieve this attribute here
and it looks like you include an event that will return a payment intent
ok, so i saw earlier that if my payment suceeded i will receive a payment intent object on my event, right? and if fail i will receive an invoice object
the payment intent doesnt have an invoice inside? or i get it wrong?
We identify the object returned in data.object for each of our events. For payment_intent.succeeded in is a Payment Intent. You can review our list of events to see which objet is returned for each of your events.
https://stripe.com/docs/api/events/types#event_types-payment_intent.succeeded
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, going to test somethings in here, thanks in advance
But circling back to your earlier question, a Payment Intent that is generated from an Invoice will have an invoice property that contains the ID of the related invoice. You can still access the Invoice custom fields but you would need to make a second API call to retrieve that invoice object first.