#john_prefetch-financial-connections
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/1266481359963160711
๐ 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.
Hi there ๐ you'll need to request the additional permissions you'd like to leverage when creating your Payment Intents or Checkout Sessions. This guide helps show that, this step in particular shows the permissions being included on a Payment Intent:
https://docs.stripe.com/financial-connections/ach-direct-debit-payments#access
Since the error also mentions trying to prefetch information, this section is also useful, as it shows including the necessary paramter to tell us what information you want to prefetch:
https://docs.stripe.com/financial-connections/balances#prefetch-balance-data
Let me know if those don't clear things up though!
john_prefetch-financial-connections
i am trying to collect payment method details (Bank and Credit) for a particular Customer on the platform for current and future payments.
Is prefetch a right approach for also having access to Transactions and Balances/
?
Using Financial Connections is the correct way to get access to balances and transactions for US bank accounts. That functionality isn't available for cards.
Prefetch is a subset of Financial Connections, where the data is fetched initially.
I am using Stripe Checkout Session with SessionCreateParams.Mode.SETUP for collecting payment method (Bank Account).
Is there a way to add permissions to Checkout Session for Balances & Transactions?
Yup, payment_method_options.us_bank_account.financial_connections.permissions:
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_method_options-us_bank_account-financial_connections-permissions
thank you.
what do you suggest is better, using Strip Checkout or SetupIntent? We may want to embbed our own UI component.
Also, to request permissions on a new bank account for customers, do we need special privilege from Stripe side?
For livemode, yes, you must first register for Financial Connections.
https://docs.stripe.com/financial-connections/balances#prerequisites
You should be able to test this in testmode without registering though.
If you want to host your own page, and only embed a minimal Stripe UI in it, then Setup Intents + Payment Element are the way to go.
If you want a fully hosted experience, a hosted Checkout Session would be a better fit.
For something in between, where you can embed a Checkout Session on your site, you'd want to look into using an embedded Checkout Session.
any documentation for using Payment Element?
Is there a flag that controls embedded Checkout Session?
For a Setup Intent + Payment Element flow, you'll want to leverage the same parameter as for Checkout Sessions, but on the Setup Intent object:
https://docs.stripe.com/api/setup_intents/create#create_setup_intent-payment_method_options-us_bank_account-financial_connections-permissions
otherwise you can follow our typical guide for setting up payment methods for future usage:
https://docs.stripe.com/payments/save-and-reuse?platform=web
There are three tabs near the top of that guide, that let you toggle between a hosted Checkout Session (Stripe-hosted page), an embedded Checkout Session (Embedded form), or the Payment Element (Custom payment flow).
The parameter that controls the UI mode of a Checkout Session, embedded vs hosted, is the ui_mode parameter:
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-ui_mode
thanks @oblique mulch
I just tried against test mode and I get this error:
Exception SessionCreateParams
com.stripe.exception.InvalidRequestException: The "payment_method" permission needs to be requested when payment_method_options[us_bank_account][financial_connections][permissions] is included.; request-id: req_qT1YNnuL80Z0KO
Does the error subside if you include the payment_method permission in the array of permissions you request?
I am actually passing the permissions as array
But that array does not include the payment_method permission in the request you shared.
List<SessionCreateParams.PaymentMethodOptions.UsBankAccount.FinancialConnections.Permission> thePermissions = new ArrayList<>(2);
thePermissions.add(SessionCreateParams.PaymentMethodOptions.UsBankAccount.FinancialConnections.Permission.BALANCES);
thePermissions.add(SessionCreateParams.PaymentMethodOptions.UsBankAccount.FinancialConnections.Permission.TRANSACTIONS);
SessionCreateParams.PaymentMethodOptions.UsBankAccount.FinancialConnections theFinancialConnections = SessionCreateParams.PaymentMethodOptions.UsBankAccount.FinancialConnections.builder().addAllPermission(thePermissions).build();
setPaymentMethodOptions(SessionCreateParams.PaymentMethodOptions.builder()
.setUsBankAccount(SessionCreateParams.PaymentMethodOptions.UsBankAccount.builder().setFinancialConnections(theFinancialConnections)
.build())
Yeah, looks like that only includes BALANCES and TRANSACTIONS. You'll need to add PAYMENT_METHOD to the list of permissions as well.
Any time! Glad to hear that did the trick
yes, sir
what is the point of passing a return_url for Stripe Checkout with embedded ui_mode?
tried ui_mode as embedded.
the Checkout form did not render at all. Is there anything that I am missing?
That's there because some Payment Methods require redirecting the customer to a third-party site, and we need to know where they should be sent back to once that has been completed.
That's explained in more detail in this page, that is linked to from the section telling you to include a return_url:
https://docs.stripe.com/payments/checkout/custom-redirect-behavior
If you aren't planning to and don't want to leverage redirect-based payment methods, you can avoid having your customers redirected.
It's hard to say without more context. Do you see any errors being thrown to the browser console when the form fails to render?
no console errors.
the server successfully creates the session.
Until now, I was opening the session.url within the server call (is that best practice?).
Now with ui_mode as embedded, what do I in the server after the session is created?
return Response.status(Response.Status.SEE_OTHER)
.header("Location", session.getUrl())
.build();
Embedded Checkout Sessions do use a different flow, because you are embedding them on your page rather than redirecting your customer to them. The full flow is shown in the guide that I linked previously. Sounds like you've already handled Steps 1 and 2, and need to pick up the process here:
https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=embedded-form#mount-checkout
Yup, exactly