#nadiya_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/1339388368118747136
π 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.
- nadiya_webhooks, 4 hours ago, 43 messages
- nadiya_upcoming-invoice-event-days, 6 hours ago, 21 messages
- nadiya_code, 1 day ago, 14 messages
- nadiya_code, 1 day ago, 23 messages
return [
{
// Phase 1: From schedule start until the fixed billing day.
end_date: nextBillingDateUnix,
items: [{ price: stripePriceId, metadata }],
collection_method: "send_invoice",
invoice_settings: {
days_until_due: 3,
},
proration_behavior: "none",
metadata,
},
{
// Phase 2: Begins automatically at the previous phase's end_date.
items: [{ price: stripePriceId, metadata }],
proration_behavior: "none",
metadata,
},
];
this is how i create each phase.
what did i miss?
Hi hi! Let me mull this over for a sec. π
proration_behavior: "none" makes the current period free.
but its not free for the subscription i created
Hm lolz
Ok so the goal is:
A user starts a subscription any day of the month by paying for a full month. On the 25th, they'll be re-billed for the upcoming month, and again every 25th until hopefully the heat death of the universe
Is that right?
yes correct
Ok. Let me figure out how to do this. π
yes please!
I believe this will do what you want:
return [
{
// Phase 1: From schedule start until the fixed billing day.
billing_cycle_anchor: "automatic",
end_date: aVariableThatDefinitelyContainsTheUnixTimestampOfTheNext25thOfTheMonth,
items: [{ price: stripePriceId, metadata }],
collection_method: "send_invoice",
invoice_settings: {
days_until_due: 3,
},
metadata,
},
{
// Phase 2: Begins automatically at the previous phase's end_date.
billing_cycle_anchor: "phase_start",
items: [{ price: stripePriceId, metadata }],
metadata,
},
];
no proration_behavior?
if we don't specify this, shouldn't it create proration automatically (create_prorations)?
we're charging the full amount, not the proated amount
It won't create prorations, but also the first Invoice's billing_cycle_anchor is whatever datetime it was created.
Is it acceptable to wait for the second invoice on the 25th for the 'correct' anchor?
What I provided there accomplishes this goal.
if today is Feb 13, then first cycle will be Feb 13 - Feb 25?
It would show as the 13th to the 13th.
but the invoice generated to the customer will show as Feb 13 - Mar 13, which is misleading
yes right
sure
'Might' is carrying a lot there π
π
Ok so I have an answer and it's a funny one. π
oh cool!
You actually want to create a Subscription (directly), with the following:
{
"customer": customerId,
"items": [ { "price": stripePriceId, metadata } ],
"collection_method": "send_invoice",
"days_until_due": 3,
"backdate_start_date": thePrevious25th,
"billing_cycle_anchor": theNext25th,
}
oh wow! i tried a lot with subscription first, and i moved to subscription schedule later when i can't find any solution
btw, does this work if i subscribe on 27th?
First invoice would be Feb 25 to Mar 25
how about not adding proration amount?
"backdate_start_date
timestamp
For new subscriptions, a past timestamp to backdate the subscriptionβs start date to. If set, the first invoice will contain a proration for the timespan between the start date and the current time. Can be combined with trials and the billing cycle anchor."
It doesn't do any proration - or rather, the whole amount is kinda a proration. Β―_(γ)_/Β―
Give it a go; I think you'll find it does what you're looking for. π
jack_stripe is here if you need anything further; I have to go play some Minecraft now. π€ͺ Have a good one!
Hi @drifting goblet I'm taking over tihs thread, give me a sec to catch up
sorry, is there any way to do the same with schedules?
i do have other plan (with different requirements, and i'd used schedule for both code (like a re-usable one),
also, i've used schedules so that i can create two phase in which the first phase (one iteration ) will use collection_method: "send_invoice", and the rest will charge automatically
No, there's no backdate param available in subscription schedules API
its fine to start from the current day, but it should end on the next 25th. (without showing them wrong period for the first phase in the invoice. ie, if today is 13th , the, it should show Feb 13 - Feb 25 (not Feb 13- Mar 13)