#jasuno-setupintent-mandate

1 messages ยท Page 1 of 1 (latest)

magic wolfBOT
rustic charm
#

jasuno-setupintent-mandate

#

Hey @balmy crown! Can you give me a better/clearer summary of your exact question? What are you looking for, which case are you looking for a Mandate? Where did you look, what's your exact code? Do you have a concrete example SetupIntent/SetupAttempt id?

balmy crown
#

Here is a summary of the last chat i had:

I encountered an error while trying to confirm a payment method, receiving the message "A mandate is required. Please either provide the id of an existing mandate on confirmation or provide payment_method_options[acss_debit][mandate_options]." After adding a mandate and sharing the corresponding request IDs, Stripe Support joined the conversation to assist. They explained that the error occurred because the payment method already had a mandate and suggested checking the Stripe dashboard to find the existing mandate ID. I asked about fetching the mandate ID through the Stripe API, but Stripe Support clarified that it would have needed to be stored during creation and provided information on retrieving the mandate using its ID. Then I asked about the return of mandates from the "confirmAcssDebitSetup" operation, and Stripe Support clarified that the mandate details could be accessed through the "setupIntent" object.

rustic charm
#

Okay so the real information here is: You are using ACSS Debit, you collect payment method details via a SetupIntent before and now want to charge that PaymentMethod?
Can you share an exact SetupIntent id for me to look at?

balmy crown
#

Here is the requestid: req_IFOWIm2sZ2SoJX
Here is the intentId: seti_1N9VuwAq6ReFUKV894BKuJQt

rustic charm
#

Okay so that SetupIntent has a Mandate id in the mandate property

#

Like just call Retrieve SetupIntent and you'll see the Mandate right there

balmy crown
#

So the mandate is not set until after the setup is completed?

rustic charm
#

Correct! The Mandate is signed as part of the SetupIntent. And you need the Mandate to be properly created/accepted to use it

balmy crown
#

One more thing

#

When making the payment i provide a mandate but getting an error
req_5KTYWfPsZ8XCRE

rustic charm
#

You can't pass a Mandate id if you already set mandate options on the PaymentIntent

#

I'm sorry, I'm really struggling to follow what you're trying to do here

#

Are you using Subscriptions? What is your overall integration in 2 sentences

balmy crown
#

Yes we are using subscriptions, I want to pay an invoice that was generated by a subscription using acss_debit

rustic charm
#

Okay so why did you do your own SetupIntent? Usually you start a Subscription and then you get the Invoice paid via ACSS Debit, you shouldn't be creating your own SetupIntent here

balmy crown
#

Because a user should be able to setup different payment methods (ACSS Debit or credit card) even if there is no subscription specially since our users (tenants) can pay into multiple subscriptions at a time. Also the way that our platform is set up is that you came pay. invoice by invoice or have a payment method setup as default

snow spruce
#

๐Ÿ‘‹ Hopping in here to take a look - give me a couple minutes to catch up

balmy crown
#

ok thanks

#

Also thanks @rustic charm for all your help

snow spruce
#

I think the issue is with how you created your SetupIntent - with ACSS Debit paymentmethods that you intend to use for Invoices/Subscriptions you need to pass in payment_method_options.acss_debit.mandate_options.default_for so that we know to use that mandate by default for future billing payments

balmy crown
#

Ok what if i need to use that same acss_debit for other subscriptions

#

I assume that should be fine

snow spruce
#

Yup that should be fine

balmy crown
#

So I should just have to add that default_for property

snow spruce
#

correct - that's something you'd want to set specifically during SetupIntent confirmation

balmy crown
#

I had one more question but its unrelated with any of this should i start a new thread?

snow spruce
#

no you can ask here

balmy crown
#

When have a Connect account get setup with the account type express link is there a way to force the ID verification, if seems like the process now is divided in 2 when we first ask for banking info and then for ID verification

snow spruce
balmy crown
#

I believe that mandatory to be able to process payouts

snow spruce
#

Yeah let me clarify - I think currently there's no way to "force" ID verification up front without first asking for banking info

#

But we do have something in beta (the link I sent you) that seems to match what you're looking for that you'd need to write in and ask if it could be enabled for your account

balmy crown
#

Cool let me check that out now

#

When should i expect the email?

#

Dam im still having trouble with this mandate thing, check out: req_R2lfu6rcsGhOCu and req_ILNi5wWCLDJlG7

snow spruce
#

I'm not sure when you'd expect a response, but let me look at those requests

balmy crown
#

Also here is the intent that failed:
req_j69VurBeRL32zw and here is what i canged it to: req_udTsrMavfYQcHF

snow spruce
#

Sorry for the wait - I think the issue here is that by confirming client-side stripe.js passed in new mandate_options that overwrote the default_for that you set

balmy crown
#

