#consobs-vp_api

1 messages ¡ Page 1 of 1 (latest)

dry elbowBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1375393923069116418

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

elfin lodge
#

hi there!

tropic violet
#

Hi!

elfin lodge
#

what's your goal? find the Invoice ID related to this PayementIntent?

tropic violet
#

Yes that's correct

elfin lodge
tropic violet
#

Ah OK. some paymentintents do list the invoice, it's just that this particular one has it as null for some reason

elfin lodge
#

this is something that changed in the latestet API version.

  • if you use an old API version, you'll see the invoice directly on the PaymentIntent
  • if yuo use the latest API version, then yuo need to make an extra API call as explained above
tropic violet
#

Got it, that works. Or can i use the events API to keep a track instead?

elfin lodge
#

Or can i use the events API to keep a track instead?
what do you mean by this? can you be more precise?

tropic violet
#

I can look for payment_intent.succeeded event and keep a list of pi_id and matching invoice_id, correct?

elfin lodge
#

and keep a list of pi_id and matching invoice_id
but how do you make the match?

tropic violet
#

in this invoice.payment_succeeded event there's a match

"object": {
"id": 
"in_1RF7Bw2NtvlMLsl8FYyey6Bt"
,
"object": 
"invoice",
"amount_due": 
898000,
"charge": 
"ch_3RF88f2NtvlMLsl80C8sfP4f"
,
"currency": 
"usd",
"customer": 
"cus_S7vV0yJ8h3qTqJ"
,
"default_payment_method": 
null,
"default_source": 
null,
"number": 
"F6B74119-0010",
"payment_intent": 
"pi_3RF88f2NtvlMLsl80YfRGafa"
,
"period_end": 
1744953020
,
"period_start": 
1744610590
,
"status": 
"paid",
"subscription": 
"sub_1RDg6s2NtvlMLsl8r1i1KZvt"
,
elfin lodge
#

in the latest API version, Invoice objects don't contain a payment_intent property.

tropic violet
#

OK, will take a look. thanks for the help!

dry elbowBOT