Billing

object Billing

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

Methods that read a payer's data take an optional orgId: omit it for the signed-in user, or pass an Organization ID to read that Organization's data, which requires the org:sys_billing:read Permission.

Functions

Link copied to clipboard

Gets the credit balance of the signed-in user, or of the Organization with orgId.

Link copied to clipboard
suspend fun getCreditHistory(orgId: String? = null, limit: Int = DEFAULT_BILLING_LIMIT, offset: Int = 0): ClerkResult<ClerkPaginatedResponse<BillingCreditLedger>, ClerkErrorResponse>

Lists the credit ledger entries of the signed-in user, or of the Organization with orgId.

Link copied to clipboard

Gets a payment attempt by ID.

Link copied to clipboard
suspend fun getPaymentAttempts(orgId: String? = null, limit: Int = DEFAULT_BILLING_LIMIT, offset: Int = 0): ClerkResult<ClerkPaginatedResponse<BillingPayment>, ClerkErrorResponse>

Lists the payment attempts of the signed-in user, or of the Organization with orgId.

Link copied to clipboard

Gets a Plan by ID.

Link copied to clipboard
suspend fun getPlans(forPayer: ForPayerType = ForPayerType.USER, orgId: String? = null, minSeats: Int? = null, limit: Int = DEFAULT_BILLING_LIMIT, offset: Int = 0): ClerkResult<ClerkPaginatedResponse<BillingPlan>, ClerkErrorResponse>

Lists your publicly visible Plans.

Link copied to clipboard

Gets a statement by ID.

Link copied to clipboard
suspend fun getStatements(orgId: String? = null, limit: Int = DEFAULT_BILLING_LIMIT, offset: Int = 0): ClerkResult<ClerkPaginatedResponse<BillingStatement>, ClerkErrorResponse>

Lists the statements of the signed-in user, or of the Organization with orgId.

Link copied to clipboard

Gets the Subscription of the signed-in user, or of the Organization with orgId.