#testDeveloper

1 messages · Page 1 of 1 (latest)

pallid nestBOT
deft wasp
#

hello! can you explain in more detail? do you mean you want to find out which payout an individual transaction was paid out?

restive lake
#

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

deft wasp
#

can you provide an example payout id for me to take a look at?

restive lake
#

po_1MKB404YkynKp6NjFQaobvV2

#

it has three transactions in it

deft wasp
restive lake
#

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

deft wasp
#

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

restive lake
#

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?

night iron
#

Hi @restive lake I'm taking over

restive lake
#

hi

#

kindly show me an example code snippet

night iron
#

You can see the example code in the API reference doc that Alex sent earlier.

restive lake
#

req_m7n9Q40QRjzgNB

#

no such payout error

#

const balanceTransactions = await stripe.balanceTransactions.list({ payout: 'po_1MKB404YkynKp6NjFQaobvV2', limit: 3,});

night iron
#

This error was raised because po_1MKB404YkynKp6NjFQaobvV2 was created in a connected account, not platform.

restive lake
#

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

night iron
#

Request ID?

restive lake
#

no , in response it shows all the balance transactions

night iron
#

How many transactions do you see in the list?

restive lake
#

4

#

all of them don't correspond to the same payout id

night iron
#

I can't see GET response in logs, can you paste the response here?

restive lake
#

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

night iron
#

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.

restive lake
#

ok just give me a sec

restive lake
#

How to find this balabce_transaction
txn_3MJqVtGAMQUY18Un0NggpfBg
was in which payout?

night iron
#

You mean you want to do a reverse query from balance transaction to payout?

#

There's no API to directly query I'm afraid.

restive lake
#

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

night iron
restive lake
#

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

night iron
#

That simply means there's no transfers involved in this payout.

restive lake
#

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

night iron
#

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)

restive lake
#

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>

night iron
#

You can get the payment ID from destination_payment property of a transfer object.

restive lake
#

will this always reflect while listing the balance

#

transactions

#

?

#

in source: key ?

night iron
#

What do you mean by source: key ?

restive lake
#

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

night iron
restive lake
#

so every transfer is a payment in literal sense right ?

#

or we can say considered a payment

#

or creates a payment Id for sure

night iron
#

Yes, you can think this way from the perspective of a connected account.

restive lake
#

Thank You so much

restive lake
#

How to check if the bank id belongs to which connected account ?

night iron
#

You want to know if an external_account ID belongs to a particular connected account?

restive lake
#

yes

#

?

#

@night iron

night iron