
Security News
Frontier AI Is Now Critical Infrastructure
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.
stripe-next
Advanced tools
stripe-next is designed to simplify the integration of Stripe into your Next.js application.
This package is currently intended to facilitate recurring subscriptions and provides essential components and utilities to streamline subscription management, billing portal access, and Stripe API interactions.
This library has been tested with Next.js version 14.2
npm install stripe-next
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=""
STRIPE_SECRET_KEY=""
STRIPE_WEBHOOK_SECRET=""
// /stripe-config.ts
import { StripeNext } from "stripe-next";
const { handlers, BillingPortalButton, SubscribeModal } = StripeNext({
apiBaseUrl: "/api/custom/path", // optional - default is /api/stripe
productFilter: "pro", // optional - filter products returned by the subscribe modal
getCurrentCustomerId: async (): Promise<string> => {
// optional - return the current customer id
return "cus_abc";
},
getCurrentUser: async (): Promise<{ id: string; email: string }> => {
// optional - return the current user details
return { id: "user_123", email: "test@test.com" };
},
onSubscriptionCreated: async (
clientId: string,
subscription: Stripe.Subscription,
): Promise<void> => {
// required - add the subscription record to your database
},
onSubscriptionDeleted: async (
subscription: Stripe.Subscription,
): Promise<void> => {
// required - update the subscription record in your database
},
onSubscriptionUpdated: async (
subscription: Stripe.Subscription,
): Promise<void> => {
// required - update the subscription record in your database
},
});
Use the BillingPortalButton returned by StripeNext to access the Stripe billing portal:
import { BillingPortalButton } from "stripe-config";
export default function BillingPortalPage() {
return <BillingPortalButton />;
}
Display a subscription modal to manage user subscriptions:
import { useState } from "react";
import { SubscribeModal } from "stripe-config";
export default function SubscribePage() {
const [showSubscribeModal, setShowSubscribeModal] = useState(false);
return (
<SubscribeModal
open={showSubscribeModal} // Set to true to display the modal
handleClose={() => setShowSubscribeModal(false)}
title="Subscribe"
/>
);
}
Integrate Stripe route handlers to manage server-side functionality:
// app/api/stripe/[...actions]/route.ts
import { handlers } from "stripe-config";
export const { GET, POST } = handlers;
FAQs
## About
We found that stripe-next demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.