The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
enum InvoiceStatus {
processing
completed
failed
}
enum InvoiceType {
domainRenewal
}
enum PaymentMethod {
card
ach
ach_fast
sepa
acss
}
model Invoice {
id String @id
workspaceId String
number String? @unique // This starts with the customer's unique invoicePrefix
status InvoiceStatus @default(processing)
type InvoiceType @default(domainRenewal)
paymentMethod PaymentMethod?
amount Int @default(0) // amount in usd cents
fee Int @default(0) // fee in usd cents
refundedAmount Int @default(0) // refunded amount in usd cents
total Int @default(0) // amount + fee in usd cents
receiptUrl String? @db.Text
refundReason String? @db.Text
failedReason String? @db.Text
registeredDomains Json? @db.Json // Array of RegisteredDomain
stripeChargeMetadata Json? @db.Json // Stripe charge metadata
failedAttempts Int @default(0) // number of failed attempts to charge the invoice
createdAt DateTime @default(now())
paidAt DateTime?
workspace Project @relation(fields: [workspaceId], references: [id])
@@index(workspaceId)
}