Skip to content

Database Schema ​

Native Payments Standard

Bridge Payments is built on the Native Payments standard - a comprehensive, production-ready database schema designed for modern payment systems created by the Pubflow Native Payments team. This schema supports multi-provider payments, subscriptions, organizations, guest checkout, and advanced features like coupons and analytics.

📚 Quick Navigation ​

Overview ​

The Native Payments schema is designed with these principles:

  • ✅ Multi-Provider Support - Works with Stripe, PayPal, Authorize.net, and more
  • ✅ Guest Checkout - Full support for anonymous and registered guests
  • ✅ Multi-Tenant - Organization support with role-based access
  • ✅ Soft Deletes - User data retention with GDPR compliance
  • ✅ Unified Pricing - Consistent pricing model across all entities
  • ✅ Extensible - JSON metadata fields for custom data
  • ✅ Performance - Comprehensive indexing strategy

Core Tables ​

users ​

The central table for all user information with comprehensive profile support.

Key Features:

  • Soft delete support with deleted_at and deletion_reason
  • Multiple contact methods (email, phone, mobile, recovery_email)
  • Profile information (display_name, bio, gender, dob, timezone)
  • Security features (2FA, account locking, email verification)
  • Language preferences and first-time user tracking

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
emailTEXTUnique email address (required)
user_typeTEXT'individual', 'business', 'admin'
nameTEXTFirst name (optional)
last_nameTEXTLast name (optional)
is_verifiedINTEGEREmail verification status (0/1)
phoneTEXTPrimary phone (unique)
mobileTEXTAlternative mobile number
recovery_emailTEXTRecovery email address
display_nameTEXTDisplay name for UI
bioTEXTUser biography (max 500 chars)
genderTEXTISO 5218: 'm', 'f', 'x'
dobTEXTDate of birth (YYYY-MM-DD)
tmzTEXTIANA timezone (e.g., America/New_York)
is_lockedINTEGERAccount lock status (0/1)
two_factorINTEGER2FA enabled status (0/1)
langTEXTLanguage preference ('en', 'es', 'ja')
first_timeINTEGERFirst-time user flag (0/1)
deleted_atTEXTSoft delete timestamp (NULL = active)
deletion_reasonTEXTReason for deletion
reference_idTEXTExternal reference ID
metadataTEXTJSON string for additional data
created_atTEXTCreation timestamp
updated_atTEXTLast update timestamp

Indexes:

  • Email, username, phone (for active users)
  • Soft delete status
  • Verification status
  • Security features (locked accounts, 2FA)
  • Temporal queries (created_at, updated_at)
View SQL Schema
sql
CREATE TABLE IF NOT EXISTS users (
    id TEXT PRIMARY KEY,
    name TEXT,
    last_name TEXT,
    email TEXT NOT NULL UNIQUE,
    user_type TEXT NOT NULL,
    picture TEXT,
    user_name TEXT UNIQUE,
    password_hash TEXT,
    is_verified INTEGER NOT NULL DEFAULT 0,
    phone TEXT UNIQUE,
    mobile TEXT,
    recovery_email TEXT,
    display_name TEXT,
    bio TEXT,
    gender TEXT,
    dob TEXT,
    tmz TEXT,
    is_locked INTEGER NOT NULL DEFAULT 0,
    two_factor INTEGER NOT NULL DEFAULT 0,
    lang TEXT NULL,
    first_time INTEGER NOT NULL DEFAULT 1,
    deleted_at TEXT NULL,
    deletion_reason TEXT NULL,
    reference_id TEXT,
    metadata TEXT,
    created_at TEXT NOT NULL DEFAULT (datetime('now')),
    updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);

tokens ​

Authentication and security tokens for magic links, password resets, and verification.

Key Features:

  • Support for email, phone, and username-based tokens
  • Attempt tracking with remaining attempts
  • Multiple token types (magic_link, password_reset, email_verification, phone_verification)
  • Status tracking (active, consumed, expired, revoked)
  • Optional context for two-factor validation

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
tokenTEXTHashed token (unique)
typeTEXT'email', 'phone', 'username'
identifier_valueTEXTThe actual identifier value
token_typeTEXT'magic_link', 'password_reset', etc.
user_idTEXTNULL for guest tokens
attempts_remainingINTEGERRemaining attempts (default: 1)
statusTEXT'active', 'consumed', 'expired', 'revoked'
expires_atTEXTExpiration timestamp
consumed_atTEXTWhen token was consumed
contextTEXTOptional context (e.g., username change)
metadataTEXTJSON string

