#Bharat

1 messages ยท Page 1 of 1 (latest)

untold ospreyBOT
prisma vortex
#

๐Ÿ‘‹ happy to help

compact finch
#

Yep, went through this page. In terms of the subscription part, should we just add this block to the subscription?

    card: {
      mandate_options: {
        reference: '{{REFERENCE}}',
        description: '{{DESCRIPTION}}',
        amount: 1099,
        start_date: 1675238400,
        end_date: 1738396800,
        amount_type: 'fixed',
        interval: 'month',
        interval_count: 1,
        supported_types: ['india'],
      },
    },
  },```

so you end up with...

```await stripe.subscriptions.create({
              customer: stripeCustomerId,
              items: [
                {
                  price: selected.priceId,
                },
              ],
              payment_behavior: "default_incomplete",
              payment_method_options: {
                card: {
                  mandate_options: {
                    reference: "{{REFERENCE}}",
                    amount: amount,
                    start_date: 1675238400,
                    amount_type: "fixed",
                    interval: "month",
                    interval_count: 1,
                    supported_types: ["india"],
                  },
                },
              },
              expand: ["latest_invoice.payment_intent"],
            });```
prisma vortex
#

yes

#

the code exists in the page I've sent you earlier

compact finch
#

Got it. And for the REFERENCE, what do you recommend for the unique id. Is this unique to the type of subscription? Or each user's individual subscription?

uncut cargo
#

Hi there ๐Ÿ‘‹ my teammate needed to step away, I'll be back in just a moment to take a look.

#

First, I'd like to point out that payment_method_options are nested under payment_settings when creating Subscriptions:
https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_settings-payment_method_options

I'm also not seeing a reference field there, so I'll need to take a closer look at where that is coming from:
https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_settings-payment_method_options-card-mandate_options-amount

compact finch
#

got it. If helpful, I think reference is under payment_method_options[card][mandate_options]

uncut cargo
#

I'm only seeing amount, amount_type, and description in those fields.

compact finch
#

Yeah the docs suggest that. So based on that, looks like the mandate_options don't need to be passed for subscriptions, but only for manual setup_intents and payment_intents being created ๐Ÿค”

#

Stripe handles the internal logic eliminating the need to pass in extra parameters when you create a subscription.

uncut cargo
#

๐Ÿ‘ that's what I got from that as well.