#alberto_code
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/1230007048586919986
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Here it can be seen that the user is charged less at the beginning and end of the payment
You would want to look into the concrete value on your request to create Subscription
Request log at https://dashboard.stripe.com/test/logs
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Probably you set the billing_cycle_anchor
This the product:
and then it prorates on the time differences
Ok, I'll check
this is my subscription
Yes but I mean you would want to zoom into the billing cycle
Ok
Could proration be avoided if I remove the billing_cycle_anchor? And make the first charge for the monthly fee separately ๐ค
Yeah I believe so. You can convert those time into human-readable time to see what you set it to
remember all parameters are in UTC
Alright, but it can't be made visible to people:(
This needs to be controlled from the backend
jeje
The goal is to make recurring payments within a year only, but these payments can be bi-weekly, weekly, or monthly ๐
So, for this, I need to make 12, 24, or 54 charges during the year with a fixed price. Where:
Monthly = 12
Weekly = 54
Bi-weekly = 24
And at the end of the year, the subscription needs to be canceled ๐
The subscription starts on the day the user purchases a product
I'm placing intervals and then multiplying them by the total payment, could that be the error?๐ค
I think you should use the built in function of Java instead of calculating yourself
There could be many more things, like leap year, and or the number of day on each month are different
I'm using JavaScript as the language, what do you recommend for correctly calculating dates?
using getMonth() or getDay() like this https://www.geeksforgeeks.org/how-to-calculate-the-date-three-months-prior-using-javascript/ ? Sorry not super familiar with Node
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
Actually, that's what I use.
In fact, I shared the code with you at the beginning of the thread
Do you have a Java implementation of this calculation where the subscription start is the billing_cycle_anchor and the cancellation of the subscription is one year?
Okie let's look at the calculated value of your request
Can you look up your sent request at https://dashboard.stripe.com/test/logs ? and paste here the request id req_xxx?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
This is another one I made a few minutes ago, if you'd like, let's consider this one.
I mean, can you find the request id here? req_xxx
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Billing Cycle Anchor = 2024-05-16 06:00:00 UTC
Cancel At = 2025-04-12 02:15:05
So the last Invoice of 2025-03-16 to 2025-04-12 will be less than 1 month, so it's 1730.99 instead of 1999.00
Okay, so it seems like the issue is because I'm setting intervals for the weekly, monthly, and bi-weekly methods. But how can I do this without doing it manually? To achieve a certain number of payments depending on whether it's monthly, bi-weekly, or weekly, all within just one year ๐ค
const cancelAtDate = new Date(dateNow.getTime() + totalPayments * intervalDays * 24 * 60 * 60 * 1000);
Let's say if totalPayments = 12 (you set monthly), this will calculate on intervalDays = 30?
Each month as a different days number, some has 31, some has 30
say it's not exactly that 30 days equal to 1 month