Indexes:

  • Token lookup (token, status, expires_at)
  • Identifier lookup (type, identifier_value, status)
  • User tokens (user_id, token_type, status)
  • Expiration cleanup

organizations ​

Multi-tenant organization support for business accounts.

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
nameTEXTOrganization name (required)
owner_user_idTEXTOwner user ID (FK to users)
business_emailTEXTBusiness email address
business_phoneTEXTBusiness phone number
tax_idTEXTTax identification number
addressTEXTBusiness address
countryTEXTISO 2-letter country code
pictureTEXTOrganization logo URL

Related Table: organization_users

Links users to organizations with role-based access.

FieldTypeDescription
idTEXTPrimary key (UUID)
organization_idTEXTFK to organizations
user_idTEXTFK to users
roleTEXT'owner', 'admin', 'billing', 'member'

Payment Tables ​

payment_providers ​

Configuration for payment providers (Stripe, PayPal, Authorize.net, etc.).

Important Fields:

FieldTypeDescription
idTEXTProvider ID ('stripe', 'paypal', etc.)
display_nameTEXTHuman-readable name
descriptionTEXTProvider description
pictureTEXTProvider logo URL
is_activeINTEGERActive status (0/1)
supports_subscriptionsINTEGERSubscription support (0/1)
supports_saved_methodsINTEGERSaved payment methods support (0/1)
configTEXTJSON configuration

external_entities ​

Unified entity management for customers across providers with hierarchical relationships.

Key Features:

  • Supports both registered users and external guests
  • Context-based classification (payment, newsletter, events, etc.)
  • Payment provider customer ID mapping
  • Hierarchical entity relationships

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
user_idTEXTFK to users (NULL for guests)
organization_idTEXTFK to organizations
context_typeTEXT'payment', 'newsletter', 'events', etc.
context_idTEXTSpecific context identifier
payment_provider_idTEXTFK to payment_providers
payment_provider_customer_idTEXTExternal provider customer ID
provider_entity_idTEXTReference to another entity (hierarchy)
is_externalINTEGER1 for external, 0 for registered
external_emailTEXTGuest email
external_nameTEXTGuest name
external_phoneTEXTGuest phone
external_aliasTEXTGuest alias/nickname
metadataTEXTJSON string

Unique Constraints:

  • User + organization + provider + context (for registered users)
  • Email + organization + provider + context (for guests)

payment_methods ​

Saved payment methods for users, organizations, and guests.

Key Features:

  • Support for credit cards, bank accounts, PayPal, wallets (Apple Pay, Google Pay, Samsung Pay)
  • Guest payment method support
  • Default payment method tracking
  • Billing address linking

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
user_idTEXTFK to users
organization_idTEXTFK to organizations
provider_idTEXTFK to payment_providers (required)
provider_payment_method_idTEXTProvider's payment method ID
customer_idTEXTFK to external_entities
payment_typeTEXT'credit_card', 'bank_account', 'paypal', 'wallet'
wallet_typeTEXT'apple_pay', 'google_pay', 'samsung_pay'
last_fourTEXTLast 4 digits
expiry_monthTEXTCard expiration month
expiry_yearTEXTCard expiration year
card_brandTEXT'visa', 'mastercard', etc.
is_defaultINTEGERDefault payment method (0/1)
billing_address_idTEXTFK to addresses
aliasTEXTUser-friendly name
is_guestINTEGERGuest payment method (0/1)
guest_emailTEXTGuest email
guest_nameTEXTGuest name
metadataTEXTJSON string

addresses ​

Billing and shipping addresses for users, organizations, and guests.

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
user_idTEXTFK to users
organization_idTEXTFK to organizations
address_typeTEXT'billing', 'shipping', 'both'
is_defaultINTEGERDefault address (0/1)
nameTEXTRecipient name
line1TEXTAddress line 1 (required)
line2TEXTAddress line 2
cityTEXTCity (required)
stateTEXTState/Province
postal_codeTEXTPostal code (required)
countryTEXTISO 2-letter country code (required)
phoneTEXTContact phone
emailTEXTContact email
aliasTEXTUser-friendly name (e.g., "Home", "Office")
is_guestINTEGERGuest address (0/1)
guest_emailTEXTGuest email
guest_nameTEXTGuest name
metadataTEXTJSON string

