Skip to Content

Billing

Manage billing customers, plans, subscriptions, invoices, payment methods, and Stripe Connect.

Customers

OperationGraphQL
Get customerbilling_customers(where: {organization_id: {_eq: $orgId}})
Create customerinsert_billing_customers_one(object: {organization_id, stripe_customer_id, email, name})

Plans

OperationGraphQL
List plansbilling_plans(where: {organization_id: {_eq: $orgId}, application_id: {_eq: $appId}, deleted: {_neq: true}}, order_by: {created_at: desc})
Create planinsert_billing_plans_one(object: {name, description, price_pusd, currency, interval, billing_model, billed_entity, credit_pack_picodollars, features, ...})
Update planupdate_billing_plans_by_pk(pk_columns: {id: $planId}, _set: {name, price_pusd, is_active, ...})
Update plan (Action)BillingUpdatePlan(input: {planId, name, priceCents, ...}) (Hasura Action)
Delete planupdate_billing_plans_by_pk(pk_columns: {id: $planId}, _set: {deleted: true}) (soft-delete)
Plan analyticsbilling_plan_analytics(where: {organization_id: {_eq: $orgId}}) (view)

Subscriptions

OperationGraphQL
Create subscriptioninsert_subscriptions_one(object: {organization_id, billing_customer_id, stripe_subscription_id, status, plan_name, ...})
Update subscriptionupdate_subscriptions(where: {stripe_subscription_id: {_eq: $stripeSubId}}, _set: {status, ...})
List user subscriptionsuser_subscriptions(where: {organization_id: {_eq: $orgId}}, order_by: {created_at: desc})

Invoices

OperationGraphQL
List invoicesinvoices(where: {organization_id: {_eq: $orgId}}, order_by: {created_at: desc}, limit: 50)
Create invoiceinsert_invoices_one(object: {organization_id, stripe_invoice_id, status, amount_due, ...})
Update invoiceupdate_invoices(where: {stripe_invoice_id: {_eq: $stripeInvoiceId}}, _set: {status, amount_paid, ...})

Payment Methods

OperationGraphQL
List payment methodspayment_methods(where: {organization_id: {_eq: $orgId}, deleted: {_eq: false}}, order_by: [{is_default: desc}, {created_at: desc}])
Create payment methodinsert_payment_methods_one(object: {organization_id, stripe_payment_method_id, type, card_brand, card_last4, is_default, ...})
Set defaultupdate_payment_methods(where: {stripe_payment_method_id: {_eq: $id}}, _set: {is_default: true})
Remove payment methodupdate_payment_methods(where: {stripe_payment_method_id: {_eq: $id}}, _set: {deleted: true, is_default: false}) (soft-delete)
Create setup intentBillingCreateSetupIntent(input: {orgId, email, name}) (Hasura Action)
Attach payment methodBillingAttachPaymentMethod(input: {orgId, paymentMethodId}) (Hasura Action)

Ledger & Balance

OperationGraphQL
List ledger entriesbilling_ledger(where: $where, order_by: {created_at: desc}, limit: $limit)
Get plan balancebilling_balances(where: {plan_id: {_eq: $planId}}, limit: 1)
Pool balance (org)billing_wallet_ledger_aggregate(where: {organization_id: {_eq: $orgId}, direction: {_eq: "credit"}}) combined with usage_events_aggregate
Refund chargeBillingRefundCharge(input: {orgId, chargeId, amountCents, ...}) (Hasura Action)
Credit checkoutBillingCreditCheckout(input: {orgId, amountUsd, currency}) (Hasura Action)

Plan Funding

OperationGraphQL
Create funding intentBillingCreatePlanFundingIntent(input: {orgId, planId, fundingModeId, assignmentId, provider, ...}) (Hasura Action)
User plan checkoutBillingUserPlanCheckout(input: {orgId, applicationId, userId, billingPlanId, fundingModeId}) (Hasura Action)

Stripe Connect

OperationGraphQL
Create Connect accountBillingCreateConnectAccount(input: {orgId, displayName, contactEmail, country}) (Hasura Action)
Get onboard linkBillingCreateConnectOnboardLink(input: {orgId, refreshUrl, returnUrl}) (Hasura Action)
Get account statusBillingGetConnectAccountStatus(input: {orgId, accountId}) (Hasura Action)
Delete Connect accountBillingDeleteConnectAccount(input: {orgId}) (Hasura Action)
Create Connect productBillingCreateConnectProduct(input: {orgId, name, unitAmount, currency, recurringInterval, planId}) (Hasura Action)
List Connect productsBillingListConnectProducts(input: {orgId, limit}) (Hasura Action)
Create Connect checkoutBillingCreateConnectCheckout(input: {orgId, planId, priceId, quantity, successUrl, cancelUrl}) (Hasura Action)
Get connected accountbilling_connected_accounts(where: {org_id: {_eq: $orgId}}, limit: 1)

External Checkout Integrations

OperationGraphQL
List integrationsexternal_checkout_integrations(where: {organization_id: {_eq: $orgId}}, order_by: {created_at: desc})
Create integrationinsert_external_checkout_integrations_one(object: {organization_id, provider, display_name, status, ...})
Update integrationupdate_external_checkout_integrations_by_pk(pk_columns: {id: $id}, _set: {display_name, status, ...})

Payouts

OperationGraphQL
List payoutspayouts(where: {organization_id: {_eq: $orgId}}, order_by: {created_at: desc})

Billing Analytics (REST)

The GET /billing/analytics REST endpoint returns plan-level subscriber counts and revenue aggregates for the organization. Authentication: builder JWT. The org is resolved from the token; no query parameters are needed.

curl https://api.picklayer.ai/billing/analytics \ -H "Authorization: Bearer $ORG_TOKEN"

Response: array of per-plan rows with planId, planName, subscriberCount, activeSubscriberCount, totalRevenuePusd, and mrr. Monetary values are in pUSD (divide by 10^12 for dollars).

For finer-grained control, query the billing_plan_analytics Hasura view directly:

OperationGraphQL
Plan analytics (all plans)billing_plan_analytics(where: {organization_id: {_eq: $orgId}})
Plan analytics (single plan)billing_plan_analytics(where: {id: {_eq: $planId}})

Billing Settings (REST)

PATCH /billing/settings — updates budget_limit and hard_cap_enabled on the organization. Body: { orgId, budgetLimit?, hardCapEnabled? }. See management-api/settings for the full field descriptions and guard behavior.

Last updated on