#codefoot_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/1354581574036754492
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi! Can you share an ID with me please so I can have a look?
As in the api request id or?
Sure, or the Subscription Schedule ID or any other ID - just need something to start with.
GIve me a moment to get you a new example
Here's the sub ID. I did this all through workbench.
sub_1R72T5QayV4vikq1BpiKPoX0
Actions taken:
- Create new schedule
- Start date immediate
- schedule.default_settings.default_payment_method set to a payment method on the customer
- Create
- Check, invoice is in draft state
- Finalize invoice through workbench
- Invoice remains open with a weird message I haven't seen before
Why are you using Schedules for this?
We have to use schedules for many other reasons
Can you tell me more?
Monthly payment plan. Customer signs up to a subscriptio that is an annual commitment, paid monthly. Schedule. 12 phases.
Multi year subscription plans. Year 1 subscriber is on price 1, year 2, on price 2, year 3, etc.
The effort involved in creating the subscription then creating the schedule is a huge duplication that I'd prefer to avoid
That's not how you do a monthly subscription - you only need one phase unless the price changes mid-year.
That is a fair point for annuals, assuming you know the future year prices ahead of time.
How do you do an annual subscription paid monthly?
I'm not talking a recurring monthly subscription - that is not what we need
What is an annual subscription paid monthly?
That sounds like a monthly subscription with a different to me, no?
You and me both, but not to my client
They need to see 12 months commitment that can be programatically managed between their system and stripe, as well as produce unique financial reporting through Sigma
in any case, I'd like to understand my options.
Why does Stripe allow you to create a subscription using a schedule if you cannot charge for that subscription right away?
You can, you just need to finalize it and request it be immediately paid via the API when you use a Subscription Schedule rather than a regular Subscription (which does generally try to take payment immediately).
Note
Unlike when you create a subscription directly, the first invoice of a subscription schedule with collection_method set to charge_automatically behaves like a recurring invoice and isn’t immediately finalized at the time the schedule’s subscription is created. The invoice begins in a draft status and is finalized by Stripe about 1 hour after creation.This means that, for example, creating a charge-automatically subscription schedule with start_date=now also creates a subscription and an invoice in the draft status. This gives you a 1-hour window to make edits to the invoice. Later, the invoice is auto-advanced into the open or paid status depending on the outcome of the asynchronous payment attempt at finalization time.
From here: https://docs.stripe.com/billing/subscriptions/subscription-schedules#managing
Yeah read that earlier. I get finalizing. That leads to the example sub I shared. What do you mean by request it be immediately paid
They need to see 12 months commitment that can be programatically managed between their system and stripe, as well as produce unique financial reporting through Sigma
If you can tell me more about their "programmatically managed [activities]" and "unique financial reporting", I might be able to provide some alternatives.
You need to call the Pay Invoice API to immediately trigger a payment attempt.
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 ya, so:
- Do what I was doing
- Finalize invoice req
- Pay invoice req
I assume pay invoice req would fail if the invoice is in a draft state?
I think /pay finalizes too; I can't remember at the moment and our docs aren't helping me.
The concept can be likened to installments. I sign up for an annual commitment, paid monthly. As a customer, I see an outstanding balance. This balance is a calculation outside Stripe of iterations * price amount yada yada. The sigma side uses a combination of schedule data/subscription data to create unique journal entries related to accounts receivable and deferred revenue. Finally refund policy can be enforced programatically. They have typical monthly subscriptions as well. Rules are set around when the annual commitment monthly qualifies for refunds/how much depending on where they are in their schedule
It's an ugly use case to support. Schedule with 12 iterations was the best solution we could come up with.
Ahhhh ok. 12 iterations and then end_behavior=cancel. Gotcha. Ya, that's about the right way to do what you want to do there at this point.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
- Create new schedule with:
- Start date
now- schedule.default_settings.default_payment_method set to a payment method on the customer
Second bullet could also just be done using the Customer's invoice_settings.default_payment_method too.
- Get the invoice and finalize/pay it via the API
That's really all you need to do.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If you expand subscription.latest_invoice during the Create Subscription Schedule API call (i.e., step 1), you'll be able to get at the whole Invoice object at scheduleYouCreated.subscription.latest_invoice.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.