Paddle Adjustments SQL Template
SQL table creation template for syncing Paddle adjustment data (refunds, credits, chargebacks) to your PostgreSQL database.
Updated: 14 Feb 2026
Paddle Adjustments SQL Template
Create a database table to store Paddle adjustment data including refunds, credits, and chargebacks.
What Data is Synced?
The Paddle Adjustments sync captures adjustment information from your Paddle account:
- Adjustment ID: Unique Paddle adjustment identifier (e.g.,
adj_abc123) - Action: Type of adjustment action (refund, credit, chargeback, chargeback_warning, chargeback_reverse)
- Status: Adjustment status (pending_approval, approved, rejected, reversed)
- Type: Full or partial adjustment
- Transaction & Subscription: Associated transaction and subscription IDs
- Customer: Associated customer ID
- Reason: Reason for the adjustment
- Currency & Total: Currency code and total amount
- Credit Applied: Whether credit was applied to balance
- Complete Data: Full Paddle adjustment object stored as JSONB
SQL Table Template
Table Schema Explanation
Here's what each column in the table represents:
| Column | Type | Description |
|---|---|---|
id | TEXT | Paddle adjustment ID (e.g., adj_abc123). Primary key. |
action | TEXT | Adjustment action: refund, credit, chargeback, chargeback_warning, chargeback_reverse. |
status | TEXT | Adjustment status: pending_approval, approved, rejected, reversed. |
type | TEXT | Adjustment type: full or partial. |
transaction_id | TEXT | Associated transaction ID. |
subscription_id | TEXT | Associated subscription ID. Null if not subscription-related. |
customer_id | TEXT | Associated customer ID. |
reason | TEXT | Reason for the adjustment. |
currency_code | TEXT | Currency code (e.g., USD, GBP). |
total | TEXT | Total adjustment amount (stored as text for precision). |
credit_applied_to_balance | BOOLEAN | Whether credit was applied to customer balance. |
data | JSONB | Complete Paddle adjustment object stored as JSON. |
livemode | BOOLEAN | Whether this is production data (true) or sandbox (false). |
created_at | TIMESTAMPTZ | Timestamp when adjustment was created in Paddle. |
updated_at | TIMESTAMPTZ | Timestamp when adjustment was last updated in Paddle. |
synced_at | TIMESTAMPTZ | Timestamp when CLS last synced this adjustment record. Auto-updated. |
Sync Mode
This template uses full sync only. Each sync fetches all adjustment records from your Paddle account.
Usage Examples
After syncing, you can query your adjustment data using standard SQL:
-- Get all approved refunds
SELECT id, transaction_id, total, currency_code
FROM paddle_adjustments
WHERE action = 'refund' AND status = 'approved';
-- Calculate total refunds by currency
SELECT currency_code, SUM(total::NUMERIC) as total_refunded
FROM paddle_adjustments
WHERE action = 'refund' AND status = 'approved'
GROUP BY currency_code;
-- Find chargebacks
SELECT id, transaction_id, customer_id, total, reason
FROM paddle_adjustments
WHERE action = 'chargeback';
-- Count adjustments by action type
SELECT action, status, COUNT(*) as count
FROM paddle_adjustments
GROUP BY action, status
ORDER BY action, status;
-- Find adjustments for a specific customer
SELECT id, action, status, total, created_at
FROM paddle_adjustments
WHERE customer_id = 'ctm_abc123'
ORDER BY created_at DESC;
-- Get recent adjustments
SELECT id, action, status, total, transaction_id
FROM paddle_adjustments
WHERE created_at > NOW() - INTERVAL '30 days'
ORDER BY created_at DESC;
Common Customizations
The template includes performance indexes for action, status, transaction_id, customer_id, livemode, and created_at columns.
Add Index for Subscription Adjustments
CREATE INDEX idx_paddle_adjustments_subscription
ON paddle_adjustments(subscription_id)
WHERE subscription_id IS NOT NULL;
Add Compound Index for Action and Status
CREATE INDEX idx_paddle_adjustments_action_status
ON paddle_adjustments(action, status);
Related Templates
- Transactions - Transaction records that adjustments apply to
- Customers - Customer records linked to adjustments
- Subscriptions - Subscription records linked to adjustments