#testDeveloper
1 messages · Page 1 of 1 (latest)
hello! can you explain in more detail? do you mean you want to find out which payout an individual transaction was paid out?
yes
i want the payout date or arrival_date for my application
have applied webhooks for the same
but in my application
we have all the transactions invidually
can you provide an example payout id for me to take a look at?
in the payout.created event : https://dashboard.stripe.com/test/events/evt_1MKBCS4YkynKp6NjqYs31fis, there's an "arrival_date": 1672272000,
is that what you're looking for? https://stripe.com/docs/api/payouts/object#payout_object-arrival_date
yes
but how to know this payout corresponds to what all transactions in my application
in my app i am saving it as separate txn
when the payout is created, i'd suggest retrieving the transactions in that particular payout and then saving that mapping i.e. payout id mapped to the transaction in your own DB. There's no way to retrieve the payout id for a particular transaction on Stripe. It only works the other way round i.e. retrieve the list of transactions in a particular payout
you can retrieve the list of txns in a payout using https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-payout
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
how to do this for a specific payout ?
this will list all the balance transactions
so we need to pass payout as parameter and its id right ?
can you show me an example code snippet?
Hi @restive lake I'm taking over
You can see the example code in the API reference doc that Alex sent earlier.
req_m7n9Q40QRjzgNB
no such payout error
const balanceTransactions = await stripe.balanceTransactions.list({ payout: 'po_1MKB404YkynKp6NjFQaobvV2', limit: 3,});
This error was raised because po_1MKB404YkynKp6NjFQaobvV2 was created in a connected account, not platform.
You should specify a Stripe-Header when making requests on a connected account. https://stripe.com/docs/connect/authentication
it is showing for other payouts also
const balanceTransactions = await stripe.balanceTransactions.list({ payout: 'po_1MKB404YkynKp6NjFQaobvV2',},{stripeAccount: 'acct_1MJVrI4YkynKp6Nj'});
not specific to that payout only
Request ID?
no , in response it shows all the balance transactions
How many transactions do you see in the list?
I can't see GET response in logs, can you paste the response here?
balanceTransactions {
object: 'list',
data: [
{
id: 'txn_1MKB414YkynKp6NjjlLN6ZwH',
object: 'balance_transaction',
amount: -990000,
available_on: 1672358400,
created: 1672277864,
currency: 'usd',
description: 'STRIPE PAYOUT',
exchange_rate: null,
fee: 0,
fee_details: [],
net: -990000,
reporting_category: 'payout',
source: 'po_1MKB404YkynKp6NjFQaobvV2',
status: 'pending',
type: 'payout'
},
{
id: 'txn_1MJqVv4YkynKp6NjjIAXCRDM',
object: 'balance_transaction',
amount: 264000,
available_on: 1672198871,
created: 1672198871,
currency: 'usd',
description: null,
exchange_rate: null,
fee: 0,
fee_details: [],
net: 264000,
reporting_category: 'charge',
source: 'py_1MJqVu4YkynKp6Njn9R4xRqN',
status: 'available',
type: 'payment'
},
{
id: 'txn_1MJqVr4YkynKp6NjwbVMK8F2',
object: 'balance_transaction',
amount: 486000,
available_on: 1672198867,
created: 1672198867,
currency: 'usd',
description: null,
exchange_rate: null,
fee: 0,
fee_details: [],
net: 486000,
reporting_category: 'charge',
source: 'py_1MJqVq4YkynKp6NjY86Q5BgE',
status: 'available',
type: 'payment'
},
{
id: 'txn_1MJqVn4YkynKp6NjtZgc4IkS',
object: 'balance_transaction',
amount: 240000,
available_on: 1672198863,
created: 1672198863,
currency: 'usd',
description: null,
exchange_rate: null,
fee: 0,
fee_details: [],
net: 240000,
reporting_category: 'charge',
source: 'py_1MJqVn4YkynKp6NjiOaYoIZ6',
status: 'available',
type: 'payment'
}
],
has_more: false,
url: '/v1/balance_transactions'
}
yes
If you check the content of each item, the first item is the payout itself, and the 2nd, third and last items are the payments associated with this payout.
https://dashboard.stripe.com/test/payouts/po_1MKB404YkynKp6NjFQaobvV2 These associated payments match the records in Dashboard, so I don't see any problems with it.
ok just give me a sec
How to find this balabce_transaction
txn_3MJqVtGAMQUY18Un0NggpfBg
was in which payout?
You mean you want to do a reverse query from balance transaction to payout?
There's no API to directly query I'm afraid.
thats alright but i can see a match of transaction Id in the listing
can you let me know where to pick the transaction id from ?
i save it from transfer.balance_transaction
i think thats where i am wrong
You should check the type of the balance_transaction (https://stripe.com/docs/api/balance_transactions/object?lang=node#balance_transaction_object-type) see what types are needed by your business
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
it gives me empty list
const balanceTransactions = await stripe.balanceTransactions.list({ payout: 'po_1MKB404YkynKp6NjFQaobvV2', type: 'transfer',},{stripeAccount: 'acct_1MJVrI4YkynKp6Nj'});console.log('balanceTransactions', balanceTransactions)
and same with charge
That simply means there's no transfers involved in this payout.
but there were transfers from stripe dashboard to the connected account
i think i need to save py_ id while creating transfers because that remains in the balance_transaction listing of the payout
destination_payment: 'py_1MJqVu4YkynKp6Njn9R4xRqN'
this key
OK, when you create a transfer from platform to a connected account, Stripe would create a payment object on the connected account. If you want to find the transfer that was created on platform, you should check the payment's source_transfer field (https://stripe.com/docs/api/charges/object?lang=node#charge_object-source_transfer)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok
will the py _ id always be same in balance_transaction listing {
object: 'list',
data: [
{
id: 'txn_1MJqVv4YkynKp6NjjIAXCRDM',
object: 'balance_transaction',
amount: 264000,
available_on: 1672198871,
created: 1672198871,
currency: 'usd',
description: null,
exchange_rate: null,
fee: 0,
fee_details: [],
net: 264000,
reporting_category: 'charge',
source: 'py_1MJqVu4YkynKp6Njn9R4xRqN',
status: 'available',
type: 'payment'
},
{
id: 'txn_1MJqVr4YkynKp6NjwbVMK8F2',
object: 'balance_transaction',
amount: 486000,
available_on: 1672198867,
created: 1672198867,
currency: 'usd',
description: null,
exchange_rate: null,
fee: 0,
fee_details: [],
net: 486000,
reporting_category: 'charge',
source: 'py_1MJqVq4YkynKp6NjY86Q5BgE',
status: 'available',
type: 'payment'
},
{
id: 'txn_1MJqVn4YkynKp6NjtZgc4IkS',
object: 'balance_transaction',
amount: 240000,
available_on: 1672198863,
created: 1672198863,
currency: 'usd',
description: null,
exchange_rate: null,
fee: 0,
fee_details: [],
net: 240000,
reporting_category: 'charge',
source: 'py_1MJqVn4YkynKp6NjiOaYoIZ6',
status: 'available',
type: 'payment'
}
],
has_more: false,
url: '/v1/balance_transactions'
}
the key named source
and in the transfer as
destination_payment: 'py_1MJqVu4YkynKp6Njn9R4xRqN'
transfer {
id: 'tr_3MJqVtGAMQUY18Un0DqenNPz',
object: 'transfer',
amount: 264000,
amount_reversed: 0,
balance_transaction: 'txn_3MJqVtGAMQUY18Un0NggpfBg',
created: 1672198870,
currency: 'usd',
description: 'Weekly Payment Best Attorney',
destination: 'acct_1MJVrI4YkynKp6Nj',
destination_payment: 'py_1MJqVu4YkynKp6Njn9R4xRqN',
livemode: false,
metadata: {},
reversals: {
object: 'list',
data: [],
has_more: false,
total_count: 0,
url: '/v1/transfers/tr_3MJqVtGAMQUY18Un0DqenNPz/reversals'
},
reversed: false,
source_transaction: 'ch_3MJqVtGAMQUY18Un0gdVELeg',
source_type: 'card',
transfer_group: 'group_pi_3MJqVtGAMQUY18Un02k4hSBu'
}
can i use this as my identifier for my use-case>
You can get the payment ID from destination_payment property of a transfer object.
will this always reflect while listing the balance
transactions
?
in source: key ?
What do you mean by source: key ?
i mean the source property
{
object: 'list',
data: [
{
id: 'txn_1MJqVv4YkynKp6NjjIAXCRDM',
object: 'balance_transaction',
amount: 264000,
available_on: 1672198871,
created: 1672198871,
currency: 'usd',
description: null,
exchange_rate: null,
fee: 0,
fee_details: [],
net: 264000,
reporting_category: 'charge',
source: 'py_1MJqVu4YkynKp6Njn9R4xRqN',
status: 'available',
type: 'payment'
},
{
id: 'txn_1MJqVr4YkynKp6NjwbVMK8F2',
object: 'balance_transaction',
amount: 486000,
available_on: 1672198867,
created: 1672198867,
currency: 'usd',
description: null,
exchange_rate: null,
fee: 0,
fee_details: [],
net: 486000,
reporting_category: 'charge',
source: 'py_1MJqVq4YkynKp6NjY86Q5BgE',
status: 'available',
type: 'payment'
},
{
id: 'txn_1MJqVn4YkynKp6NjtZgc4IkS',
object: 'balance_transaction',
amount: 240000,
available_on: 1672198863,
created: 1672198863,
currency: 'usd',
description: null,
exchange_rate: null,
fee: 0,
fee_details: [],
net: 240000,
reporting_category: 'charge',
source: 'py_1MJqVn4YkynKp6NjiOaYoIZ6',
status: 'available',
type: 'payment'
}
],
has_more: false,
url: '/v1/balance_transactions'
}
in this list source property
kindly confirm
If the type is payment, then the source relates to a payment object, as explained in the API reference (https://stripe.com/docs/api/balance_transactions/object?lang=node#balance_transaction_object-source)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so every transfer is a payment in literal sense right ?
or we can say considered a payment
or creates a payment Id for sure
Yes, you can think this way from the perspective of a connected account.
Thank You so much
How to check if the bank id belongs to which connected account ?
You want to know if an external_account ID belongs to a particular connected account?
https://stripe.com/docs/api/external_account_bank_accounts/retrieve?lang=node#account_retrieve_bank_account you can use this API to retrieve the bank account, if the response says something like no such ID, than this external_account doesn't belong to the connected account
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.