#matt_api

1 messages · Page 1 of 1 (latest)

unique wadiBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1328741312500858932

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

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.

hoary aspen
#

Hey there, was looking into this to try to understand. Broadly what you describe seems to match the overview flow we offer here: https://docs.stripe.com/treasury#treasury-account-architecture

And I think the critical pieces are that the treasury account is something to work with as the "external account" for a Stripe account, where the payouts etc go for you to manage them after payments land in the stripe account: https://docs.stripe.com/treasury/moving-money/payouts#financial-accounts-as-external-accounts

This bit helped me wrap my head around the separation:

Financial accounts have their own balance separate from the balance of the account they’re attached to (platform account or connected account).
https://docs.stripe.com/treasury/account-management/working-with-balances-and-transactions

past lion
#

I see, so creating a payout should transfer to the "external" account which is the treasury financial account in this case? Something like this?

await stripe.payouts.create(
            {
                amount: paymentIntent.amount,
                currency: paymentIntent.currency,
                method: "instant",
            },
            {
                stripeAccount: paymentIntent.metadata.stripeAccountId,
            },
        );

hoary aspen
#

That seems to be the case, yes, once the treasury account is set as the external.

#

My experience with Treasury is limited though, since much of it limited access. Our support team will be able to offer more concrete guidance about Treasury if what I'm saying doesn't give you what you need: https://support.stripe.com/contact

past lion
#

Yeah we do have external accounts connected to our treasury accounts. So customers can pay out treasury balances to their own accounts. Just want to make sure a payout wouldn't move outside of Stripe and instead would be transferred into the treasury account

#

Yeah just ran a quick test it looks like payouts will move money into the external connected account not the treasury account.

hoary aspen
#

Is there another external account? THe issue might be with having multiple, instead of of just the treasury one

past lion
#

Yeah we have

  • Connect account (recieves card payments)
  • Treasury account (want to move payments here)
  • Customers external connected account (they eventually transfer from treasury out to this account)
hoary aspen
past lion
#

I wonder if providing the destination in payouts.create would work

hoary aspen
#

Customers external connected account (they eventually transfer from treasury out to this account)
I think you're meant to do this with outboundtransfers and outboundpayments from the treasury account

past lion
#

Yeah we have already set up the outbound transfers for moving from treasuy -> customers connected account

#

Currently we are only accepting ACH into treasury

#

But I'm working on the card payments which should end up in treasury

hoary aspen
#

In that case I suspect the other account should not be an external account to the stripe account, or at least not the default

#

try setting the Treasury external account as the default

past lion
#

I was under the impression that the default account should not matter if I provide the destination, i.e.

await stripe.payouts.create(
            {
                amount:
                    paymentIntent.amount - (paymentIntent.application_fee_amount ?? 0),
                currency: paymentIntent.currency,
                destination: paymentIntent.metadata.stripeFinancialAccountId,
                method: "instant",
            },
            {
                stripeAccount: paymentIntent.metadata.stripeAccountId,
            },
        );
hoary aspen
#

Sure, if all your payouts are manual

past lion
#

But this throws "message": "No such external account: 'fa_1QK*******'"

hoary aspen
#

but it sounds like you want everythign to land in the treasury account first, so setting it as default would make sense

past lion
#

I would rather not change the core logic since we have other workflows running here. I am triggering a payout when receiving the payment_intent.succeeded webhook

hoary aspen
#

Hmm i don't know if Treasury accounts work with that destination flow then

#

Can you share an example request ID?

past lion
#

req_K8faK6O2yxjmmF

hoary aspen
#

Interestingly I do not see any account.external_account.created events on that connected account 🤔

past lion
#

This is a connect account we use quite a lot for testing

#

So we've connected some fake stripe bank account a while ago

#

Is there someone on the treasury team I should reach out to for this?

hoary aspen
past lion
#

I don't see any other ID that would make sense

hoary aspen
#

But there are multiple external accounts associated with the account?

#

(in the API response, not the dashboard)

past lion
#

No just the 1 external account, the treasury account is not listed as an external account

hoary aspen
#

Ah, perhaps it was never added as one then?

past lion
#

So the treasury account has to also be added as an external account even if its already associated with the connect account??

hoary aspen
#

from that doc:

Before you can send payouts to a Treasury financial account or receive top-ups from a Treasury financial account, you must set the financial account as an external account (BankAccount object) connected to the relevant Stripe account.

past lion
#

Ah I see, sorry about that

hoary aspen
#

NP! I hope it works like you expect once you add that external account 🤞

past lion
#

I feel that a treasury account that is associated with a connect account should automatically be a valid payout destination.... seems like an extra step if we have to add it as an external account everytime

#

Is there a way to add a treasury account as an external account in test mode? It seems to always default to a few pre configured test accounts

hoary aspen
#

You likely have to do it via the API using the request pattern shown in the docs

#
curl https://api.stripe.com/v1/accounts/{{CONNECTED_ACCOUNT_ID}}/external_accounts \
  -u sk_test_123: \
  -d "external_account[object]"="bank_account" \
  -d "external_account[routing_number]"="{{FINANCIAL_ACCOUNT_ROUTING_NUMBER}}" \
  -d "external_account[account_number]"="{{FINANCIAL_ACCOUNT_ACCOUNT_NUMBER}}" \
  -d "external_account[country]"="US" \
  -d "external_account[currency]"="usd" \
  -d "default_for_currency"="true"
#

(notice that example sets it as default, FYI)

#

you can also try excluding that param, leaving the existing external accountas the default, to try your destination flow

#

I suspect when you do this you might get a ba_123 bank account object/id back that you'll need to use as that destination param