#shruti_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1293528946478022728
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- shruti_api, 1 hour ago, 15 messages
Sorry, I don't understand your question. What is it you're trying to do?
I want to generate an invoice for the current month on the last day of the month
Then you will want to use this param: https://docs.stripe.com/api/subscriptions/create#create_subscription-billing_cycle_anchor_config
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Will allow you to configure the anchor to the last day of the month
I have tried with 'BillingCycleAnchor', 'BillingCycleAnchorConfig' properties to change the the date. it changes the date but bills for next month. i want it to work like this (e.g. creates a subscription on 2024/10/09. generate an invoice on 2024/10/31 for the period of 2024/10/09 to 2024/10/31)
That's not possible really. The period will respect the interval configured on the item(s) (i.e. monthly)
is there any way to workaround
is there any way to achieve this
or if we can change the invoice template to not show the billing period
Can you share an example request where you used the billing_cycle_anchor_config param?
// Calculate the timestamp for the last day of the current month at 23:59:59
DateTime lastDayOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month,
DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month), 23, 59, 59);
long billingCycleAnchor = ((DateTimeOffset)lastDayOfMonth).ToUnixTimeSeconds();
var options = new SubscriptionCreateOptions
{
Customer = CustomerId,
DefaultPaymentMethod = PaymentMethodId,
//TrialPeriodDays = _stripeSettings.Value.TrialPeriodDays,
Coupon = string.IsNullOrEmpty(tStripeCouponId) ? "" : StripeCouponId,
ProrationBehavior = "none",
Items = subscriptionItems,
BillingCycleAnchor = lastDayOfMonth
//BillingCycleAnchorConfig = new SubscriptionBillingCycleAnchorConfigOptions
//{
// DayOfMonth = 31,
//},
};
The actual request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Your code above doesn't even pass the param (it's commented out)
I have tried with BillingCycleAnchorConfig param too. still the billing cycle did not change
only bill date changes
Can you please share some API requests so I can see the actual parameters passed and the response
No idea what 'bill date' is โ please reference actual API fields
Bill date means invoice generation date
Ok, well until you share some object or request IDs I can't really help beyond that
let me share
DateTime lastDayOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month,
DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month), 23, 59, 59);
long billingCycleAnchor = ((DateTimeOffset)lastDayOfMonth).ToUnixTimeSeconds();
var options = new SubscriptionCreateOptions
{
Customer = CustomerId,
DefaultPaymentMethod = PaymentMethodId,
ProrationBehavior = "none",
Items = subscriptionItems,
BillingCycleAnchorConfig = new SubscriptionBillingCycleAnchorConfigOptions
{
DayOfMonth = 31,
},
};
var service = new SubscriptionService();
Subscription subscription = service.Create(options);
You're just sharing the same code โ I want to see the actual API request that your code creates
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Or the sub_xxx ID
Subscription Request Obj
FWIW, the subscription creation will always generate an initial invoice immediately. That is unavoidable. We bill at the beginning of the period unless metered/usage billing
response
For reference, all we need is the ID (sub_xxx). We can see all this detail in our internal systems
sub_1Q7y68CG6BBG59bw1YUfZU8E
In any case, this is your answer. It's not possible
We have a quantity-based product in subscription. Which will be increased/decreased in a month. So we want to charge per quantity once it is increased. no matter we want to charge once in a month if added new quantity even if it is deleted mid month.
that is why we want to charge in the month end for the total added quantity. and will decrease the quantity once the invoice is paid through scheduler
Yep, understand that. But it's not possible
Maybe look at usage billing which invoices at the end of the period according to reported usage: https://docs.stripe.com/billing/subscriptions/usage-based
Maybe you can model that to your business
What will Usage-based model exactly do
Read the doc I linked, should outline it. But it's the only way to invoice at the end of a period which is what you want
let me check. please stay a while
thank you for the support
Can you please add me as a friend so that i can contact you
Anything you need to ask you can ask here ๐
how can i increase this quantity with usage based product
hi! I'm taking over this thread.
this is explained here: https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage
Can you explain with my model how can i integrate this model. We have a quantity-based product in subscription. Which will be increased/decreased in a month. So we want to charge per quantity once it is increased. no matter we want to charge once in a month if added new quantity even if it is deleted mid month.
that is why we want to charge in the month end for the total added quantity. and will decrease the quantity once the invoice is paid through scheduler
hello
then yes a Metered subscription can work. Just make sure to send a record usage every time some "uses" a quantity. and at the end of the month, if the customer used 3 things, then pay 3 x amount.