payments ​

The core payments table with unified pricing system.

Key Features:

  • Unified pricing: total_cents = subtotal_cents + tax_cents - discount_cents
  • Support for order payments, subscription payments, and direct payments (donations)
  • Guest payment support
  • Manual/legacy payment support
  • Coupon tracking
  • Multiple payment statuses

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
order_idTEXTFK to orders (optional)
subscription_idTEXTFK to subscriptions (optional)
user_idTEXTFK to users (optional for guests)
organization_idTEXTFK to organizations
payment_method_idTEXTFK to payment_methods
provider_idTEXTFK to payment_providers
provider_payment_idTEXTFinal payment ID from provider
provider_intent_idTEXTIntent ID (e.g., Stripe payment intent)
client_secretTEXTClient secret for frontend confirmation
Pricing Fields
subtotal_centsINTEGERBase amount before taxes/discounts (required)
tax_centsINTEGERApplied taxes (default: 0)
discount_centsINTEGERApplied discounts (default: 0)
total_centsINTEGERFinal amount (required)
currencyTEXTCurrency code (default: 'USD')
Status & Tracking
statusTEXT'pending', 'requires_confirmation', 'requires_action', 'processing', 'succeeded', 'failed', 'refunded'
descriptionTEXTPayment description
error_messageTEXTError message if failed
conceptTEXTHuman-readable concept
reference_codeTEXTMachine-readable code for analytics
categoryTEXTHigh-level category
tagsTEXTComma-separated tags
Manual Payments
is_manual_paymentINTEGERManual/legacy payment flag (0/1)
manual_payment_methodTEXT'cash', 'check', 'bank_transfer', 'legacy_system'
manual_payment_referenceTEXTReference for manual payment
manual_payment_dateTEXTActual date of manual payment
Guest Support
is_guest_paymentINTEGERGuest payment flag (0/1)
guest_dataTEXTJSON string with guest info
guest_emailTEXTGuest email (indexed)
Coupons
applied_couponsTEXTJSON string of applied coupons
metadataTEXTJSON string
completed_atTEXTCompletion timestamp

Pricing Validation:

sql
CHECK (total_cents = subtotal_cents + tax_cents - discount_cents)

Business Rules:

  • Must belong to a user, organization, or be a guest payment
  • Can be linked to an order, subscription, or be standalone (donations)
  • Manual payments don't require provider_id

Product & Order Tables ​

products ​

Products and subscription plans with base pricing.

Key Features:

  • Support for physical, digital, service, and subscription products
  • Product variations (size, color, etc.)
  • Category hierarchy
  • Gallery images
  • Recurring billing configuration

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
nameTEXTProduct name (required)
descriptionTEXTProduct description
product_typeTEXT'physical', 'digital', 'service', 'subscription'
is_recurringINTEGERRecurring product flag (0/1)
subtotal_centsINTEGERBase price before tax (required)
currencyTEXTCurrency code (default: 'USD')
billing_intervalTEXT'monthly', 'yearly', null for one-time
trial_daysINTEGERTrial period days (default: 0)
imageTEXTMain product image URL
galleryTEXTJSON array of additional images
category_idTEXTFK to product_categories
parent_product_idTEXTFK to products (for variations)
variationsTEXTJSON array of variation options
metadataTEXTJSON string
is_activeINTEGERActive status (0/1)

Related Table: product_categories

Hierarchical product categories with parent-child relationships.

orders ​

Customer orders with unified pricing and guest support.

