← All schemas
Schema Library

Stripe Billing Database Schema Diagram

If you bill with Stripe, these are the tables behind the API. Customers own subscriptions and payment methods; subscriptions are composed of subscription items that reference prices; prices belong to products; invoices collect line items and link to payment intents. This diagram maps the full Stripe billing model as PostgreSQL tables — the shape you would build when syncing Stripe objects into your own database or designing a Stripe-like billing system from scratch.

Last updated: 2026-09-03

Tables
9
Core table
customers
Billing flow
Customer → Subscription → Invoice
Mini Map

Tables in the Stripe schema

ColumnTypeNullableKey
customers
idtextNoPK
emailvarcharYes-
namevarcharYes-
phonevarcharYes-
descriptiontextYes-
default_currencyvarchar(3)Yes-
balanceintegerNo-
metadatajsonbYes-
createdtimestamptzNo-
deleted_attimestamptzYes-
products
idtextNoPK
namevarcharNo-
descriptiontextYes-
activeboolNo-
typevarcharNo-
metadatajsonbYes-
createdtimestamptzNo-
updatedtimestamptzYes-
prices
idtextNoPK
product_idtextNo-
unit_amountintegerYes-
currencyvarchar(3)No-
billing_intervalvarcharYes-
interval_countintegerYes-
activeboolNo-
typevarcharNo-
createdtimestamptzNo-
subscriptions
idtextNoPK
customer_idtextNo-
statusvarcharNo-
collection_methodvarcharNo-
current_period_starttimestamptzNo-
current_period_endtimestamptzNo-
cancel_at_period_endboolNo-
canceled_attimestamptzYes-
trial_starttimestamptzYes-
trial_endtimestamptzYes-
default_payment_method_idtextYes-
metadatajsonbYes-
createdtimestamptzNo-
subscription_items
idtextNoPK
subscription_idtextNo-
price_idtextNo-
quantityintegerNo-
createdtimestamptzNo-
invoices
idtextNoPK
customer_idtextNo-
subscription_idtextYes-
statusvarcharNo-
amount_dueintegerNo-
amount_paidintegerNo-
currencyvarchar(3)No-
attempt_countintegerNo-
due_datetimestamptzYes-
paid_attimestamptzYes-
hosted_invoice_urltextYes-
createdtimestamptzNo-
invoice_line_items
idtextNoPK
invoice_idtextNo-
price_idtextYes-
amountintegerNo-
currencyvarchar(3)No-
descriptiontextYes-
quantityintegerNo-
period_starttimestamptzYes-
period_endtimestamptzYes-
payment_methods
idtextNoPK
customer_idtextNo-
typevarcharNo-
card_brandvarcharYes-
card_last4varchar(4)Yes-
card_exp_monthsmallintYes-
card_exp_yearsmallintYes-
billing_countryvarchar(2)Yes-
createdtimestamptzNo-
payment_intents
idtextNoPK
customer_idtextYes-
invoice_idtextYes-
amountintegerNo-
currencyvarchar(3)No-
statusvarcharNo-
payment_method_idtextYes-
client_secrettextYes-
createdtimestamptzNo-

Frequently asked questions

What tables does a Stripe billing schema need?

A Stripe-like billing schema needs customers, products, prices, subscriptions, subscription_items, invoices, invoice_line_items, payment_methods, and payment_intents — 9 tables covering the full subscription and payment lifecycle.

How do Stripe subscriptions relate to invoices and payments?

A customer has many subscriptions. Each subscription has many subscription_items (one per price). When a billing period ends, Stripe generates an invoice with line items; each invoice can have a payment_intent that charges the customer's default payment_method.

Visualize your own database

Paste your PostgreSQL connection string and get an interactive ER diagram of your own schema in under 10 seconds. No signup required.

Try it free →