I am using Stripe as payment processor for my Flutter app. I have made the card part working. Now I am trying to allow customers to add ACH Direct Debit as payment method and ran into some difficulties.
There are bits and pieces of information here and there. But I could not find a clear explanation of the workflow in the front end and the back end. I was trying to follow the workflow for adding a card. But Stripe.instance.presentPaymentSheet() fails with not informative exception (It only says it failed because of some unexpected error.) I also searched and found some articles saying I should use Stripe.collectBankAccount() or Stripe.collectFinancialConnectionAccounts(), which I tried with no success.
The general workflow is as follows:
- On the server side, create a setup intent for ACH (Firebase Cloud Function using TypeScript)
const intent = await stripe.setupIntents.create({
customer: stripeCustomer.id,
payment_method_types: [
'us_bank_account',
],
payment_method_options: {
us_bank_account: {
financial_connections: {
permissions: ['payment_method'],
},
},
},
});
// get customer ephemeral key
const customerEphemeralKey = await stripe.ephemeralKeys.create({
customer: stripeCustomer.id,
}, {
apiVersion: stripeConfig.stripeApiVersion,
});
return {
status: "success",
statusCode: 200,
clientSecret: intent.client_secret,
customerId: stripeCustomer.id,
customerEphemeralKeySecret: customerEphemeralKey.secret,
};
- On the client side, present some kind of UI for the user to provide the bank information (Flutter). Here is where I failed. I tried Stripe.instance.presentPaymentSheet(), Stripe.instance.collectBankAccount(), and Stripe.instance.collectFinancialConnectionsAccounts(). None of them worked.
Any insight/tips on how to make ACH work on Flutter with Stripe will be highly appreciated.
Thanks!