#ctodan

1 messages · Page 1 of 1 (latest)

indigo epochBOT
analog flume
#

You don't, because the first invoice doesn't require payment, its a trial

#

instead, you confirm the subscriptions pending_setup_intent to collect the payment detils, if you want to do that up front

odd berry
#
        const latestInvoice: Stripe.Invoice = subscription.latest_invoice as Stripe.Invoice
        const paymentIntent: Stripe.PaymentIntent =
            latestInvoice.payment_intent as Stripe.PaymentIntent

        await this.stripe.paymentIntents.confirm(paymentIntent.id, {
            payment_method: paymentMethodId,
            mandate_data: {
                customer_acceptance: {
                    type: "online",
                    accepted_at: new Date().getTime(),
                    online: {
                        ip_address: ipAddress,
                        user_agent: userAgent,
                    },
                },
            },
        })
#

so this is what we currently do (with no trial period)

#

We'd like to make it so that the user is automatically charged at the end of the trial to an existing payment_method (unless they cancel of course)

analog flume
#

But that looks like you're confirming the payment intent with a payment method you already have -- where does that payment method come from?

odd berry
#

So first step in our set up for our app is linking a bank account with Plaid

#

so that gets linked to stripe via the old sources api

analog flume
#

ok, so you always collect this up front?

odd berry
#

ya, for context its an investing app

#

so plaid account is used to fund the brokerage account as well

analog flume
odd berry
#

hmm ok, do i have to provide it in the subscription creation?

#

Can i not provide it in the setupIntent.confirm?

analog flume
#

You should be able to provide it in the setup confirm, yes.

odd berry
#

ok so the code should be almost identical right?

#

stripe.setupIntents.confirm instead of stripe.paymentIntents.confirm