Next.js 16 Paid AI App Bundle: Stripe, Resend, AI Billing

    1

    This bundle contains two skills: nextjs-netlify-stripe-resend (base) and ai-usage-billing (add-on).

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Next.js 16 Paid AI App Bundle: Stripe, Resend, AI Billing

    Example session with this skill installed

    Add prepaid AI token billing to my Next.js Netlify app. I want to sell $10 credit packs and charge for gpt-4o usage without using a database.

    • Read your context and instructions
    • Compiled the next js 16

    I have integrated the AI usage billing system into your Next.js 16 application. The setup uses Stripe Customer Balance as a ledger to track credits, removing the need for an external database.

    AI Usage Billing Implementation

    ComponentStatusImplementation Detail
    Base StackInstalledNetlify + Resend + Stripe Webhook
    MeteringConfiguredlib/pricing.js set for gpt-4o per-token rates
    Credit PacksReadyStripe Price price_1Qxyz... ($10.00 pack)
    GatekeeperActivelib/caps.js enforcing DAILY_CAP_CENTS
    Chat RouteDeployed/api/chat with runMeteredChat

    Environment Variables Required

    STRIPE_SECRET_KEY=sk_test_...
    STRIPE_WEBHOOK_SECRET=whsec_...
    RESEND_API_KEY=re_...
    STRIPE_PRICE_CREDITS_10=price_...
    SIGNING_SECRET=your_hmac_secret
    OPENAI_API_KEY=sk-proj-...
    

    LLM Pricing Config (lib/pricing.js)

    export const MODEL_PRICES = {
      'gpt-4o': {
        prompt: 250, // cents per 1M tokens
        completion: 1000,
      }
    };
    export const MARKUP_BP = 2000; // 20% margin
    

    Next steps

    1. Create a One-time Price in the Stripe Dashboard for the $10 credit pack and update STRIPE_PRICE_CREDITS_10.
    2. Configure your Stripe Webhook to listen for checkout.session.completed events pointing to /api/stripe-webhook.
    3. Verify the Resend sender domain to allow transactional balance alerts to reach users.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    This bundle contains two skills: nextjs-netlify-stripe-resend (base) and ai-usage-billing (add-on). The bundle's SKILL.md tells your agent to complete the base workflow first, then the billing add-on.

    Base: paid Next.js 16 app on Netlify Free (Stripe + Resend)

    Most agents can write a Stripe checkout. Getting a small paid product working end to end on Netlify's free plan is where they trip: webhook signatures that fail because the body was parsed, access granted from the success URL, duplicate receipt emails on Stripe retries, Next 16 build errors, cron jobs that never fire on previews.

    • Stripe Checkout for one-time payments, with Stripe promotion codes
    • A webhook handler that verifies signatures on the raw body and fulfils idempotently
    • Stripe Customer records used as the store, so there's no database to run (with the limits written down, and a clear "don't use this when..." section)
    • Resend transactional email from your own domain, with idempotency keys
    • HMAC-signed access links and email cookies
    • A Netlify scheduled function guarded by a cron secret
    • Next.js 16 notes that matter here: async request APIs, proxy, Turbopack, and the Cache Components runtime build error

    Add-on: AI usage billing

    Adding AI to a paid app is easy. Making sure each user pays for what they use is harder. Agents often meter in the browser, bill from character counts, check the balance after the call, or credit a top-up twice when Stripe retries a webhook.

    • One server route for every model call. It checks credits and caps, limits max_completion_tokens to what the user can pay, calls the model, then debits the token usage the provider reports.
    • Prepaid credit packs sold with Stripe Checkout. Credits are stored on the Stripe customer invoice balance, which is an append-only ledger, so there's no database to run.
    • Idempotent top-ups and debits, using Stripe idempotency keys plus a ledger check that covers the full webhook retry window.
    • Spend caps: a global kill switch, a balance gate, a per-user daily cap (users can lower their own), and an output-token cap per request.
    • An optional postpaid mode that sends usage to Stripe Billing Meters, with retry on 429. It also covers metered prices, usage alerts and credit grants.
    • An accurate status note for Stripe's "Bill for LLM tokens" (Metronome), as of the check date. Stripe's docs call it public preview, while the token-meter and AI SDK packages say private preview.
    • Notes for Netlify AI Gateway and Next.js after().

    The no-database design has a cost, and the skill says what it is: parallel requests can overspend by up to about one request's maximum cost each. The skill clamps that overspend and records it, and tells you when to move to a real store.

    Why a subscription

    Next.js, Netlify, Stripe and Resend change often. Each week the skill is re-checked against their changelogs and re-validated by building a fresh app. Every update ships with release notes.

    What's included

    • Top-level SKILL.md that routes to the base workflow, then the add-on
    • base/: SKILL.md workflow (9 steps); 10 reference files (Netlify, Next 16, Stripe, Resend, signed links, cron, pitfalls, testing, go-live, sources); 10 example files (4 route handlers, 4 lib modules, netlify.toml, the scheduled function) plus an env template; scripts/check-signatures.mjs (12 offline checks); CHANGELOG.md and VERSION.md
    • ai-usage-billing/: SKILL.md workflow (10 steps) with a "choose your billing model" table and hard rules; 10 reference files (metering, credits, caps, metered billing, token billing status, Netlify AI notes, pitfalls (18), testing, go-live, sources); 12 lib modules (2 copied from the base skill), 3 route handlers, a webhook handler to merge in, and an env template; 24 offline unit tests (node --test) with an in-memory Stripe fake and a mocked LLM, plus scripts/check-billing.mjs; CHANGELOG.md and VERSION.md

    Tested with

    Base: validated by building a fresh create-next-app project (Next 16.4.2). Add-on: a fresh create-next-app project (Next.js 16.4.2, Cache Components on); npm test passed 24/24, npm run build passed, ESLint was clean, and local next start route checks passed. Not yet tested against a live Stripe payment, a live Resend send, real meter events, a real LLM call, streaming responses or a Netlify deploy.

    Works with

    Claude Code, Cursor, Codex (SKILL.md standard). Only the build and tests were run, not each agent.

    Honest limits

    • Base: One-time payments only, no subscriptions or seats. It won't create your Stripe, Resend or Netlify accounts and won't deploy for you. The no-database pattern fits small products, not apps that need queries. Netlify, Stripe and Resend publish free official skills for their own platforms, so use those for broad platform questions. This skill covers how the three fit together in one paid app.
    • Add-on: Model prices are placeholders, and your agent fills them in from your provider's pricing page. Streaming is described but not shipped. It has no team wallets, and it doesn't integrate Metronome. Stripe's and Netlify's free official skills cover their own platforms in more depth. This skill covers how the pieces fit together for usage billing.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.

    Not for high-concurrency team wallets. Credits are restricted to your product. Overspend is bounded but possible during parallel requests. Requires Next.js 16.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 22 days ago

    Accounts
    StripeResendOpenAI
    Software
    Node.jseslintcreate-next-app@netlify/skills@next/codemod

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables
    Network Access

    Allowed Hosts

    docs.stripe.com
    api.stripe.com
    resend.com
    api.resend.com
    registry.npmjs.org
    api.openai.com
    Listed26 days ago
    Updated22 days ago

    What's inside

    Frequently Asked Questions

    Credits live on the Stripe customer's invoice balance, which acts as an append-only ledger, so no database is needed. Top-ups and debits use Stripe idempotency keys plus a ledger check. Access links are HMAC-signed. The no-database design fits small products; parallel requests can overspend by about one request's maximum cost each, and the skill clamps and records that.

    The add-on's example route calls OpenAI (api.openai.com) and was only tested with a mocked LLM. Other providers need adapting: your agent fills in model prices from your provider's pricing page. Streaming is described but not shipped.

    It is built and tested for Next.js 16 (App Router) on Netlify's Free plan with Stripe and Resend. Other hosts or frameworks are not covered or tested; you would need to adapt the deployment configuration yourself.

    The download is a SKILL.md bundle (41 files) with three skills: nextjs-paid-ai-app-bundle (router), nextjs-netlify-stripe-resend (base) and ai-usage-billing (add-on). It includes workflows, reference docs, example route handlers and lib modules, offline checks and unit tests. It is not a ready-made app scaffold; your agent applies it to your Next.js project.

    The skill adds a global kill switch, a balance gate, a per-user daily cap and an output-token cap per request, checked before each model call. Without a database, parallel requests can still overspend by up to about one request's maximum cost each; the skill clamps and records that overspend and says when to move to a real store.

    Updates for compatibility with new Next.js or Stripe API versions are delivered through the marketplace dashboard; however, customized implementations will require manual merging of new library logic.

    New in APIs & Backend