#theory_invoice-manual
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1253364110649987214
📝 Have more to share? Add details, code, screenshots, videos, etc. below.
Hm you shouldn't need to add a different price. When updating the quantity in the Update a subscription API call, you should be able to set the proration_behavior: https://docs.stripe.com/api/subscriptions/update#update_subscription-proration_behavior. I recommend playing around with things using test clocks: https://docs.stripe.com/billing/testing/test-clocks. That way you can still use your annual prices in test mode.
We don't use the Subscription API, though. Only the Invoice APIs.
(We have our own way of managing subscriptions, we just use Stripe for the invoice)
no worries!
Ok so do you want the user to be charged for the proration on their renewal date? Or do you want the proration to be billed immediately?
On their renewal date
Got it. For prorations, I would just create a separate invoice item for them. No need to create a new price object. You can just pass amount in: https://docs.stripe.com/api/invoiceitems/create#create_invoiceitem-amount. I think managing that many price objects would be kind of messy, and if I were you I'd only create prices objects for the actual items you're billing for and handle prorations with additional invoice items w/ amount
I see. So, for our prorated line items, we basically can't use price parameter, we need to use e.g. amount / description ?
You don't have to
You can use price if you want
I just recommend passing in amount so you don't have to manage all those prices
so like, if my price ID is price_foobar and it's configured as $100/year, what kind of API request would I construct to create a prorated invoice item?
if I do this API request, I'll get an error:
curl https://api.stripe.com/v1/invoiceitems \
-u sk_test_whatever \
-d invoice=in_xyz \
-d customer=cus_xyz \
-d price=price_foobar \
-d amount=5000 \
-d currency=usd
leads to
{
"error": {
"message": "You may only specify one of these parameters: amount, price.",
"param": "amount",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_xA0QmRqe3t9OU4?t=1718896883",
"type": "invalid_request_error"
}
}
I'd have to either:
(a) create a special price for $50, since that's the prorated amount in this example
(b) remove the price param and use the description param instead
Yeah you don't pass both amount and price
I'm suggesting doing this:
curl https://api.stripe.com/v1/invoiceitems
-u sk_test_whatever
-d invoice=in_xyz
-d customer=cus_xyz
-d amount=5000
-d currency=usd
Just for the prorated invoice item
Yeah that’s what I figured too. There’s not a way to link it back to the original Product / Price objects, so our data is messy.
Right, yeah. That gets our invoice to look correctly, but when the data syncs (e.g. to Salesforce or NetSuite) it'll be dirty
You could also use metadata
If you just need a field to record the price id: https://docs.stripe.com/api/invoiceitems/create#create_invoiceitem-metadata
theory_invoice-manual
Ok, yeah that's what I had thought too. Thanks, I think you answered all my questions.