diff --git a/src/credits/credits.ts b/src/credits/credits.ts index 00be186..8edd58f 100644 --- a/src/credits/credits.ts +++ b/src/credits/credits.ts @@ -458,10 +458,7 @@ export async function addMonthlyFreeCredits(userId: string) { * @param userId - User ID * @param priceId - Price ID */ -export async function addSubscriptionRenewalCredits( - userId: string, - priceId: string -) { +export async function addSubscriptionCredits(userId: string, priceId: string) { const pricePlan = findPlanByPriceId(priceId); if ( !pricePlan || diff --git a/src/payment/provider/stripe.ts b/src/payment/provider/stripe.ts index c917527..2e9fcad 100644 --- a/src/payment/provider/stripe.ts +++ b/src/payment/provider/stripe.ts @@ -3,7 +3,7 @@ import { websiteConfig } from '@/config/website'; import { addCredits, addLifetimeMonthlyCredits, - addSubscriptionRenewalCredits, + addSubscriptionCredits, } from '@/credits/credits'; import { getCreditPackageById } from '@/credits/server'; import { CREDIT_TRANSACTION_TYPE } from '@/credits/types'; @@ -595,7 +595,7 @@ export class StripeProvider implements PaymentProvider { // Add subscription renewal credits if plan config enables credits const pricePlan = findPlanByPriceId(priceId); if (pricePlan?.credits?.enable) { - await addSubscriptionRenewalCredits(userId, priceId); + await addSubscriptionCredits(userId, priceId); } } } @@ -681,10 +681,7 @@ export class StripeProvider implements PaymentProvider { // Add credits for subscription renewal if (isRenewal && currentPayment[0].userId) { try { - await addSubscriptionRenewalCredits( - currentPayment[0].userId, - priceId - ); + await addSubscriptionCredits(currentPayment[0].userId, priceId); console.log( `<< Added renewal credits for user ${currentPayment[0].userId}, priceId: ${priceId}` );