#raimund_ach-plaid

1 messages ยท Page 1 of 1 (latest)

gray pineBOT
#

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

๐Ÿ“ 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.

oblique pewter
#

@lyric grove Okay so you are using a BankAccount ba_12345 which is our legacy integration and it seems you didn't collect a Mandate properly.
Is this a brand new integration and you are lost? Or is this a really old integration you are trying to change? Or something else?

lyric grove
#

It is a new way of using the existing registered accounts.

oblique pewter
#

raimund_ach-migration

lyric grove
#

I wouldn't say I missed it, but unfortunately I've had conflicting responses. Someone told me we'd need SetupIntents, someone else said no. So what exactly do I need to do at this point?

oblique pewter
#

It depends what you are trying to do, that's partly why you get conflicting answers I assume. It's hard to help without a clear and exact question. right now you shared an error and said it doesn't work. But I have no idea what you are trying to do, what the context is, what you've been told, etc.

So can you try to give a clear and concise summary of the issue and what you are doing that's new that got you confused?

lyric grove
#

OK, so far our customers have been paying in directly online. Some use ACH accounts, others use cards.

#

What we're now adding is an "Auto Topup" feature which lets us calculate a weekly amount that we charge them automatically. Again, some will pay via card, others via ACH accounts.

#

The amount varies per customer and week based on their expected outgoing payments. It's not a subscription or anything like that.

oblique pewter
#

Sorry, that's multiple short sequential sentences but not really a clear explanation that is understandable.

#

You came with a clear error. You also said this worked fine before but you are now doing things differently. What I need to understand is what is different. What were you doing before that you are changing, and why are you changing it?
My guess is that you used to use the Tokens and Charges API and are migrating to PaymentIntents, but it's a guess right now and that's the key information I need you to explain in details so I can help you

lyric grove
#

No, we've been using the PaymentIntents for around two months now. But so far customers have added money in directly in interactive fashion. However, this new "Auto Topup" means that we're creating PaymentIntents ourselves without them giving an explicit confirmation each time.

oblique pewter
#

Can you show me an example where it works? Because that doesn't add up to what I am seeing

lyric grove
#

pi_3Q65xVBIMZTJKM1c0dGcmwLs looks like it was done via bank account

oblique pewter
#

Gotcha so that one is confirmed client-side where we can collect mandate acceptance details.

#

How were you charging that customer where you have an error before?

lyric grove
#

We just created the PaymentIntent in the system. The customer activated a function we call "Auto Topup". We show them the calculations for the next 4 weeks and create the PaymentIntents on the respective days.

oblique pewter
#

Ignore what you did today

#

This is an old integration right? Like you have objects with the prefix ba_. Those are for a really old integration. We replaced this over 2 years ago with PaymentMethod objects that have the prefix pm_.
So I am trying to get real actionable details about how you are charging all those bank accounts in the first place because you are doing something uncommon already

lyric grove
#

Our ACH registration works via Plaid.

oblique pewter
#

Gotcha, so those are not old bank accounts you're migrating? Sorry you never mentioned Plaid before in this thread

lyric grove
#

We haven't changed that part of our flow.

#

This bank account must have been there for a while if that's what you're asking.

#

I can see the first payment with this bank account was back in April.

oblique pewter
#

All good, sorry I know it's tough but you have been here multiple times about this like you mentioned and some of those bits of information are really crucial and important though you might not realize this
Because you use Plaid and not FinancialConnections, you are on a much older integration path by default which creates BankAccount objects ba_1234 instead of PaymentMethod objects pm_1234. And those old objects have no "mandate acceptance records" in any way so you end up having to build a more complex integration because of it.

lyric grove
#

Thanks. This is the first time that someone from your end makes it this clear. ๐Ÿ™‚

#

So how can we build this? Which piece are we missing? A colleague of yours mentioned SetupIntents in the past. Is that the correct rabbit hole after all?

oblique pewter
#

Unlikely but sadly I still barely have 10% of what I need to help you in the first place. I'm trying to figure it out, it's just tough without the asker providing all the context

#

Let's focus on that Customer and its BankAccount. Are you certain you charged that Customer before with your "new integration" client-side?
I am looking at the logs and I feel like you did with the old Charges API and didn't realize it's the first time you are ever trying to charge that Customer's BankAccount with the newer PaymentIntent API

lyric grove
#

Our DB shows two entries with pi IDs, so that would have been the PaymentIntent API.

