Package-level declarations

Types

Link copied to clipboard
object Billing

Reads Clerk Billing data: Plans, Subscriptions, statements, payment attempts, and credits.

Link copied to clipboard
@Serializable
data class BillingAppliedDiscount(val amount: BillingMoneyAmount, val discountId: String, val name: String, val effect: BillingDiscountEffect = BillingDiscountEffect.UNKNOWN, val percentOff: Double? = null, val amountOff: BillingMoneyAmount? = null, val promoCode: String? = null, val cyclesRemaining: Int? = null, val durationInCycles: Int? = null)

A catalog discount applied to a checkout or payment.

Link copied to clipboard
@Serializable
data class BillingCreditBalance(val balance: BillingMoneyAmount? = null)

The credit balance for a payer.

Link copied to clipboard
@Serializable
data class BillingCreditLedger(val id: String, val amount: BillingMoneyAmount, val sourceType: String, val sourceId: String, val createdAt: Long)

A credit ledger entry for the current payer or a given Organization.

Link copied to clipboard
@Serializable
data class BillingCredits(val proration: BillingProrationCreditDetail? = null, val payer: BillingPayerCredit? = null, val total: BillingMoneyAmount)

Credits applied to a checkout, payment, or subscription item.

Link copied to clipboard

Whether a catalog discount subtracts a percentage or a fixed amount.

Link copied to clipboard
@Serializable
data class BillingDiscountRedemption(val id: String, val subscriptionItemId: String, val discountId: String, val name: String, val source: BillingDiscountSource = BillingDiscountSource.UNKNOWN, val promoCode: String? = null, val effect: BillingDiscountEffect? = null, val percentOff: Double? = null, val amountOff: BillingMoneyAmount? = null, val amount: BillingMoneyAmount? = null, val cyclesRemaining: Int? = null, val cyclesApplied: Int, val status: BillingDiscountRedemptionStatus? = null, val redeemedAt: Long, val redeemedBy: String? = null)

A discount redemption applied to a subscription item.

Link copied to clipboard

The current status of a discount redemption.

Link copied to clipboard
@Serializable
data class BillingDiscounts(val proration: BillingProrationDiscount? = null, val discount: BillingAppliedDiscount? = null, val total: BillingMoneyAmount)

Discounts applied to a checkout or payment, such as prorated discounts for mid-cycle seat additions.

Link copied to clipboard

How a discount was applied to a subscription item.

Link copied to clipboard
@Serializable
data class BillingMoneyAmount(val amount: Long, val amountFormatted: String, val currency: String, val currencySymbol: String)

A monetary value with currency information.

Link copied to clipboard
@Serializable
data class BillingPayerCredit(val remainingBalance: BillingMoneyAmount, val appliedAmount: BillingMoneyAmount)

The payer's available credit and the amount applied to a transaction.

Link copied to clipboard

Specifies the subscriber type a Plan is designed for.

Link copied to clipboard
@Serializable
data class BillingPayment(val id: String, val amount: BillingMoneyAmount, val paidAt: Long? = null, val failedAt: Long? = null, val updatedAt: Long, val paymentMethod: BillingPaymentMethod? = null, val subscriptionItem: BillingSubscriptionItem, val chargeType: BillingPaymentChargeType = BillingPaymentChargeType.UNKNOWN, val status: BillingPaymentStatus = BillingPaymentStatus.UNKNOWN, val totals: BillingPaymentTotals? = null)

A payment attempt for a user or Organization.

Link copied to clipboard

The type of charge a payment represents.

Link copied to clipboard
@Serializable
data class BillingPaymentMethod(val id: String, val last4: String? = null, val paymentType: String? = null, val cardType: String? = null, val isDefault: Boolean? = null, val isRemovable: Boolean? = null, val status: BillingPaymentMethodStatus = BillingPaymentMethodStatus.UNKNOWN, val walletType: String? = null, val expiryYear: Int? = null, val expiryMonth: Int? = null, val createdAt: Long? = null, val updatedAt: Long? = null)

A stored payment method for a user or Organization.

Link copied to clipboard