Key Features:

  • Anonymous guest order support
  • Unified pricing system
  • Billing and shipping addresses (JSON)
  • Order status tracking

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
order_numberTEXTHuman-readable order number (unique)
user_idTEXTFK to users
organization_idTEXTFK to organizations
customer_idTEXTFK to external_entities
is_guest_orderINTEGERAnonymous guest order flag (0/1)
guest_dataTEXTJSON string with guest info
guest_emailTEXTGuest email (indexed)
statusTEXT'pending', 'paid', 'cancelled', 'refunded'
subtotal_centsINTEGERBase amount (required)
tax_centsINTEGERApplied taxes (default: 0)
discount_centsINTEGERApplied discounts (default: 0)
total_centsINTEGERFinal amount (required)
currencyTEXTCurrency code (default: 'USD')
billing_addressTEXTJSON string
shipping_addressTEXTJSON string
metadataTEXTJSON string
completed_atTEXTCompletion timestamp

Related Table: order_items

Individual items within an order with quantity and pricing.

subscriptions ​

Recurring subscriptions with automatic billing and guest support.

Key Features:

  • Automatic billing with retry logic
  • Unified pricing system
  • Trial period support
  • Flexible billing intervals (daily, weekly, monthly, yearly)
  • Guest subscription support
  • Enhanced tracking (description, concept, reference_code, category, tags)

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
user_idTEXTFK to users
organization_idTEXTFK to organizations
customer_idTEXTFK to external_entities (required)
product_idTEXTFK to products (optional for custom)
payment_method_idTEXTFK to payment_methods
provider_idTEXTFK to payment_providers (required)
provider_subscription_idTEXTProvider's subscription ID
statusTEXT'active', 'cancelled', 'past_due', 'trialing', 'incomplete', 'incomplete_expired'
current_period_startTEXTCurrent billing period start
current_period_endTEXTCurrent billing period end
cancel_at_period_endINTEGERCancel at period end flag (0/1)
trial_endTEXTTrial end date
Pricing Fields
subtotal_centsINTEGERBase subscription price (required)
tax_centsINTEGERApplied taxes (default: 0)
discount_centsINTEGERApplied discounts (default: 0)
total_centsINTEGERFinal price (required)
currencyTEXTCurrency code (default: 'USD')
Billing Automation
billing_intervalTEXT'daily', 'weekly', 'monthly', 'yearly'
interval_multiplierINTEGERMultiplier (e.g., 2 for every 2 months)
next_billing_dateTEXTNext billing date (ISO 8601)
last_billing_attemptTEXTLast billing attempt (ISO 8601)
billing_retry_countINTEGERFailed billing attempts (default: 0)
max_retry_attemptsINTEGERMax retry attempts (default: 3)
billing_statusTEXT'active', 'past_due', 'suspended', 'cancelled'
Tracking Fields
descriptionTEXTHuman-readable description
conceptTEXTHuman-readable concept
reference_codeTEXTMachine-readable code
categoryTEXTHigh-level category
tagsTEXTComma-separated tags
Guest Support
is_guest_subscriptionINTEGERGuest subscription flag (0/1)
guest_dataTEXTJSON string with guest info
guest_emailTEXTGuest email (indexed)
metadataTEXTJSON string

Pricing Validation:

sql
CHECK (total_cents = subtotal_cents + tax_cents - discount_cents)

Billing Interval Validation:

sql
CHECK (billing_interval IN ('daily', 'weekly', 'monthly', 'yearly'))
CHECK (interval_multiplier IS NULL OR (interval_multiplier > 0 AND interval_multiplier <= 12))

invoices ​

Invoices for orders and subscriptions with payment link support.

Key Features:

  • Unified pricing system
  • Payment link generation
  • Guest invoice support
  • Coupon tracking
  • Multiple invoice statuses

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
invoice_numberTEXTHuman-readable invoice number (unique)
order_idTEXTFK to orders
subscription_idTEXTFK to subscriptions
payment_idTEXTFK to payments (updated after payment)
user_idTEXTFK to users
organization_idTEXTFK to organizations
customer_idTEXTFK to external_entities
statusTEXT'draft', 'open', 'paid', 'void', 'uncollectible'
subtotal_centsINTEGERBase amount (required)
tax_centsINTEGERApplied taxes (default: 0)
discount_centsINTEGERApplied discounts (default: 0)
total_centsINTEGERFinal amount (required)
currencyTEXTCurrency code (default: 'USD')
issue_dateTEXTInvoice issue date (required)
due_dateTEXTPayment due date (required)
paid_dateTEXTPayment completion date
is_guest_invoiceINTEGERGuest invoice flag (0/1)
guest_dataTEXTJSON string with guest info
guest_emailTEXTGuest email (indexed)
reference_codeTEXTReference code for payments
payment_link_urlTEXTUnique payment URL
payment_link_expires_atTEXTPayment link expiration
payment_method_idTEXTFK to payment_methods (after payment)
billing_addressTEXTJSON string
provider_idTEXTFK to payment_providers
provider_invoice_idTEXTProvider's invoice ID
invoice_urlTEXTFriendly invoice URL
applied_couponsTEXTJSON string of applied coupons
metadataTEXTJSON string

