Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

1.2 KB
Raw Blame
export enum RevenueProvider {
  STRIPE = 'stripe',
  PADDLE = 'paddle',
  API = 'api',
}

export enum RevenueType {
  SALE = 'sale',
  REFUND = 'refund',
  SUBSCRIPTION = 'subscription',
}

export enum RevenueStatus {
  COMPLETED = 'completed',
  REFUNDED = 'refunded',
  PENDING = 'pending',
}

export interface RevenueTransaction {
  pid: string
  transactionId: string
  provider: RevenueProvider
  type: RevenueType
  status: RevenueStatus
  amount: number
  originalAmount: number
  originalCurrency: string
  currency: string
  profileId?: string | null
  sessionId?: string | null
  productId?: string | null
  productName?: string | null
  metadata?: Record<string, unknown>
  created: Date
  syncedAt: Date
}

export const PADDLE_REQUIRED_PERMISSIONS = [
  'adjustment.read',
  'transaction.read',
  'subscription.read',
  'customer.read',
  'product.read',
  'price.read',
]

// Stripe restricted key permissions (rak_*) that we request
export const STRIPE_REQUIRED_PERMISSIONS = [
  'rak_charge_read',
  'rak_subscription_read',
  'rak_customer_read',
  'rak_payment_intent_read',
  'rak_checkout_session_read',
  'rak_invoice_read',
  'rak_webhook_write',
  'rak_product_read',
]