#Chung-Yi - Account Balance
1 messages ยท Page 1 of 1 (latest)
We're seeing the account balance displayed in the modal in our ACH integration (I'm guessing because we requested the permission). We have 2 questions:
- How up-to-date the balance is (how the balance retrieve/refresh works behind the scene).
- Can we hide that in the modal?
So just to be perfectly clear, you are using the Payment Element to create this modal window?
What is the function you are calling to trigger this?
Okay great, thanks
Can you share the javaScript function you use to create/mount the Payment Element?
const BankDebitProvider: FC<Props> = ({ order }) => {
// (ignored)
const options = {
clientSecret: clientSecret,
appearance: appearance,
}
return (
<div>
{clientSecret && (
<Elements options={options} stripe={stripePromise}>
<BankDebitForm order={order} returnURL={returnURL} />
</Elements>
)}
</div>
)
}
export const BankDebitForm: FC<Props> = ({ order, returnURL }) => {
const stripe = useStripe()
const elements = useElements()
// (ignored)
return (
<form onSubmit={handleSubmit}>
<LoadingArea isLoading={isPaymentElementLoading}>
{isPaymentElementLoading && <Box height={300}></Box>}
<PaymentElement
onReady={() => setIsPaymentElementLoading(false)}
onChange={event => {
trackPaymentElementEvent(event)
}}
/>
<Spacer mt={2} />
<Button
onClick={trackClickedContinue}
disabled={!stripe}
variant="primaryBlack"
width="100%"
>
Save and Continue
</Button>
</LoadingArea>
</form>
)
}
This is roughly how it looks like, ignoring some details.
Thanks, I appreciate that.
It looks like you're using React. Are you using react-stripe-js?
If so, which version?
Do you have the server side code where you create the Payment Intent? Could I see that?
This code
Okay I was able to reproduce this and remove the account balance. It has to do with what permissions you request when creating the Payment Intent.
This code:
payment_method_options={
"us_bank_account": {
"financial_connections": {"permissions": [
"payment_method",
"balances"
]
},
},
}
displays the balance associated with each account.
This code:
payment_method_options={
"us_bank_account": {
"financial_connections": {"permissions": [
"payment_method",
# "balances" <- balance permission excluded
]
},
},
}
does not display the balances
I'n using Python so the syntax may look different for you but I'm sure you can translate
yeah we requested the permission. we do need it tho because we'll perform our own balance check on the backend.
is it possible to configure the UI to not display it in the modal?
Unfortunately we do not expose any features to hide this. I believe this is by design.
As in, if you request access to the account balance we will expose it to the customer whose accounts you are accessing as well because they are the customer's accounts.
ok got it.
then a followup question is
how up-to-date the balance is (or in general how Stripe retrieve/refresh that behind the scene), given that balance refresh is async/performed in the background.
I meant specifically the balance displayed in the modal.
Based on the callout at the bottom of this step: https://stripe.com/docs/payments/ach-debit/accept-a-payment?platform=web#web-collect-details
I suspect the account balance is returned by the bank during the authentication flow.
Thanks for the link! Are there more details about it? For example, will our customers always see the balance (that's just retrieved) in the modal, or it could still depend on how fast the external bank can return?
๐ stepping in here as Snufkin had to step away.
๐ and thank you!
I'm catching up on the above!
My understanding is that each time the modal is shown, the current balance is grabbed.
So it's possible it's showing outdated balance if we didn't refresh it? Or does Stripe perform the very first balance retrieve for us during the modal flow?
I believe we perform a retrieval each time the modal shows, but I can double check on that.
If you can help us double check that, that'll be great!
And also, from the doc, the balance refresh is performed in the background, and it seems possible the balance refresh can't be done in time when the modal is shown. In that case, what would the modal display?
Okay so my teammate also believes that is the case (that we refresh the balance each time the modal is displayed so it would be up to date). However, we aren't intimately familiar with these modals (we focus more on the API itself) โ to get a 100% answer here you would want to talk to our Support team (https://support.stripe.com/contact/login) who can get you confirmation on the above.
Cool! Thanks for double checking. I'll ask Support for further details. Thanks again for helping