#sergx_docs

1 messages · Page 1 of 1 (latest)

pine juniperBOT
#

👋 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.

burnt bobcat
#
$user->subscription('default')->alwaysInvoice()->incrementQuantity($businessQuantity, $businessPriceId);
            if ($employeeQuantity > 0) {
                
$user->subscription('default')->alwaysInvoice()->incrementQuantity($employeeQuantity, $employeePriceId);    
            }
lilac tusk
#

Can you share the subscription ID (sub_xxx), so that I can take a look?

burnt bobcat
#

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

pine juniperBOT
neat spindle
#

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

burnt bobcat
#

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?

neat spindle
#
subscriptions.update('sub_xxx', {
  items: [{
    id: 'si_xxx',
    quantity: 3
  }, {
    id: 'si_yyy',
    quantity: 5
  }]
})
burnt bobcat
#

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?