#anthonyl5602

1 messages ยท Page 1 of 1 (latest)

keen brookBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

lone beacon
#

Hi
Can you share a sample request please ?

noble sail
#

"Hello, to put it simply, I want to use the API to iterate through each of my clients' accounts (/accounts), retrieve each transfer received in their bank account, and trace back to the initial payment from the customer (/customers). However, to achieve this, it seems I need to go through /payouts, /balance_transactions, then /transfers, and finally /customers. Can you guide me on this? Thank you.

noble sail
# lone beacon Hi Can you share a sample request please ?

{
"id": "po_1OWC9GR6SjxCk37rN78e0ccB",
"object": "payout",
"amount": 4000,
"arrival_date": 1705276800,
"automatic": true,
"balance_transaction": "txn_1OWC9GR6SjxCk37rNAZarV25",
"created": 1704694642,
"currency": "eur",
"description": "STRIPE PAYOUT",
"destination": "ba_1LQ9FzR6SjxCk37rysCAFit3",
"failure_balance_transaction": null,
"failure_code": null,
"failure_message": null,
"livemode": true,
"metadata": {},
"method": "standard",
"original_payout": null,
"reconciliation_status": "completed",
"reversed_by": null,
"source_type": "card",
"statement_descriptor": "Mon Hangar SAS",
"status": "in_transit",
"type": "bank_account"
},

#

With this (/payout), it is not possible to trace back to the balance_transactions.

lone beacon
noble sail
#

Of course. This does not allow and does not help me to start from a bank transfer from a client and go back to the customer who made the purchase of a service...

lone beacon
#

This does not allow and does not help me to start from a bank transfer from a client and
What you mean by bank transfer here ? payout ?

noble sail
#

yes payout

lone beacon
#
const balanceTransactions = await stripe.balanceTransactions.list({
  payout: 'po_1Gl3ZLLHughnNhxyDrOia0vI',
  type: 'charge',
  expand: ['data.source'],
});
noble sail
#

Actually, I want to send emails to my connected accounts (/account) about the transfers they have received in their bank accounts (/payout) with the dates of the transfer and who sent this money (/customers).

noble sail
lone beacon
keen brookBOT
noble sail
kindred lion
#

Hi there ๐Ÿ‘‹ jumping in as my teammate needs to step away soon. That will be an involved flow to build, because you do need to step through the chain of objects you described (based on what you described it sounds like you're using Destination Charges, is that correct?).

#

Additionally, a Payout is not associated with a single payment typically, so there won't be a 1:1 mapping there. Where are you currently running into problems with building this flow?

noble sail
#

Hello ๐Ÿ™‚ So basically, I can trace back from /charges or /balance_transactions to the /customer who made the payment. The issue is obtaining the /payout from the connected account (/account) to know the date of the payout for this /charge.

kindred lion
#

Gotcha, you want to do this for all Payouts right? (If you want to do this for a specific one, you would need to already know that ID then unless you're trying to figure out how to hunt down a specific Payout object). If so, you can list all Payouts for a Connected Account using this endpoint and the stripeAccount header:
https://stripe.com/docs/api/payouts/list
https://stripe.com/docs/api/connected-accounts

noble sail
#

How could I achieve, like the Stripe user interface, to have the payout associated with a payment? Thank you.

#

Unfortunately, the API does not return the payout...

#

{
"id": "py_1OD9R3R7ZLF3q7QPItSmhUCg",
"object": "charge",
"amount": 600000,
"amount_captured": 600000,
"amount_refunded": 0,
"application": "ca_JYPRWv2bzsMhAIKVwQs7dHwbGlGoXeMQ",
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1OD9R3R7ZLF3q7QPIoEwJ2tm",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"calculated_statement_descriptor": null,
"captured": true,
"created": 1700155981,
"currency": "eur",
"customer": null,
"description": null,
"destination": null,
"dispute": null,
"disputed": false,
"failure_balance_transaction": null,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": true,
"metadata": {},
"on_behalf_of": null,
"order": null,
"outcome": null,
"paid": true,
"payment_intent": null,
"payment_method": null,
"payment_method_details": {
"stripe_account": {},
"type": "stripe_account"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "hKk",
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"total_count": 0,
"url": "/v1/charges/py_1OD9R3R7ZLF3q7QPItSmhUCg/refunds"
},
"review": null,
"shipping": null,
"source": {
"id": "acct_1InNeSJnHcficTc3",
"object": "account",
"application_icon": "http",
"application_name": "Mon Hangar"
},
"source_transfer": "tr_1OD9R3JnHcficTc3kRVGtGXX",
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}

kindred lion
#

Where did you get that from? That is not what the endpoint I provided would return.

noble sail
#

Stripe-Account : acct_1NFzUNR7ZLF3q7QP

kindred lion
#

Okay, why are you getting a charge? Didn't you want Payout IDs, did you try using the List Payouts endpoint I linked above?

noble sail
#

I'm trying by any means to go from a /payout or a /charge to reach /transfers....

#

But I need at least the /payout and the /transfers.

kindred lion
#

Alright, I'm very lost, it sounds like you want to get all the Payout IDs for your Connected Account, which the List Payouts endpoint is perfect for. Am I misunderstanding something, is that not what you're looking for?

noble sail
#

Maybe I speak English poorly, I am French. Perhaps, with luck, if I express myself in French, you will understand better?

kindred lion
#

Nope, I can only provide support in English.

noble sail
#

In fact, I will take an example: This payout: https://dashboard.stripe.com/acct_1M7iYKR6tyshyTo5/transfers/po_1OUOBhR6tyshyTo5Y4JzOq0W, and when you click on the payment: https://dashboard.stripe.com/acct_1M7iYKR6tyshyTo5/payments/py_1OUGxcR6tyshyTo5s707a7Mb, and when you click on the transfer: https://dashboard.stripe.com/connect/transfers/tr_3OUGxaJnHcficTc31l2yC5vu. At a minimum, this is what I want to do with the API for all the /payouts of my clients (/accounts).

kindred lion
#

Okay, and what is blocking you currently from doing that via the API?

noble sail
#

Well, if I take all the /payouts, I can't go to the transfers, and vice versa. If I take the /transfers, I can't go to the associated payouts...

kindred lion
#

Sorry for the delay, was juggling multiple threads, focusing on this now, let me double check how to make the association between those two.

noble sail
#

no problem ๐Ÿ˜‰

kindred lion
#

I think I have recalled the first parts of it, let's start there, and then you share what you see and I should be able to give more guidance. I don't think I have a payout resulting from a Transfer handy in my test account, so it'll likely be faster if we can look at the objects from your flow.

So to start breaking down the process:

  1. Get Payout ID(s) - if you already know this, you can skip this step, if not, this is where I would recommend listing Payouts for your Connected Account
  2. Get the Balance Transactions that were included in that Payout (important note, only works with automatic payouts, if you're using manual payouts then you'll need to build this flow on your end.)
    For this step, you can pass the ID of a Payout into the payout parameter when listing Balance Transactions, doing so will only return Balance Transactions that were associated with the specified Payout:
    https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-payout

If you can share the ID that you see in the source field for some of those Balance Transactions, that should help point me in the right direction.