Update stripe 18.2.1 → 22.6.1
Why this issue exists
The declared version 18.2.1 is outdated. The target version 22.6.1 is available and the current call sites remain compatible with the new version. No API changes are required based on the provided documentation and usage snippets.
Mantle analyzed this repository's language, imports, and SDK call sites, compared them to the latest official documentation, and wrote this issue so you (or your coding agent) can apply the update. Mantle does not open a pull request or edit your default branch.
Library
| Package | stripe |
| Declared in manifest | 18.2.1 (exact) |
| Current version | 18.2.1 |
| Recommended version | 22.6.1 |
| Finding | OUTDATED_DEPENDENCY (medium) |
| Official docs | https://docs.stripe.com/sdks/node |
| Source SHA analyzed | 6aad2edd0678d7f1138fedc5cc7a64c61a29fe0e |
| Plan produced by | deepseek-ai/DeepSeek-V4-Flash |
Where it is used
packages/server/lib/services/planChange.service.tsline 9:stripepackages/server/lib/controllers/v1/stripe/postWebhooks.tsline 11:stripepackages/server/lib/controllers/v1/plans/change/postChange.tsline 22:stripepackages/billing/lib/stripe.tsline 1:stripe
Manifest change
packages/billing/package.json:18.2.1→22.6.1
What to change in source
Call sites match the latest official docs. Update the package pin only.
Current call-site context
packages/billing/lib/stripe.ts
import Stripe from 'stripe';
import { envs } from './envs.js';
export function getStripe() {
return new Stripe(envs.STRIPE_SECRET_KEY!, {
apiVersion: '2025-05-28.basil',
typescript: true,
telemetry: false
});
}
packages/server/lib/controllers/v1/plans/change/postChange.ts
import { z } from 'zod';
import { billing } from '@nangohq/billing';
import { plansList } from '@nangohq/shared';
import { getLogger, report, requireEmptyQuery, zodErrorToHTTP } from '@nangohq/utils';
import {
disableGrowthAddon,
downgradePlan,
enableGrowthAddon,
getPlanChangeContext,
resolvePlanChange,
trackPlanChange,
upgradePlan
} from '../../../../services/planChange.service.js';
import { asyncWrapper } from '../../../../utils/asyncWrapper.js';
import type { PlanChangeContext, PlanChangeError, PlanChanges } from '../../../../services/planChange.service.js';
import type { RequestLocals } from '../../../../utils/express.js';
import type { BillingSubscription, PostPlanChange } from '@nangohq/types';
import type { Response } from 'express';
import type Stripe from 'stripe';
const logger = getLogger('Server.PostChange');
type PlanChangeResponse = Response<PostPlanChange['Reply'], RequestLocals>;
function logContext(context: PlanChangeContext, subscription: BillingSubscription, changes: PlanChanges) {
return {
accountId: context.team.id,
currentPlan: context.currentPlan.name,
requestedPlan: context.requested.newPlanCode,
packages/server/lib/controllers/v1/stripe/postWebhooks.ts
import { billing, getStripe } from '@nangohq/billing';
import db from '@nangohq/database';
import { accountService, getPlan, updatePlan } from '@nangohq/shared';
import { Err, getLogger, Ok, report } from '@nangohq/utils';
import { envs } from '../../../env.js';
import { applyPendingPlanChange } from '../../../services/planChange.service.js';
import { asyncWrapper } from '../../../utils/asyncWrapper.js';
import type { PostStripeWebhooks, Result } from '@nangohq/types';
import type Stripe from 'stripe';
const logger = getLogger('Server.Stripe');
/**
* Stripe is sending webhook on checkout and subscription created.
* Without this we can't link a payment to an account in our backend
*
* Forward locally with:
* stripe listen --load-from-webhooks-api --forward-to localhost:3003
*/
export const postStripeWebhooks = asyncWrapper<PostStripeWebhooks>(async (req, res) => {
if (!envs.STRIPE_SECRET_KEY || !envs.STRIPE_WEBHOOKS_SECRET) {
res.status(403).send({ error: { code: 'feature_disabled', message: 'feature disabled' } });
return;
}
const sig = req.headers['stripe-signature'];
if (!sig || typeof sig !== 'string') {
report(new Error('[strippackages/server/lib/services/planChange.service.ts
import { billing, getStripe } from '@nangohq/billing';
import db from '@nangohq/database';
import { canHaveGrowthAddon, getPlanDefinition, handlePlanChanged, productTracking, setGrowthAddon } from '@nangohq/shared';
import { Err, getLogger, Ok } from '@nangohq/utils';
import { clearSpendAlertOnPlanChange } from './spendAlertNotification.service.js';
import type { BillingSubscription, DBPlan, DBTeam, PlanDefinition, Result } from '@nangohq/types';
import type Stripe from 'stripe';
const logger = getLogger('Server.PlanChange');
export interface PlanUpgradeResult {
paymentIntent?: Stripe.PaymentIntent | undefined;
paymentMode: 'in-arrears' | 'some-up-front';
}
export interface PlanChangeContext {
team: DBTeam;
currentPlan: DBPlan;
currentPlanDefinition: PlanDefinition;
subscriptionId: string;
requested: {
/** Orb external plan id. */
newPlanCode: string;
/** Whether growth features should be enabled. */
withGrowthFeatures: boolean;
};
}
export type PlanChange = 'upgrade' | 'downgrade';
export type AddonChange = 'enable' | 'disable';
export interface PlanChanges {
plan: PlanChange | null;
addon: AddonChange Breaking / deprecated APIs
- None listed in official docs for these call sites.
How to verify
- Run
npm testto ensure all tests pass. - Run
npm run buildto confirm no compilation errors. - Manually verify that Stripe API calls (e.g., webhook handling, plan changes) still work as expected in a staging environment.
Documentation sources (cached)
Fetched and cached official / source-repo documentation for this run.
- https://docs.stripe.com/changelog
- https://github.com/stripe/stripe-node
- https://raw.githubusercontent.com/stripe/stripe-node/HEAD/README.md
- https://raw.githubusercontent.com/stripe/stripe-node/HEAD/CHANGELOG.md
Generated by Mantle. Implement this issue with your preferred coding agent.
Do not paste secrets from .env into comments.
Source: NangoHQ/nango