#rvk

1 messages · Page 1 of 1 (latest)

tame muskBOT
junior gust
#

Hi there

violet swan
#

I see that there is a payment_intent id in the stripe.BalanceTransaction.list response . Is there a way to get the payment link from this payment intent id?

junior gust
violet swan
#

can you please eloborate on your previous comment - "You would instead list Checkout Sessions by Payment Link"
If I have the stripe.BalanceTransaction.list for a paidout event, how can I use checkout sessions to get payment link?

junior gust
#

The only way to know the Payment Link associated with a Balance Transaction is to go from Checkout Session (which you can list by a specific Payment Link) --> PaymentIntent --> Charge --> Balance Transaction.

#

It is impossible to go the other way

#

So you would need to list out all the Balance Transactions associated with a Payment Link

#

Then if you want to know the Payout as well you would need to match on the Balance Transaction ID by listing Balance Transactions by Payout like you mentioned

violet swan
#

I am trying to understand this better and thank you for your patience. In the UI, when I open the paid out event, I see a list of transactions. When I click on a transaction, I go to the payment page which has a "Events and logs" section. In this section, there is "A Checkout Session was completed" event at the top and when I click on it, it has the payment link associated with it.

#

If I want to achevie this through the API, here are the steps I have

  1. Read all payout.paid events
  2. For each event, fetch all balance transactions
  3. For each transaction, I want to get the checkout session completed event and json data, just like I am seeing on the UI. HOW DO I ACHEVE this using the API
junior gust
#

You can't do it that way.

#

That's what I'm trying to explain above.

#

PaymentIntents do not have a checkout_session or payment_link property

#

So there is no way to go from a Balance Transaction --> Checkout Session or Payment Link

#

You have to go the opposite direction

#

Start at Payment Link or Checkout Session and go to the Balance Transaction from there

violet swan
#

ok, would this work?

  1. I read all the checkout.session.completed events.
  2. For each event, I capture the payment intent id and payment link
  3. Then I read the payout.paid events
  4. Get all the transactions. For each transaction, get the payment intent id and and match it with what we found in (1), (2)
junior gust
#

Sure that would work. I think it is more work than what I recommended above, and you can only read Events going back 30 days so if you have older data that won't work. But otherwise, yes should work

violet swan
#

In your approach, how do I get balance transactions for a payment link, using the API?

#

and how do I start from a checkout session? is there a list of checkout sessions I can start from?

junior gust
violet swan
#

Got it, thamk you so much