#sergx_code
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/1339567195427962915
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
$subscriptionItems = [
[
'price' => config('app.base_year_240'),
'quantity' => $businessCount,
],
[
'price' => config('app.addon_employees_year'),
'quantity' => $employeesCount,
]
];
try {
$invoicePreview = $this->stripe->invoices->upcoming([
'subscription' => $subscription->stripe_id,
'subscription_items' => $subscriptionItems,
]);
} catch (\Exception $e) {
$errorMessage = "Error al obtener la previsualización de la factura: " . $e->getMessage();
return dd($businessCount, $employeesCount, $errorMessage);
}
hi there!
when calling the upcoming subscription endpoint, make sure you delete the existing price, and add a new one. since you can't have both a monthly and a yearly price at the same time
you can use deleted for this: https://docs.stripe.com/api/invoices/upcoming#upcoming_invoice-subscription_items-deleted
I'm going to check it thank you!
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
thank you, already trying it!
worked thanks!
to update the subscription the logic would be the same? add 'deleted' to monthly items?
and then add new subscription items
you don't have to delete you can use the same subscription item ID
I understand, the only thing I have to do is to update the priceId right?
Anyways it would be valid to do the "deleted" thing right? I think for the business logic it could be easier to delete all items and add the new ones
yes it's would get you the same result
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!