Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix: report declined fast-track and upgrade charges instead of success

Gilad Resisi3adec5ef5be0
diff --git a/libraries/nestjs-libraries/src/services/stripe.service.ts b/libraries/nestjs-libraries/src/services/stripe.service.ts
index 19786b5d3..c3515dc89 100644
--- a/libraries/nestjs-libraries/src/services/stripe.service.ts
+++ b/libraries/nestjs-libraries/src/services/stripe.service.ts
@@ -869,6 +869,15 @@ export class StripeService extends PaymentProviderAbstract {
};
}
+ // The update itself succeeds on a declined card, the subscription just
+ // moves to past_due, so the failure is only visible here
+ if (
+ invoice?.status === 'open' &&
+ paymentIntent?.status === 'requires_payment_method'
+ ) {
+ throw new Error('The subscription payment failed');
+ }
+
return { requiresAction: false };
}