#pandareaper
1 messages · Page 1 of 1 (latest)
Hi there, are you using the balance transactions API? https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yes I am
OK. You can filter the transactions by type=== charge, one you have the charge objects, you can trace back associated payment_intent from a charge.
I can't seem to see any charges, both when searching with and without the payment id (py_...) as a source and on the main and connected accounts
It looks like you are using destination charge, you should filter type===payment.
So I believe thats what I'm doing
const payments = await StripeClient.balanceTransactions.list({
payout: payoutId,
type: 'payment',
}, {
stripeAccount: connectedAccountId,
});
Is it possible to link these payments to payment intents in the main account ?
can you share an example payment id?
py_1MSGd7FQsYB3k7vxJeKxhSW1
Hi @knotty cosmos can you also share with me the payout ID?
po_1MTUMqFQsYB3k7vx5rupDHUh
Thanks. You said that the result was empty when you set type to charge, can I confirm if your code is something like the following?
const payments = await StripeClient.balanceTransactions.list({
payout: payoutId,
type: 'charge',
}, {
stripeAccount: connectedAccountId,
});
Thats right, I get an empty list
{
object: 'list',
data: [],
has_more: false,
url: '/v1/balance_transactions'
}
On the same payout object?
Yeah, the only thing I changed in that code is the type
I've checked the internal log for https://dashboard.stripe.com/logs/req_BYXjJSnJQe58hh and I can see two balance transactions.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
When I list all balance transactions for the payout e.g.
const payments = await StripeClient.balanceTransactions.list({
payout: payoutId,
}, {
stripeAccount: connectedAccountId,
});
I get back 3 balance transactions, one is for the payout itself, the other two are both of type: 'payment'. The reporting_category is charge , is this what you are referring to when you mention charges?
Yes. So if you set type=charge, does it still return empty list?
Yes it returns an empty list. Which I would expect given the type is actually payment on these balance transactions
Example details of the payment when searching without a type filter
reporting_category: 'charge',
source: 'py_1MSGd7FQsYB3k7vxJeKxhSW1',
status: 'available',
type: 'payment'
Alright, how about type=payment ?
That returns two balance transactions for two payments associated with that payout, which is what I expect. I am just trying to find the payment intents that are related to those payments
OK you can expand [data.source] to include the full payment object in the list response.
For each payment object, you can get the transfer first (https://stripe.com/docs/api/charges/object#charge_object-transfer) and then the source_transaction (https://stripe.com/docs/api/transfers/object#transfer_object-source_transaction) represents the ID of the charge or payment that was used to fund the transfer.
If you are new to response expansion, here' show you expand a response https://stripe.com/docs/api/expanding_objects#expanding_objects
Hmm, actually another way is just to set type=transfer, and filter those transfer which have source_transaction set.
thanks for that mate! got what I needed
Good to hear!