#john_prefetch-financial-connections

1 messages ยท Page 1 of 1 (latest)

rustic berryBOT
#

๐Ÿ‘‹ 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.

valid harnessBOT
#

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.

oblique mulch
#

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!

rustic berryBOT
#

john_prefetch-financial-connections

potent lodge
#

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/

#

?

oblique mulch
#

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.

potent lodge
#

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?

oblique mulch
potent lodge
#

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?

oblique mulch
#

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.

potent lodge
#

any documentation for using Payment Element?
Is there a flag that controls embedded Checkout Session?

oblique mulch
#

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

potent lodge
#

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

oblique mulch
#

Does the error subside if you include the payment_method permission in the array of permissions you request?

potent lodge
#

I am actually passing the permissions as array

oblique mulch
#

But that array does not include the payment_method permission in the request you shared.

potent lodge
#

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())

oblique mulch
#

Yeah, looks like that only includes BALANCES and TRANSACTIONS. You'll need to add PAYMENT_METHOD to the list of permissions as well.

potent lodge
#

ok. let me try

#

that works. thank you!

oblique mulch
#

Any time! Glad to hear that did the trick

potent lodge
#

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?

oblique mulch
#

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.

oblique mulch
potent lodge
#

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();

oblique mulch
potent lodge
#

I see. So, the front-end code needs to change

#

will try. thanks

oblique mulch
#

Yup, exactly