#

pi_3Q2skrBIMZTJKM1c0Hbez8ol on September 25

#

pi_3Q65xVBIMZTJKM1c0dGcmwLs on October 4

oblique pewter
#

Ah thanks that helps

#

Okay so let's look at pi_3Q65xVBIMZTJKM1c0dGcmwLs. It was confirmed in https://dashboard.stripe.com/logs/req_NB64Q5Aj2M5NGS which you did server-side with your own code already where you already passed mandate_data.
So you seem to understand what a Mandate is, why it's needed and how to configure it.
In the resulting Charge you got the Mandate mandate_1Q65xYBIMZTJKM1cGT0gNzvk as a record of that acceptance. Which means at that point the BankAccount is properly configured for future debits

#

So now if we go back to the original error you shared: why are you passing setup_future_usage: 'on_session' in your call? You are clearly charging that already saved bank account off session so there is

  1. No reason to pass setup_future_usage since it's already attached and configured
    2 No reason to pass on_session since you clearly want to charge off session right?
#

raimund_ach-plaid

lyric grove
#

We just set these parameters every time, but I already figured we're doing something wrong here.

oblique pewter
#

yeah so if you remove that parameter, it will work and use the already set up Mandate

lyric grove
#

So we don't send that parameter at all if the account has been used before, got that.

#

How about new accounts?

oblique pewter
#

new accounts should only ever be set "on session" when you are collecting their details through Plaid and charging them right?

lyric grove
#

Customers will be able to register new accounts without making an immediate payment. They should be allowed to do this "Auto Topup" thing right away. So we will have people registering through Plaid without immediate payment.

oblique pewter
#

In that case you should use a SetupIntent yes to configure their "mandate acceptance" properly

lyric grove
#

And I suppose we need to do the same for existing bank accounts which haven't run through the PaymentIntents yet?

oblique pewter
#

yup that's what that "migrating" doc I shared is about.

lyric grove
#

Thanks. ๐Ÿ™‚ What about the confirm parameter? Is that required or recommended in our scenario?

oblique pewter
#

oh boy :p

lyric grove
#

Sorry if I'm asking something stupid here.

#

In my defense: It's Friday evening. ๐Ÿ˜„

oblique pewter
#

The PaymentIntent API represents a state machine of accepting a payment, see https://docs.stripe.com/payments/paymentintents/lifecycle
So you can call the Create PaymentIntent API to indicate that you are going to accept a $122 USD payment for example.
But the payment attempt hasn't happened yet. This happens by calling the Confirm PaymentIntent API itself separately. Because the most common flow is to create that PaymentIntent and then client-side collect payment method details and confirm it.

Now in some cases, you want to charge a saved payment method for example server-side without the customer doing any action. So the default flow would be to create the PaymentIntent and immediately after call the Confirm PaymentIntent API to charge them.
So we simplified that flow that allowing you to do it in one request by passing the confirm: true parameter.

(Note: it works the same on SetupIntent).

#

(nothing stupid, I'm just realizing that we were deep in that Plaid issue but needed to explain more high level concepts first)

gray pineBOT
lyric grove
#

I think I got at least that part right, thanks. What you're telling me is that we do need this for our automatic payments.

oblique pewter
#

Maybe, sorry the wording is still super vague ๐Ÿ˜ฆ

#

When you collect bank account details you need to collect mandate acceptance from the Customer and record it as such. There are 2 ways to do this

  1. Do it while accepting a payment so use PaymentIntent and pass mandate_data while confirming the PaymentIntent
  2. Do it without accepting a payment so use SetupIntent and pass mandate_data the same way
lyric grove
#

Yes, I understood that part.

#

"charge a saved payment method for example server-side without the customer doing any action" - this is basically our "Auto Topup" function. So this requires confirm: true (assuming we've collected the mandate before via either one of the methods you described). Am I understanding that bit correctly?

oblique pewter
#

yes

#

and it requires having a previously set up Mandate too

lyric grove
#

Thanks. I think I know what to do now.
I'm wondering how to test this though. We didn't stumble on this during our tests, presumably because the same bank account data did already go through payments before.

oblique pewter
#

It works the exact same way in Test mode

#

So you would

  1. Create a Token with Plaid
  2. Add the BankAccount to a new Customer
  3. Try to create+confirm a PaymentIntent the way it errors now and it would error
lyric grove
#

Guess we missed this case then.

#

We'll go ahead and try, thanks.