What is the best way to get the stripe product info of balance transaction?

31 views
Skip to first unread message

Samuel Shin

unread,
Jan 31, 2025, 8:41:17 PMJan 31
to Stripe API Discussion
I'm trying to map the balance transaction to the stripe product in my application.

I'm now getting product data if the balance transaction has invoice object.
Then I can get the product with lines[0].data.plan.product or lines[0].data.price.product.

But there are a lot of balance transactions which have no invoice, so I can't know the product info associated with the balance transactions.

Is that normal behavior?
Or am I missing something?

How can I get the product info of the balance transactions?

Thanks!

Remi J.

unread,
Jan 31, 2025, 8:52:13 PMJan 31
to api-d...@lists.stripe.com
Hey Samuel,

There are multiple ways to accept payments via our API and different abstractions depending on your use-case. I recommend this doc [1] with the associated video which is a great introduction to the various concepts we offer.

First, it will touch on the Charge and PaymentIntent objects which model the lifecycle of a payment and its attempt(s). Those focus on the amount/currency combo and payment method(s) used but don't provide any line item information. It's quite common for integrations that manage their own shopping cart logic or inventory and just want to focus on accepting the payment through Stripe to use those APIs directly. In that case, the reconciliation would happen with data you store in your own database for example.

We have higher level APIs that build on top of those though and will store line item information. Our Invoice API which you mentioned is one of those. Another one would be the Checkout Session or PaymentLink APIs which also have detailed line item information stored in the related object. In that case, your integration should store information about the objects created during the payment to map a Checkout Session id (cs_live_123) to a PaymentIntent id (pi_123) for example to be able to map the information in that Session to the BalanceTransaction you are seeing.

So what you need to do next is dig into your own integration and which API(s) you're using so that you can do proper reconciliation of what is being bought. It's fairly straightforward to handle once you understand how all the objects related to each other but that first step can take a bit of time.

You likely will have follow up questions once you find out more details so I recommend reaching out to our support team [2] or using our Discord server during the week (off on week end) to ask questions directly to Stripe developers.

Best,
Remi


To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
Reply all
Reply to author
Forward
0 new messages