From ccf3b38b06ee07a1d6e2c69d415ec532590d70fa Mon Sep 17 00:00:00 2001 From: gbuomprisco Date: Fri, 21 Jun 2024 13:04:23 +0800 Subject: [PATCH] Refactor stripe subscription retrieval process The process of retrieving stripe subscriptions has been updated in the 'stripe-webhook-handler.service.ts' file. Instead of expanding to 'line_items', the process now retrieves just the subscription and proceeds to build the payload. The refactor aims to improve the performance and simplicity of the subscription retrieval process. --- .../stripe/src/services/stripe-webhook-handler.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/billing/stripe/src/services/stripe-webhook-handler.service.ts b/packages/billing/stripe/src/services/stripe-webhook-handler.service.ts index e414ffd39..11c2883b9 100644 --- a/packages/billing/stripe/src/services/stripe-webhook-handler.service.ts +++ b/packages/billing/stripe/src/services/stripe-webhook-handler.service.ts @@ -303,10 +303,10 @@ export class StripeWebhookHandlerService const invoice = event.data.object; const subscriptionId = invoice.subscription as string; - const subscription = await stripe.subscriptions.retrieve(subscriptionId, { - expand: ['line_items'], - }); + // Retrieve the subscription + const subscription = await stripe.subscriptions.retrieve(subscriptionId); + // Here we need to retrieve the subscription and build the payload const accountId = subscription.metadata.accountId as string; const subscriptionPayloadBuilderService =