The status of a payment method.

Link copied to clipboard

The current status of a payment.

Link copied to clipboard
@Serializable
data class BillingPaymentTotals(val subtotal: BillingMoneyAmount, val grandTotal: BillingMoneyAmount, val taxTotal: BillingMoneyAmount, val baseFee: BillingMoneyAmount? = null, val perUnitTotals: List<BillingPerUnitTotal>? = null, val discounts: BillingDiscounts? = null)

Per-payment cost breakdown, including any base fee and per-unit (for example, seats) subtotals.

Link copied to clipboard
@Serializable
data class BillingPeriodTotals(val subtotal: BillingMoneyAmount, val baseFee: BillingMoneyAmount, val taxTotal: BillingMoneyAmount, val grandTotal: BillingMoneyAmount, val perUnitTotals: List<BillingPerUnitTotal>? = null)

Per-period renewal totals after a checkout, including all seats and the base plan fee.

Link copied to clipboard
@Serializable
data class BillingPerUnitTotal(val name: String, val blockSize: Int, val tiers: List<BillingPerUnitTotalTier> = emptyList())

Per-unit cost breakdown in totals (for example, seats).

Link copied to clipboard
@Serializable
data class BillingPerUnitTotalTier(val quantity: Int? = null, val feePerBlock: BillingMoneyAmount, val total: BillingMoneyAmount)

The cost breakdown for a single pricing tier in totals.

Link copied to clipboard
@Serializable
data class BillingPlan(val id: String, val name: String, val fee: BillingMoneyAmount? = null, val annualFee: BillingMoneyAmount? = null, val annualMonthlyFee: BillingMoneyAmount? = null, val description: String? = null, val isDefault: Boolean, val isRecurring: Boolean, val hasBaseFee: Boolean, val forPayerType: BillingPayerResourceType = BillingPayerResourceType.UNKNOWN, val publiclyVisible: Boolean, val slug: String, val avatarUrl: String? = null, val features: List<Feature> = emptyList(), val unitPrices: List<BillingPlanUnitPrice>? = null, val availablePrices: List<BillingPlanPrice>? = null, val freeTrialDays: Int? = null, val freeTrialEnabled: Boolean = false)

A Subscription Plan with its details.

Link copied to clipboard
@Serializable
data class BillingPlanPrice(val id: String, val fee: BillingMoneyAmount? = null, val annualMonthlyFee: BillingMoneyAmount? = null, val isDefault: Boolean, val unitPrices: List<BillingPlanUnitPrice>? = null)

A specific possible price for a Billing Plan.

Link copied to clipboard
@Serializable
data class BillingPlanUnitPrice(val name: String, val blockSize: Int, val tiers: List<BillingPlanUnitPriceTier> = emptyList())

Unit pricing for a specific unit type (for example, seats) on a plan.

Link copied to clipboard
@Serializable
data class BillingPlanUnitPriceTier(val id: String? = null, val startsAtBlock: Int, val endsAfterBlock: Int? = null, val feePerBlock: BillingMoneyAmount)

A single pricing tier for a unit type on a plan.

Link copied to clipboard
@Serializable
data class BillingProrationCreditDetail(val amount: BillingMoneyAmount, val cycleDaysRemaining: Int, val cycleDaysTotal: Int, val cycleRemainingPercent: Double)

Details about a proration credit, including the remaining portion of the billing cycle.

Link copied to clipboard
@Serializable
data class BillingProrationDiscount(val amount: BillingMoneyAmount, val cycleDaysPassed: Int, val cycleDaysTotal: Int, val cyclePassedPercent: Double)

A prorated discount applied when adding a seat mid-cycle.

Link copied to clipboard
@Serializable
data class BillingStatement(val id: String, val totals: BillingStatementTotals, val status: BillingStatementStatus = BillingStatementStatus.UNKNOWN, val timestamp: Long, val groups: List<BillingStatementGroup> = emptyList())

A billing statement for a user or Organization.

Link copied to clipboard
@Serializable
data class BillingStatementGroup(val id: String? = null, val timestamp: Long, val items: List<BillingPayment> = emptyList())