Advanced Features ​

discount_coupons ​

Flexible discount coupon system with advanced features.

Key Features:

  • Multiple discount types (percentage, fixed_amount, free_shipping, buy_x_get_y)
  • Usage limits (total and per customer)
  • Validity dates
  • Product/category restrictions
  • User type restrictions
  • Stackable coupons
  • Auto-apply support
  • Campaign tracking

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
codeTEXTUnique coupon code (e.g., "SUMMER2024")
nameTEXTFriendly name (required)
descriptionTEXTDetailed description
discount_typeTEXT'percentage', 'fixed_amount', 'free_shipping', 'buy_x_get_y'
discount_valueREALDiscount value (required)
currencyTEXTCurrency for fixed amounts (default: 'USD')
minimum_amount_centsINTEGERMinimum amount to apply (default: 0)
maximum_discount_centsINTEGERMaximum discount cap
usage_limitINTEGERTotal usage limit (NULL = unlimited)
usage_limit_per_customerINTEGERPer customer limit (NULL = unlimited)
current_usage_countINTEGERCurrent usage counter (default: 0)
starts_atTEXTStart date (NULL = immediate)
expires_atTEXTExpiration date (NULL = no expiration)
applicable_toTEXT'all', 'products', 'categories', 'subscriptions'
applicable_product_idsTEXTJSON string of product IDs
applicable_category_idsTEXTJSON string of category IDs
excluded_product_idsTEXTJSON string of excluded products
applicable_user_typesTEXTJSON string of user types
applicable_customer_segmentsTEXTJSON string of segments
first_time_customers_onlyINTEGERNew customers only flag (0/1)
is_activeINTEGERActive status (0/1)
is_stackableINTEGERCan combine with other coupons (0/1)
auto_applyINTEGERAuto-apply if conditions met (0/1)
campaign_idTEXTMarketing campaign ID
sourceTEXTCoupon source ('email', 'social', 'affiliate')
tagsTEXTComma-separated tags
buy_x_get_y_configTEXTJSON config for buy X get Y offers
tier_discountsTEXTJSON config for tiered discounts
metadataTEXTJSON string
created_byTEXTUser who created the coupon

Related Table: coupon_usage

Tracks every coupon usage with detailed information.

tax_rates ​

Optional dynamic tax calculation system.

Key Features:

  • Geographic-based tax rates (country, state, city, postal code)
  • Product/category-based applicability
  • Priority-based conflict resolution
  • Effective date ranges
  • Multiple tax types (percentage, fixed_amount)

Important Fields:

FieldTypeDescription
idTEXTPrimary key (UUID)
nameTEXTTax name (e.g., "Sales Tax", "IVA", "GST", "VAT")
descriptionTEXTDetailed description
rateREALTax rate (0.0360 = 3.6%)
typeTEXT'percentage', 'fixed_amount'
countryTEXTISO 2-letter country code
state_provinceTEXTState/Province code
cityTEXTCity name
postal_codeTEXTSpecific postal codes
applicable_categoriesTEXTJSON string of category IDs
applicable_product_typesTEXTJSON string of product types
excluded_categoriesTEXTJSON string of excluded categories
excluded_product_typesTEXTJSON string of excluded types
is_activeINTEGERActive status (0/1)
priorityINTEGERPriority (higher wins in conflicts)
effective_fromTEXTEffective start date
effective_untilTEXTEffective end date
metadataTEXTJSON string
created_byTEXTUser who created this rate

Analytics Tables ​

Optional analytics and reporting tables.

analytics_snapshots

  • Daily revenue snapshots
  • Active subscription counts
  • Metric tracking with breakdown
  • Calculation performance tracking