confirming the setupIntent?

snow spruce
#

(basically you're going to take the SetupIntent that you just created and confirm server-side with a new SetupIntent)

balmy crown
#

Sorry i don't fully get that, so i have my setup intent that get created when they open the setup form

{
  "payment_method_types": {
    "0": "acss_debit",
    "1": "card"
  },
  "payment_method_options": {
    "acss_debit": {
      "mandate_options": {
        "default_for": {
          "0": "subscription",
          "1": "invoice"
        }
      },
      "currency": "cad"
    }
  },
  "customer": "cus_NvKK22NLpaFWFn"
}

that gets sent to the client and is used in confirmAcssDebitSetup which triggers the bank info modal

Then on the server side i do this

const { paymentMethodId, setupIntentId } = data;
    const userId = context.auth?.uid;

    const setupIntent = await stripe.setupIntents.retrieve(setupIntentId);

and i save that mandate from the setupintent i retrieved to my own data base

magic wolfBOT
snow spruce
#

On the server side you should create a NEW Setup Intent exactly like the code sample I gave you

#

The issue is that it looks like you can only set default_for when confirming server-side

#

and so you need to create and confirm a new setup intent that sets those mandate options

#

your current flow is still creating mandates that can't be used with invoices and subscriptions

balmy crown
#

I think what im not getting is 2 things:
1.- The first setupIntent that was created on the server side then sent to the client to use the client secret to run stripe.js to be able to create the payment method, do we need any information from that one?
2.- The NEW setup intent what needs to be done with that one since its not being used,

this is assuming you are telling me to create 2 setup intents to create 1 acss_debit payment method

snow spruce
#

Yeah the first SetupIntent is creating the PaymentMethod and that's all you need from it

#

The second SetupIntent is what's actually creating the mandate that will be the default for you billing transactions

balmy crown
#

wait

#

So lets say i have 3 bank accounts, do i need 3 mandates?

snow spruce
#

Yes, you need a mandate for each PaymentMethod that you set up

balmy crown
#

Ok i think thats where im confused

snow spruce
#

Yeah mandates are tied to a PaymentMethod, they aren't tied to a Customer - so for each PaymentMethod you setup you'll at LEAST need a mandate for each

balmy crown
#

because one intent is to create the payment method, and the other is for the mandate but what links these 2, the sample code you sent me is:

const setupIntent = await stripe.setupIntents.create({
  payment_method_types: ['acss_debit'],
  customer: '{{CUSTOMER_ID}}',
  payment_method_options: {
    acss_debit: {
      currency: 'cad',
      mandate_options: {
        default_for: ['invoice', 'subscription'],
      },
    },
  },
});

Which is the same structure as the intent i set up here: req_udTsrMavfYQcHF (this is the one i send to the client)

If i create a second intent the intent will never be completed since its not being used it will just be created, and the second intent has no association with the first setup intent

snow spruce
#

AH! I see what you're saying now - give me a minute

balmy crown
#

Yeah sorry i've take so much of you alls time

snow spruce
#

no worries at all - it's a really complicated flow

balmy crown
#

Yeah i tried for a while before coming here i really appreciate the help

snow spruce
#

Okay try this for me - update that customer's invoice_settings.default_payment_method to be the PaymentMethod that you created

balmy crown
#

But what if the user doesn't what it to be their default, i'm guessing thats not possible with acss_debit

snow spruce
#

oh my gosh, I know what the issue was - can't believe I missed this

#

The payment intent you're attempting to pay with was for a subscription that has on_behalf_of set.

balmy crown
#

drum roll

snow spruce
#

But when you created the SetupIntent you didn't specify on_behalf_of so we created the Mandate specifically for you to use on your platform account

#

If you want the mandate to be pulled by default for that subscription you need to also set on_behalf_of on the SetupIntent

balmy crown
#

interesting, so if i remove the on_behalf_of i should be able to use the other mandate?

snow spruce
#

yeah, i'd expect if you removed on_behalf_of it'll pull the mandate you already have set up

balmy crown
#

ok let me try that, dam i'm glad you are here because i would have never figured that out

#

It worked ๐ŸŽ‰๐ŸŽŠ

snow spruce
#

HURRAY!

#

phew so glad we figured that out

balmy crown
#

YOU figured it out, thanks man, acss_debit payments stay in pending in testing right i'm guessing because there is no real bank?

snow spruce
balmy crown
#

Yeah i using the test clock

#

i move forward a week but its still in pending

magic wolfBOT
snow spruce
#

Yeah instead of using test clocks to test the that three day delay you should be using that email (I think we have a known bug about delayed verification methods and test clocks)

balmy crown
#

Hey thanks for everything, I think thatโ€™s it at least for now

snow spruce
#

happy to help! I'm going to close out this thread, but if you need anything else feel free to hop back in the main channel