A group of payment items within a statement.

Link copied to clipboard

The current status of a billing statement.

Link copied to clipboard
@Serializable
data class BillingStatementTotals(val subtotal: BillingMoneyAmount, val grandTotal: BillingMoneyAmount, val taxTotal: BillingMoneyAmount)

Total costs, taxes, and other pricing details for a statement.

Link copied to clipboard
@Serializable
data class BillingSubscription(val id: String, val activeAt: Long? = null, val createdAt: Long, val nextPayment: BillingSubscriptionNextPayment? = null, val pastDueAt: Long? = null, val status: BillingSubscriptionStatus = BillingSubscriptionStatus.UNKNOWN, val subscriptionItems: List<BillingSubscriptionItem> = emptyList(), val updatedAt: Long? = null, val eligibleForFreeTrial: Boolean = false)

A subscription to a plan for the current user or an Organization.

Link copied to clipboard
@Serializable
data class BillingSubscriptionItem(val id: String, val plan: BillingPlan, val planPeriod: BillingSubscriptionPlanPeriod = BillingSubscriptionPlanPeriod.UNKNOWN, val priceId: String? = null, val status: BillingSubscriptionStatus = BillingSubscriptionStatus.UNKNOWN, val createdAt: Long? = null, val pastDueAt: Long? = null, val periodStart: Long? = null, val periodEnd: Long? = null, val canceledAt: Long? = null, val amount: BillingMoneyAmount? = null, val nextPayment: BillingSubscriptionItemNextPayment? = null, val credit: BillingSubscriptionItemCredit? = null, val credits: BillingCredits? = null, val appliedDiscount: BillingDiscountRedemption? = null, val seats: BillingSubscriptionItemSeats? = null, val isFreeTrial: Boolean = false)

An item in a Billing Subscription.

Link copied to clipboard
@Serializable
data class BillingSubscriptionItemCredit(val amount: BillingMoneyAmount)

Credit from a previous purchase applied to a subscription item.

Link copied to clipboard
@Serializable
data class BillingSubscriptionItemNextPayment(val amount: BillingMoneyAmount, val date: Long, val perUnitTotals: List<BillingPerUnitTotal>? = null, val totals: BillingTotals? = null)

Upcoming payment details for a subscription item.

Link copied to clipboard
@Serializable
data class BillingSubscriptionItemSeats(val quantity: Int? = null, val tiers: List<BillingPerUnitTotalTier>? = null)

Seat entitlements attached to a subscription item.

Link copied to clipboard
@Serializable
data class BillingSubscriptionNextPayment(val amount: BillingMoneyAmount, val date: Long, val perUnitTotals: List<BillingPerUnitTotal>? = null, val totals: BillingTotals? = null)

Upcoming payment details for a subscription.

Link copied to clipboard

The billing period for a Plan.

Link copied to clipboard

The status of a Billing Subscription or subscription item.

Link copied to clipboard
@Serializable
data class BillingTotals(val subtotal: BillingMoneyAmount, val baseFee: BillingMoneyAmount? = null, val taxTotal: BillingMoneyAmount, val grandTotal: BillingMoneyAmount, val totalDueAfterFreeTrial: BillingMoneyAmount? = null, val credit: BillingMoneyAmount? = null, val credits: BillingCredits? = null, val discounts: BillingDiscounts? = null, val pastDue: BillingMoneyAmount? = null, val totalDueNow: BillingMoneyAmount? = null, val perUnitTotals: List<BillingPerUnitTotal>? = null, val totalsDuePerPeriod: BillingPeriodTotals? = null, val totalDuePerPeriod: BillingMoneyAmount? = null)

A granular breakdown of the total amount that will be charged, either during checkout or at renewal.

Link copied to clipboard
@Serializable
data class Feature(val id: String, val name: String, val description: String? = null, val slug: String, val avatarUrl: String? = null)

A Feature included on a Billing Plan.

Link copied to clipboard
@Serializable
enum ForPayerType : Enum<ForPayerType>

The payer type of a Billing Plan.