#victoria - invoice custom field

1 messages ยท Page 1 of 1 (latest)

chilly ore
#

Hello! Just starting a thread for you -- I'll review and respond as soon as I can ๐Ÿ™‚

chilly ore
#

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)

#

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

ionic flare
#

im going to test this way and see if it works

chilly ore
#

๐Ÿ‘

ionic flare
#

thanks in advance!

chilly ore
#

NP!

ionic flare
#

ok, this works! but where can i see this custom field in my stripe dashboard?

chilly ore
#

Hmm it doesnt appear to be on the invoice page, but you can see it on the invoice pdf:

ionic flare
#

and how can i get this pdf?

chilly ore
ionic flare
#

nice! it works juts fine

#

thank you so much!!

chilly ore
#

Great, happy to help ๐Ÿ™‚

ionic flare
#

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?

lunar kernel
#

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.

ionic flare
#

it is not correct?

lunar kernel
#

Right, sorry I was thinking Payment Intents. In that case I think your approach will work but I'd advise testing it.

ionic flare
#

yeah, it works already

lunar kernel
#

This will fail if the object returned is not an invoice though

ionic flare
lunar kernel
#

and it looks like you include an event that will return a payment intent

ionic flare
#

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?

lunar kernel
#

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

ionic flare
#

ok, going to test somethings in here, thanks in advance

lunar kernel
#

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.