#sergx_docs
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/1235500086696476713
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
$user->subscription('default')->alwaysInvoice()->incrementQuantity($businessQuantity, $businessPriceId);
if ($employeeQuantity > 0) {
$user->subscription('default')->alwaysInvoice()->incrementQuantity($employeeQuantity, $employeePriceId);
}
Can you share the subscription ID (sub_xxx), so that I can take a look?
Of course! Also happened that one time updating the quantities provoked a negative invoice, and gave the customer some credit balance charging 0€ due to prorations.
Here it is: sub_1PBu1tKYINwhn6n4Mv2mTXrB
Events when happened the prorations stuff:
evt_1PBuDgKYINwhn6n4nLqPJO67
evt_1PBuDgKYINwhn6n4RphrZcQ1
evt_1PBuDgKYINwhn6n4Pm0Q7SgU
Would it be possible to update those quantities at the same time, and then, generate a single invoice for that?
Should be yes, assuming they're separate items on a single subscription
Yes they are! It's a subscription with multiple products with their priceIds
And using API how could I update this subscription with multiple products quantities?
subscriptions.update('sub_xxx', {
items: [{
id: 'si_xxx',
quantity: 3
}, {
id: 'si_yyy',
quantity: 5
}]
})
perfect thank you so much, I'm going to try it
A doubt I have, if for example when updating subscription I want to allow users to introduce a coupon discount.
To generate correctly the invoice, that coupon should be applied before updating the subscription, during the update, or it doesn't matter at all?