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.
This commit is contained in:
gbuomprisco
2024-06-21 13:04:23 +08:00
parent b3d938144f
commit ccf3b38b06

View File

@@ -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 =