#Bharat
1 messages ยท Page 1 of 1 (latest)
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"],
});```
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?
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
got it. If helpful, I think reference is under payment_method_options[card][mandate_options]
I'm only seeing amount, amount_type, and description in those fields.
Taking a closer look at the doc my teammate linked, I see this section about Subscription creation which leads me to believe that you don't need to do anything special when creating Subscriptions and that Stripe will handle that for you. Would you mind taking a look at see if you're reading it the same way?
https://stripe.com/docs/india-recurring-payments#subscription-creation
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.
๐ that's what I got from that as well.