Skip to content
APFerrer
M-BIL-01 · ModuleSoftware and SaaS

Stripe subscriptions integration with seats, free trial and an idempotent webhook

A recurring billing module on Stripe for applications with several customer companies: plans and billing periods, synced seats, free trial, card or SEPA, invoices with VAT and tax ID, plan changes, customer portal, lockout on non-payment and Stripe notifications processed only once.

Source codeEmbeddableOEM

Billing a B2B SaaS in Spain means invoicing with VAT and the customer's tax ID (NIF), accepting SEPA Direct Debit, keeping seats in line with real users and never processing the same payment notification twice. This Stripe subscription billing integration covers the whole cycle in applications with several customer companies, from sign-up with a free trial to lockout on non-payment.

Who it is for

B2B SaaS companies in Spain, product teams working with Next.js, integrators moving to subscriptions and startups with their first paid plan. The tax setup applies the standard Spanish VAT rate; other tax regimes need adapting (see the FAQ).

What a Stripe subscription billing integration solves

  • Invoices that are not valid in Spain. Every invoice carries VAT and the tax ID, and nothing is invoiced without a tax ID, address and email.
  • Seats that do not add up. Seats adjust on their own to active users, with proration.
  • Duplicate payment notifications. Each Stripe notification is processed once, even if it arrives more than once.

What it does

  • Offers three plan tiers, monthly or annual, with limits per plan (seats, active items and AI quotas), an optional flat-rate add-on and a billing exemption for internal accounts.
  • Creates subscriptions in two ways: by an operator, with a link sent by email, or by the customer, with trial days.
  • Collects the card or the SEPA mandate on Stripe's secure page and creates the subscription only with the saved payment method.
  • Applies the standard Spanish VAT rate and adds the customer's validated tax ID.
  • Handles changes of plan, billing period or add-on with proration, and checks that current usage fits in the new plan.
  • Gives access to the Stripe customer portal and to payment of outstanding invoices.
  • Keeps a single billing status (up to date, sign-up pending, unpaid, inactive or deactivated) and blocks access on non-payment.
  • Verifies the signature of every Stripe notification and processes the subscription and invoice ones.

Benefits

  • Your team does not have to design and test a delicate part of any SaaS.
  • You offer SEPA Direct Debit as well as card payments.

Industry context

General industry data with its public source. These are not results of this product.

What you get with each license

Price upon request, depending on license type and scope. Integration support and maintenance are contracted separately.

  • The module code, adapted to your customer and user models.
  • Integration examples and documentation.
  • A warranty against defects for the agreed period.

Technical specifications

Language and runtime: TypeScript 5.9 on Node.js. Minimum supported version: Node.js 20.19 (required by Prisma 7).

Frameworks: embeds in a Next.js 16 application with React 19 (delivered with Next.js 16.4 and React 19.2), with Prisma 7.10 as the ORM.

Database: PostgreSQL, the one your application uses.

Operating systems: Linux, Windows or macOS with Node.js.

Interface languages: Spanish (sign-up and payment screens, and emails).

Required infrastructure:

  • PostgreSQL.
  • A Stripe account with a secret key, a webhook secret and a price for each plan and billing period (requires your own account).
  • An SMTP server for the sign-up emails.

Private deployment: Needs a connection to Stripe, which processes the payments and issues the invoices.

Main libraries:

Library Version License
stripe 20.4.1 MIT
prisma and @prisma/client 7.10.1 Apache-2.0
@prisma/adapter-pg 7.10.1 Apache-2.0
pg 8.23.1 MIT
zod 4.6.7 MIT
nodemailer 10.3.1 MIT-0
next (provided by your application) 16.4.5 MIT

Dependencies with specific license terms:

  • elkjs 0.11 (transitive dependency of the Prisma CLI, for Prisma Studio): EPL-2.0.
  • Next.js, which your application provides, installs the libvips binaries @img/sharp-libvips-* 1.3 as an optional dependency: LGPL-3.0-or-later.

Compatibility and integrations: Stripe API 2026-02-25.clover (the one in the stripe 20.4.1 SDK), with Stripe Checkout, Billing, Customer Portal, Tax Rates and webhooks, and SEPA Direct Debit if it is enabled on your account.

Redistribution terms

The asset's own code can be embedded in the licensee's commercial products under the embeddable module, source code and OEM licenses, on the terms of the contract. Specific license terms apply to elkjs (EPL-2.0), which the Prisma CLI installs; Next.js, which your application provides, optionally installs the libvips binaries (LGPL-3.0-or-later). See the list under Technical specifications.

Installation requirements

A Next.js application with PostgreSQL and a Stripe account in your name, with a price for each plan and billing period. SEPA only shows up if it is enabled on your Stripe account.

FAQ

Frequently asked questions

  • Does it work for the Canary Islands or for customers in other EU countries?

    It applies the standard Spanish VAT rate. For IGIC (the Canary Islands indirect tax), IPSI (the indirect tax in Ceuta and Melilla) or the reverse charge, it has to be adapted or combined with Stripe Tax.

  • What happens if Stripe sends the same notification twice?

    It is processed once: a repeated notification does not duplicate charges, plan changes or lockouts.

  • Does it only work with Next.js?

    It is designed for Next.js applications. The billing logic can be moved to another Node.js application during the adaptation.

  • Is maintenance included?

    No. Maintenance (updates, including Stripe API updates, and bug fixes) and integration support are contracted separately.

Request

Request information on M-BIL-01

Fill in the form with the asset reference and the license type you're considering. I reply in writing. If you need to review code, tick the NDA box and we'll sign one before anything is shared.

Controller: APFerrer. Purpose: to answer your request. You can exercise your rights as described in the privacy policy.

Price upon request, depending on license type and scope. Maintenance and support are contracted separately.