pub struct Invoice {Show 16 fields
pub id: String,
pub subscription_id: String,
pub customer: String,
pub plan_id: String,
pub number: i64,
pub amount: Money,
pub credits: i64,
pub period_start: u64,
pub period_end: u64,
pub status: InvoiceStatus,
pub charge_id: Option<String>,
pub channel: Channel,
pub instructions: Instructions,
pub due_at: u64,
pub paid_at: Option<u64>,
pub created_at: u64,
}Fields§
§id: StringAlso the charge’s reference at the gateway and the ledger reference
of the credits it buys — one id through all three, so a webhook and a
top-up are matched to the invoice with no lookup table.
subscription_id: String§customer: String§plan_id: String§number: i641 for the first invoice, then counting. Unique per subscription, which is what stops two schedulers raising the same renewal.
amount: Money§credits: i64Credited when paid.
period_start: u64The period this invoice buys. For the first invoice both are zero until it is paid, because access starts at payment, not at signup.
period_end: u64§status: InvoiceStatus§charge_id: Option<String>The gateway’s charge id. None while the charge has not been created
yet — the gateway was down when the invoice was raised — or after the
gateway expired it; the next tick creates a fresh one either way.
channel: Channel§instructions: InstructionsHow to pay: the VA number, the QR, the URL. Empty until there is a charge.
due_at: u64Unix seconds. After this the subscription is in grace.
paid_at: Option<u64>§created_at: u64