Paddle Subscriptions SQL Template

SQL table creation template for syncing Paddle subscription data to your PostgreSQL database.

Updated: 14 Feb 2026

Paddle Subscriptions SQL Template

Create a database table to store Paddle subscription data including billing cycles, status, and customer associations.

What Data is Synced?

The Paddle Subscriptions sync captures subscription information from your Paddle account:

  • Subscription ID: Unique Paddle subscription identifier (e.g., sub_abc123)
  • Status: Subscription lifecycle status (active, canceled, past_due, paused, trialing)
  • Customer & Address: Associated customer and address IDs
  • Currency: Currency code for billing
  • Collection Mode: automatic or manual collection
  • Billing Cycle: Interval (day, week, month, year) and frequency
  • Period Dates: Current period start/end, next billing date
  • Lifecycle Dates: Started, first billed, paused, and canceled timestamps
  • Discount: Associated discount ID if applicable
  • Complete Data: Full Paddle subscription object stored as JSONB

SQL Table Template

Table Schema Explanation

Here's what each column in the table represents:

ColumnTypeDescription
idTEXTPaddle subscription ID (e.g., sub_abc123). Primary key.
statusTEXTSubscription status: active, canceled, past_due, paused, trialing.
customer_idTEXTAssociated Paddle customer ID.
address_idTEXTAssociated address ID.
currency_codeTEXTCurrency code for billing (e.g., USD, GBP).
collection_modeTEXTPayment collection mode: automatic or manual.
billing_cycle_intervalTEXTBilling interval: day, week, month, or year.
billing_cycle_frequencyINTEGERNumber of intervals between billings (e.g., 1 for monthly).
current_period_starts_atTIMESTAMPTZStart of current billing period.
current_period_ends_atTIMESTAMPTZEnd of current billing period.
next_billed_atTIMESTAMPTZNext billing date. Can be null for canceled subscriptions.
started_atTIMESTAMPTZWhen the subscription started.
first_billed_atTIMESTAMPTZDate of first billing. Can be null for trialing subscriptions.
paused_atTIMESTAMPTZWhen the subscription was paused. Null if not paused.
canceled_atTIMESTAMPTZWhen the subscription was canceled. Null if active.
discount_idTEXTAssociated discount ID. Null if no discount applied.
dataJSONBComplete Paddle subscription object stored as JSON.
livemodeBOOLEANWhether this is production data (true) or sandbox (false).
created_atTIMESTAMPTZTimestamp when subscription was created in Paddle.
updated_atTIMESTAMPTZTimestamp when subscription was last updated in Paddle.
synced_atTIMESTAMPTZTimestamp when CLS last synced this subscription record. Auto-updated.

Sync Mode

This template uses full sync only. Each sync fetches all subscription records from your Paddle account.

Usage Examples

After syncing, you can query your subscription data using standard SQL:

-- Get all active subscriptions
SELECT id, customer_id, currency_code, billing_cycle_interval
FROM paddle_subscriptions
WHERE status = 'active';

-- Find subscriptions expiring soon
SELECT id, customer_id, current_period_ends_at
FROM paddle_subscriptions
WHERE status = 'active'
  AND current_period_ends_at < NOW() + INTERVAL '7 days';

-- Count subscriptions by status
SELECT status, COUNT(*) as count
FROM paddle_subscriptions
GROUP BY status;

-- Get monthly vs yearly subscriptions
SELECT billing_cycle_interval, COUNT(*) as count
FROM paddle_subscriptions
WHERE status = 'active'
GROUP BY billing_cycle_interval;

-- Find subscriptions with discounts
SELECT id, customer_id, discount_id
FROM paddle_subscriptions
WHERE discount_id IS NOT NULL AND status = 'active';

-- Get recently canceled subscriptions
SELECT id, customer_id, canceled_at
FROM paddle_subscriptions
WHERE status = 'canceled'
  AND canceled_at > NOW() - INTERVAL '30 days'
ORDER BY canceled_at DESC;

Common Customizations

The template includes performance indexes for status, customer_id, currency_code, livemode, and created_at columns.

Add Index for Billing Period Queries

CREATE INDEX idx_paddle_subscriptions_next_billed
ON paddle_subscriptions(next_billed_at)
WHERE status = 'active';

Add Compound Index for Customer Lookups

CREATE INDEX idx_paddle_subscriptions_customer_status
ON paddle_subscriptions(customer_id, status);
  • Customers - Customer records linked to subscriptions
  • Transactions - Transaction/payment records
  • Prices - Pricing information for subscription items
  • Discounts - Discount codes applied to subscriptions