analytics_events

  • Detailed event tracking
  • Revenue attribution
  • Conversion tracking
  • User session tracking

user_cohorts

  • Cohort analysis support
  • First purchase tracking
  • First subscription tracking
  • Monthly cohort grouping

Indexes & Performance ​

The Native Payments schema includes comprehensive indexing for optimal performance:

User Indexes ​

  • Functional: email, username, phone (active users only)
  • Soft Delete: active/deleted status
  • Authentication: email + verification status
  • Security: locked accounts, 2FA enabled
  • Temporal: created_at, updated_at
  • Profile: mobile, recovery_email, display_name, gender, dob, timezone
  • Composite: user_type + is_verified, email + user_type

Payment Indexes ​

  • Guest Payments: guest_email + is_guest_payment + created_at
  • Status: payment status, subscription status
  • Provider: provider_intent_id
  • Tracking: reference_code, category, concept
  • Temporal: created_at for analytics

Subscription Indexes ​

  • Billing: next_billing_date + billing_status
  • Retry Logic: last_billing_attempt + billing_retry_count
  • Tracking: reference_code, category, concept
  • Guest: guest_email + is_guest_subscription

Coupon Indexes ​

  • Lookup: coupon code
  • Status: is_active, expires_at
  • Campaign: campaign_id
  • Usage: current_usage_count + usage_limit
  • Analytics: discount_amount_cents + currency

Performance Features ​

  1. Partial Indexes - Indexes only on active/relevant records
  2. Composite Indexes - Multi-column indexes for common query patterns
  3. Conditional Indexes - WHERE clauses to reduce index size
  4. Automatic Timestamps - Triggers for updated_at fields
  5. Foreign Key Constraints - Data integrity with CASCADE/SET NULL

Unified Pricing System ​

All monetary entities (payments, orders, subscriptions, invoices) use the same pricing model:

total_cents = subtotal_cents + tax_cents - discount_cents

Benefits:

  • ✅ Consistent pricing across all entities
  • ✅ Database-level validation with CHECK constraints
  • ✅ Easy to understand and maintain
  • ✅ Supports complex pricing scenarios
  • ✅ Audit-friendly with clear breakdown

Example:

json
{
  "subtotal_cents": 10000,  // $100.00
  "tax_cents": 850,          // $8.50 (8.5% tax)
  "discount_cents": 1000,    // $10.00 (coupon)
  "total_cents": 9850        // $98.50 final price
}

Guest Support ​

The schema provides comprehensive guest support across all entities:

Guest Checkout Flow:

  1. Create guest address (is_guest = 1)
  2. Create guest payment method (is_guest = 1)
  3. Create guest payment (is_guest_payment = 1)
  4. Optional: Convert guest to registered user

Guest Fields:

  • is_guest / is_guest_* - Boolean flag
  • guest_email - Indexed for quick lookup
  • guest_name - Guest name
  • guest_data - JSON with full guest information

Guest Conversion:

  • Link guest entities to new user account
  • Preserve payment history
  • Maintain address and payment method associations

Multi-Tenant Support ​

Organizations enable multi-tenant functionality:

Features:

  • Organization ownership (owner_user_id)
  • Role-based access (owner, admin, billing, member)
  • Organization-scoped payments and subscriptions
  • Shared payment methods and addresses
  • Business information (tax_id, business_email, business_phone)

Use Cases:

  • SaaS platforms with team accounts
  • Marketplace platforms
  • B2B payment processing
  • Enterprise billing

Best Practices ​

Data Retention ​

  • Use soft deletes for users (deleted_at, deletion_reason)
  • Keep payment history for compliance
  • Archive old analytics data periodically

Security ​

  • Hash all tokens before storage
  • Use HTTPS for all API communication
  • Implement rate limiting on token endpoints
  • Validate all pricing calculations

Performance ​

  • Use indexes for all foreign keys
  • Implement pagination for large result sets
  • Cache frequently accessed data
  • Monitor slow queries and add indexes as needed

Compliance ​

  • GDPR: Support data export and deletion
  • PCI DSS: Never store full card numbers
  • Tax compliance: Use tax_rates table for accurate calculations
  • Audit trails: Use payment_events for tracking

Next Steps ​