#klavik-subs
1 messages · Page 1 of 1 (latest)
hi, what exact code did you use?
also share the request ID req_xxx (https://support.stripe.com/questions/finding-the-id-for-an-api-request) if possible
Stripe::Subscription.update(
current_stipe_subscription.id,
{
add_invoice_items: [
{
price: "price_1LSgPqJxFhjLfjdl3BfwKZ1H",
quantity: 1
},
{
price: "price_1LSgQPJxFhjLfjdly4X5UKO5",
quantity: 1
}
]
}
)
the code executed was that
and the ID of the request is : req_BtrXM7FTQHPUGD
you'd use items not add_invoice_items if you want to add a new recurring price
add_invoice_items is to add one-off amounts to be included in the next invoice(only accepts a one time Price), items are the actual recurring subscription line items for each billing period(only accepts recurring Prices)
aah okay, got you. Will that add a recurring price to the invoice as an additional one, or will it replace the current one?
it would add a new one
you can replace the olde one by specifying the ID though
https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#changing note how it uses 'id': subscription['items']['data'][0].id, , that can be super important
okay just tested, it will just add them as extra lines, yes. Thank you for the help
Last question for now though, will it automatically generate a new invoice as well with prorations for the added items? or would that require another API call to generate the invoice?
depends on what value you pass for proration_behavior on the call
for the Subscription.update request?
yep. Make sure to the read the docs, the page I linked links to a detailed page on proration and the API reference