Website: Update stripe webhook (#27241)

Changes:
- updated the stripe webhook to support `invoice.paid` events when a
subscription's host count is not increased.
This commit is contained in:
Eric 2025-03-18 13:09:21 -05:00 committed by GitHub
parent 02ee1f8372
commit ceec0e4cdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -177,6 +177,10 @@ module.exports = {
// e.g., 'Remaining time on 9 × Fleet premium hosts after 17 Feb 2024'
return _.startsWith(item.description, 'Remaining');
});
// If this no line item that starts with "Remaining" was found, select the first line item on the invoice.
if(!updatedSubscriptionInfo){
updatedSubscriptionInfo = itemsOnThisInvoice[0];
}
// Convert the subscription cycle's period end timestamp from Stripe into a JS timestamp.
// Note: with most subscription changes, this value will be indentical to the existing license key's expiration
// timestamp. We do this here to handle situations where the subscription period has been adjusted in the Stripe UI.