#hopp8435_treasury-connect-accounts
1 messages ยท Page 1 of 1 (latest)
๐ 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/1275127792362848307
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
Can you share the Request IDs that gave you the errors you are describing above?
They will start with req_
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Also please don't share code in screenshots, it's not useful to me. If you want to share code, please copy/paste it into this chat using three ` markers on either side
I hit the wrong button when talking about the goals. I am trying to save the setup intent from Financial connect to enable two things:
monitoring of transaction data on the source account (the data app flow for financial account) and then to enable transfers into and out of the tresury accounts
...yup will do both, one sec
@financial_account_router.post("/add-external-account")
async def add_external_account(
service_factory: ServiceFactory = Depends(get_service_factory),
):
tenant_service = service_factory.get_tenant_service()
tenant = tenant_service.get_tenant_by_id(5)
if not tenant.stripe_account_id:
raise Exception("No stripe account id")
setup_intent = stripe.SetupIntent.create(
attach_to_self=True,
flow_directions=["inbound", "outbound"],
payment_method_types=["us_bank_account"],
payment_method_options={
"us_bank_account": {
"verification_method": "instant",
"financial_connections": {
"permissions": ["payment_method", "balances", "transactions"]
},
},
},
stripe_account=tenant.stripe_account_id,
)
return {
"data": {
"client_secret": setup_intent.client_secret,
"account_id": tenant.stripe_account_id,
}
}
const addExternalAccount = async () => {
const { data } = await mutateAsync({
resource: `api/v1/financial-accounts/add-external-account`,
values: {},
});
const { client_secret, connect_account_id } = data;
if (stripe) {
stripe.collectBankAccountForSetup(
{
clientSecret: client_secret,
params: {
payment_method_type: 'us_bank_account',
payment_method_data: {
billing_details: {name: 'Jenny Rosen', email: 'jenny@example.com'},
},
},
}
).then(function(result) {
if (result.error) {
// Display error.message in your UI.
setErrorText(result.error.message);
} else {
}
});
}
};
const simulateReceivedCredit = async () => {
await mutateAsync({
resource: `api/v1/financial-accounts/${financialAccount.id}/simulate-received-credit`,
values: {
amount: 500,
},
});
};
const faAddress = financialAccount.addresses[0];
const faAddressCreated = faAddress != undefined;
return (
<>
<Stack spacing={1}>
<Typography variant="body2">
Your financial account will receive a $500.00 each time you press the
button.
</Typography>
{errorText !== "" && <Alert severity="error">{errorText}</Alert>}
{!faAddressCreated && (
<Alert severity="error">
Your financial account is still being set up (this can take up to
two minutes). Refresh this page to try again.
</Alert>
)}
</Stack>
<Box mt={3}>
<Button
variant="contained"
color="primary"
size="large"
disabled={submitting}
onClick={addExternalAccount}
fullWidth
>
{submitting ? "Adding external account..." : "Add external account"}
</Button>
The request IDs are really what's going to help me out here
yup
req_X5qgXD9MRhbGZe
oops
not that one
sorry
req_X5qgXD9MRhbGZe
req_REab0puSnOsMYv
Thanks, taking a look
Okay for req_X5qgXD9MRhbGZe, the error message says
message: "No such customer: 'acct_1PocZuR4C0mRyPFN'",
You cannot pass the ID for a Stripe Account in the Customer parameter. Did you mean to use the stripe_account parameter? That is what we are showing in the code snippet here: https://docs.stripe.com/treasury/examples/moving-money#adding-an-external-bank-account
No you are not
Not in that request
There is clearly a customer parameter being passed with the account ID in it
That won't work
@financial_account_router.post("/add-external-account")
async def add_external_account(
service_factory: ServiceFactory = Depends(get_service_factory),
):
tenant_service = service_factory.get_tenant_service()
tenant = tenant_service.get_tenant_by_id(5)
if not tenant.stripe_account_id:
raise Exception("No stripe account id")
setup_intent = stripe.SetupIntent.create(
attach_to_self=True,
flow_directions=["inbound", "outbound"],
payment_method_types=["us_bank_account"],
payment_method_options={
"us_bank_account": {
"verification_method": "instant",
"financial_connections": {
"permissions": ["payment_method", "balances", "transactions"]
},
},
},
stripe_account=tenant.stripe_account_id,
)
return {
"data": {
"client_secret": setup_intent.client_secret,
"account_id": tenant.stripe_account_id,
}
}
I don't think I am doing that
I know that isn't what the code you shared does
But all that tells me is this code isn't what made that request
Because the request body is the source of truth about what data was sent to the API
uh, hmm
should I try not using the SDK then
because that is the only code between what I shared and what is sent to your API
No, I think that would make your life much harder
I recommend trying to build a super basic reproduction and execute the code line by line
Can you try looking at this request: req_kU5GbuIFZu76uC
I don't see the customer param
Since you are using Python I recommend hard coding values and using pdb.set_trace() to step through each line of code one by one, inspecting variable values to make sure they are what you expect.
Looking at req_kU5GbuIFZu76uC, I agree. No customer is being passed there at all. But the stripe_account value IS being passed
This request occurred on acct_1PocZuR4C0mRyPFN
Both of your earlier requests were occurring on acct_1PVccUBwFH5uZvJq
So this request looks like what you are trying to achieve.
Yeah, but the FE gives me an error when calling to stripe. "No such setupintent: 'seti_1PpYYmR4C0mRyPFNbpPSX0QY'
I'm pretty sure I know why.
This is when you try to retreive the Setup Intent using the client_secret, right?
yup
You need to inialize Stripe.js with the Stripe Account the same way you made the back-end request with the Stripe Account
It's one of the options you can pass when you initialize Stripe.js
var stripe = Stripe('pk_XXX', {stripeAccount: 'acct_XXXXX'})
Ok so because stripe.collectBankAccountForSetup() doesn't take a stripeAccount I need to do a one off load of elements (so far for payments and issuing, I can pass the accoutn within the sub method)
Yeah for Stripe.js you have to create the var stripe instance with the StripeAccount instead of setting it on the actual method
because so far I have been able to do a generalize wrap of the <Elements stripe={stripePromise}>
got it
let me try that out
If you are using react-stripe-js and the <Elements> component, you can pass any additional options like so
<Elements stripe={stripePromise} options={options}>
Great ๐ Happy to help ๐