#adityalystlocdeveloper_33428
1 messages · Page 1 of 1 (latest)
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.
- adityalystlocdeveloper_33428, 9 hours ago, 7 messages
const currentSubscription = await stripe.subscriptions.update("sub_1OH5SuSI198cQJkBX8BpkLMZ", {
cancel_at_period_end: true,
});
// const remainingTime = currentSubscription.current_period_end - Math.floor(Date.now() / 1000);
console.log(new Date(currentSubscription.current_period_end).getTime());
const newSubscription = await stripe.subscriptions.create({
customer: "cus_P5FyyIkOtn7B1i",
items: [{ price: "price_1OGycKSI198cQJkB7C4HaLpK" }],
billing_cycle_anchor:currentSubscription.current_period_end,
currency: "inr",
});
You can use a subscription schedule to either schedule the change from one price to another or schedule the start of the new subscription to be in the future https://stripe.com/docs/billing/subscriptions/subscription-schedules
can you nplease cheack above code
I did. If you want to stick to only using the Subscription create call directly, you can try using a free trial on the second subscription but that might be more difficult to work with than the subscription schedules that I mentioned.
can you show syntax for node js
For which one? The trial or the subscription schedule?
subscription schudle
all data is above
const currentSubscription = await stripe.subscriptions.update("sub_1OH5SuSI198cQJkBX8BpkLMZ", {
cancel_at_period_end: true,
});
// const remainingTime = currentSubscription.current_period_end - Math.floor(Date.now() / 1000);
console.log(new Date(currentSubscription.current_period_end).getTime());
const newSubscription = await stripe.subscriptions.create({
customer: "cus_P5FyyIkOtn7B1i",
items: [{ price: "price_1OGycKSI198cQJkB7C4HaLpK" }],
billing_cycle_anchor:currentSubscription.current_period_end,
currency: "inr",
});
We show the code for that in this doc https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#start-subscription-future
how can we add currency for items
This parameter https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-phases-items-price_data-currency
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Or it would already be set on the price object if you are still using Prices like price_1OGycKSI198cQJkB7C4HaLpK instead of creating prices with price_data
i have plan which in us and ind so how can i pass currency as "inr
have to create two plans separtely?
i have my plan id
I am confused by your question
You can pass in INR to the paramters that I just linked to
Prices and Plans can be used across multiple subscriptions. So if you only have once INR amount that you want to charge, you only need to create one Price. If you have mutliple amounts you should create multiple Price objects or use the price_data parameter