#luciano-subs-sepadebit

1 messages · Page 1 of 1 (latest)

grand timberBOT
#

Hello! We'll be with you shortly. 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.

bold nest
#

How can I help?

meager grail
#

in practice, I create a customer with a sepa debit payment method, I create a subscription but it shows as incomplete status. why does the payment fail?

#

const paymentMethod = await stripe.paymentMethods.create({
type: 'sepa_debit',
sepa_debit: {
iban: "AT611904300234573201"//data.iban,
},
billing_details: {
name: data.nameOwner + " " + data.surnameOwner,
address: {
country: "IT",
line1: data.ownerResidence.address + " " + data.ownerResidence.nCivic,
state: data.ownerResidence.province,
city: data.ownerResidence.city,
postal_code: data.ownerResidence.zipCode,
},
email: data.email,
phone: "+39" + data.phoneNumber,
}

    });

    const customer = await stripe.customers.create(
        {
            name: data.nameOwner + " " + data.surnameOwner,
            address: {
                country: "IT",
                line1: data.ownerResidence.address + " " + data.ownerResidence.nCivic,
                state: data.ownerResidence.province,
                city: data.ownerResidence.city,
                postal_code: data.ownerResidence.zipCode,
            },
            description: "Proprietario del club",
            payment_method: paymentMethod.id,
            invoice_settings: {
                default_payment_method: paymentMethod.id,
            }
        });

    //TODO set real price
    const subscription = await stripe.subscriptions.create({
        customer: customer.id,
        items: [
            { price: 'price_1O3kLhLgNVR2NB8Dceq1PF1n' },
        ],
    });
#

this is code

#

obviously it's a test

bold nest
#

If I had to guess, it might be related to mandate requirement.

You seem to be creating PaymentMethod directly by calling the API.

#

Which doesn't automatically create a mandate for the PaymentMethod

meager grail
#

so what should I do?

#

in addition to the functions I called, what else should I add to create the mandate?

bold nest
#

I believe my colleague mentioned that in your previous thread

Ignoring most of that: the problem is that you don't have any Mandate for your SEPA Debit PaymentMethod, so the Subscription will be incomplete as there's no way for it to be paid.

see https://stripe.com/docs/payments/sepa-debit/accept-a-payment?platform=web&ui=element#web-collect-payment-method-details

  1. Create the Subscription
  2. Complete the Subscription client-side with PaymentElement
  3. if you do that it will fill out the Mandate for you as expected
meager grail
#

the problem is that I use flutter in client-side. Isn't there a more detailed guide for that language?

bold nest
#

Unfortunately, we don't have have any guides for flutter.

grand timberBOT
#

luciano-subs-sepadebit

meager grail
#

ok

#

one last thing, when I create the paymentintent for this procedure shouldn't it refer to the subcription somehow?

bold nest
#

Sorry, I'm confused. Why are you creating a PaymentIntent for this?

When you create a subscription, the latest_invoice should have automatically created a PaymentIntent already (unless you use a trial)

meager grail
#

in the guide he sent me he creates a payment intent

#

is it used to pay for the subscription?

bold nest
#

No, that guide was meant to be used for learning how to collect the payment method details and mandate acknowledgement.

#

Taking a step back, all you want to do is to create subscriptions using SEPA payment methods right?

#

Is there a specific reason you're creating PaymentMethods directly by calling stripe.paymentMethods.create instead of using Stripe Elements?

meager grail
#

no, simplicity😅

#

ok, so I don't have to create the paymentmethod

bold nest
#

No, if you let Stripe Elements handle this then there won't be an issue with the mandate.

We don't have a guide specific to mobile but you can combine two of the following:

follow step 1 through 4: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements

Then, follow step 4 onwards: https://stripe.com/docs/payments/accept-a-payment?platform=android&ui=payment-sheet#android-collect-payment-details

Since we don't have flutter specific resources, the second guide is to be used just for reference. You'd need to implement your logic similarly.

meager grail
#

ok, perfect, I'll try to proceed like this. thank you so much for your patience

bold nest
#

NP! 🙂 Good luck