#daniel_ach-mandate

1 messages ยท Page 1 of 1 (latest)

crude etherBOT
craggy karmaBOT
#

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.

crude etherBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

worn briar
#

Default payment method is already set
What does that mean? What is set and where?

boreal inlet
#

await this.stripe.customers.update(customerId, {
invoice_settings: {
default_payment_method: paymentMethodId,
},
})

#

like with that code

worn briar
#

You seem to use legacy ACH Debit via ba_123

#

do you have a proper Mandate collected for that object?

boreal inlet
#

yes, it was just collected before we used stripe

#

the users i'm migrating have active subscriptions with us but with our custom payment solution

#

its about 100 users that im trying to migrate

worn briar
#

yes, it was just collected before we used stripe
okay so you don't have one on Stripe right? That's the problem if so

boreal inlet
#

hmm I think i see

#

so i first run this: stripe subscriptions create --customer=cus_Q3aaEsTn4MmW8V -d "items[0][price]"=price_1NC4wPJmq474uon8gtcPKlDJ -d "trial_end"=1745812799

#

that creates the subscription right

#

and then what would i run after that?

worn briar
#

It's kinda completely unrelated

#

where are those ba_123 coming from in the first place?

boreal inlet
#

we used plaid for those

worn briar
#

daniel_ach-mandate

boreal inlet
#

because users already link their bank account to fund thier investing accounts in our app (thats our product)

worn briar
#

The idea is to make sure you have a validate Mandate for that BankAccount before you charge it

boreal inlet
#

im a little confused, i must make a setup intent?

#

also must i reach out to stripe support?

worn briar
#

All you have to do, as a developer, is force create a Mandate by using a SetupIntent because you already have legacy BankAccount objects in your account.
You don't need to reach out to stripe support for this, but you have to run a "migration" on your end to force create a Mandate for each record

#

What programming language do you use for your real code/scripts?

boreal inlet
#

stripe setup_intents create
-d "payment_method_types[0]"=us_bank_account
--customer={{CUSTOMER_ID}}
--confirm=true
-d "payment_method_options[us_bank_account][verification_method]"=skip
-d "payment_method_data[type]"=us_bank_account
-d "payment_method_data[billing_details][name]"={{ACCOUNT_HOLDER_NAME}}
-d "payment_method_data[billing_details][routing_number]"={{ROUTING_NUMBER}}
-d "payment_method_data[billing_details][account_number]"={{ACCOUNT_NUMBER}}
-d "payment_method_data[billing_details][account_holder_type]"=individual
-d "mandate_data[customer_acceptance][type]"=offline
-d "mandate_data[customer_acceptance][accepted_at]"=1692821946

So i must run this when i create the bank account? And must do this before i run the command to create the subscription?

#

we code in Node JS

#

Im using a mix of things to get this migration done

worn briar
#

yeah I mean I never use the CLI for things like this. I highly recommend writing real end to end scripts to test all of this cleanly. And no I tried to explain you should not pass payment_method_data

boreal inlet
#

sorry i mean the command/code without payment_method_data

#

but that endpoint

worn briar
#
  payment_method_types: ['us_bank_account'],
  customer: 'cus_123',
  confirm: true,
  payment_method: 'ba_123',
  mandate_data: {
    customer_acceptance: {
      type: 'offline',
      accepted_at: <time when they accepted>,
    },
  },
});```
#

like this ^

boreal inlet
#

const bankAccount = await this.stripe.customers.createSource(stripeCustomer.id, {
source: stripeBankAccountToken.stripe_bank_account_token,
})
OK, so this ^ is how i create the payment source right now

worn briar
#

oh boy

boreal inlet
#

so i should keep calling that, but then also call stripe.setupIntents.create passing in the payment_method id returned from the bankAccount?

worn briar
#

I thought you said you had some historical records to migrate, not that you were still using this ๐Ÿ˜…

boreal inlet
#

haha afaik thats the only way to use Plaid with stripe still

#

That was coded with lots of help from this chat hahah ๐Ÿ˜…

worn briar
#

Cool then that's fine (though really you should switch to FinancialConnections)

#

but yes you need that SetupIntent to get a Mandate in that case

boreal inlet
#

its not really an option since our broker dealer uses plaid to fund the account (using financial connections)

#

so we never want to make the user link the bank account twice

worn briar
#

๐Ÿ‘

boreal inlet
#

ok so just to clarify the order of things here:

  1. Create source (payment method) from our existing plaid access token -. This returns the paymentMethodId
const bankAccount = await this.stripe.customers.createSource(stripeCustomer.id, {
                source: stripeBankAccountToken.stripe_bank_account_token,
            })
  1. Create setupIntent
            const setupIntent = await this.stripe.setupIntents.create({
                payment_method_types: ["us_bank_account"],
                customer: customerId,
                confirm: true,
                payment_method: paymentMethodId,
                mandate_data: {
                    customer_acceptance: {
                        type: "offline",
                        accepted_at: accepted_at,
                    },
                },
            })
  1. Create set defaultPaymentMethod on user
        await this.stripe.customers.update(customerId, {
            invoice_settings: {
                default_payment_method: paymentMethodId,
            },
        })
  1. Create the subscription with the trial_end date in the future (to match with our old subscription systems renewal date)
stripe subscriptions create --customer=cus_Q3aaEsTn4MmW8V -d "items[0][price]"=price_1NC4wPJmq474uon8gtcPKlDJ -d "trial_end"=1745812799
worn briar
#

yep

craggy karmaBOT
boreal inlet
#

once i start a test clock on a user there is no way to take it off right?

#

also the setupIntent thing seems to work in test mode, thanks!