Add handling for paid invoices in billing services

In response to paid invoices, a new callback method has been introduced in the billing services. This feature includes changes in billing-webhook-handler.service.ts, lemon-squeezy-webhook-handler.service.ts, and other related files. The new method fetches and handles paid invoice information from Stripe and LemonSqueezy subscriptions.
This commit is contained in:
gbuomprisco
2024-06-20 00:02:25 +08:00
parent 73c721557f
commit 95fa8fb7c6
5 changed files with 205 additions and 5 deletions

View File

@@ -42,6 +42,12 @@ export abstract class BillingWebhookHandlerService {
// one-time payments
onPaymentFailed: (sessionId: string) => Promise<unknown>;
// this method is called when an invoice is paid. We don't have a specific use case for this
// but it's extremely common for credit-based systems
onInvoicePaid: (
subscription: UpsertSubscriptionParams,
) => Promise<unknown>;
// generic handler for any event
onEvent?: (data: unknown) => Promise<unknown>;
},