#fon

1 messages · Page 1 of 1 (latest)

open gorgeBOT
hard quarry
#

if I create a Subscription (payment_behavoir=default_incomplete) , and use the pending_setup_intent from that newly created subscription, and confirm that setup intent from the client, the e-mandates should be handled automatically?
That's my understanding. Are you seeing something different?

velvet loom
#

The problem is that, creating a Subscription before gathering payment, I think it would make our logic a bit more complicated, since then we need to have a logic to cancel the subscription if payment is not provided within X

#

So the alternative would be to create a SetupIntent, and only when the payment method is provided, create the Subscription and pass in the payment method from the SetupIntent. But then I guess I do have to manage the mandates manually

hard quarry
#

If I'm reading this guide correctly, I think you have the full understanding of it, though I'm not 100% sure that you wouldn't have to do some amount of manual handling on your end for the Subscription flow: https://stripe.com/docs/invoicing/india-emandate-guide

As far as I can tell from our docs, Stripe will create the mandate for you, but you will still need to provide the details on the mandate via mandate_options in both the Subscriptions flow and the regular Setup Intents flow without Subscriptions

Learn how to integrate India e-mandates with Stripe Invoicing.

#

Only Stripe Checkout handles the full end-to-end mandate workflow for you (unless I'm missing something glaring)

velvet loom
#

Following this tutorial:

https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements

When first creating the "inactive" subscription like this:

subscription = stripe.Subscription.create(
          customer='cus_xxxx',
items=[{
'price': 'price_xxxx',
}],
             payment_behavior='default_incomplete',
payment_settings={'save_default_payment_method': 'on_subscription'},
expand=['latest_invoice.payment_intent'],
)

it says:

At this point the Subscription is inactive and awaiting payment.

Yet both in the UI and in the API the subscription says "active"

Create and manage subscriptions to accept recurring payments.

#

that makes sense, that I have to pass in the mandate options, since for a metered plan only I can guess how much would be charge in the future

#

So I guess my only last question is what I asked above, regarding the active / inactive subscriptions from the Tutorial

hard quarry
#

Do you have an example Subscription ID I can look at?

velvet loom
#

yes, I just created sub_1MEyIHG2GxotelpZXYRJCgwq

#

maybe in the Tutorial they use a non-metered price ?

hard quarry
#

Yeah, so this is a metered Subscription, which will behave a little different. Since an Invoice is not generated until the end of the billing cycle, the Subscription is considered active as soon as it is created

velvet loom
#

oh then it seems like it would be easier to:

  • First Create a SetupIntent
  • Confirm the SetupIntent with Payment Method in the client
  • Then Create an active Subscription with that Payment Method --> Attaching here the mandate, as I understand, right?
#

I think what confuses me the most is this two sentences in https://stripe.com/docs/invoicing/india-emandate-guide

To generate a mandate, you must have already collected your customer’s PaymentMethods. While your customer is signed in, make a call to create a SetupIntent that includes the payment method ID and mandate details

When I first create my SetupIntent, I still don't have the payment method, since I use the client_secret of that SetupIntent to generate the Payment Form.

Then when the client app confirms the SetupIntent after the payment method is introduced, should I then modify the SetupIntent to add the mandate details in the backend?

Learn how to integrate India e-mandates with Stripe Invoicing.

hard quarry
#

Or do you have your own custom form?

velvet loom
#

Payment Element

#

Is the thinking here that the documentation is misleading, and I am able in fact to provide a mandate when creating a SetupIntent even if I haven't yet collected the payment method ?

hard quarry
#

Let me double-check. I'm not sure. My guess would be that you simply can't use the Payment Element, but I want to make sure I'm understanding correctly

#

Will circle back in a few

velvet loom
#

thank you, I really appreciate

hard quarry
#

Okay, so you can create the Setup Intent with confirm=False in order to create a Setup Intent with all the mandate_options. From there, you should be able to just follow the Payment Element flow as usual and Stripe will automatically create the mandate when the customer completes 3DS

#

You don't need to have a Payment Method up front in order to create the Setup Intent. I haven't yet tested if this will work with the Payment Element, but I can't see why it wouldn't. If you want, you can open a support email thread and I can get back to you in the next few days about this to confirm for sure. I just don't have the bandwidth to do it immediately in chat, as that requires a lot of coding and I'm juggling a number of other Discord threads.

If you want me to confirm it works with Payment Element, please open a support thread here: https://support.stripe.com/contact/email, then DM me your email address and account ID

velvet loom
#

that helps immensely, thanks so much! I will confirm it myself but at least this gives me confidence in going this route, thanks Two-shoes!

#

I will DM you my e-mail regardless so if you end up having some time to verify I appreciate!