dFlow
API, CLI, and Admin Reference

Subscription and billing actions

Billing and plans: checkFeatureAccessAction server action and tRPC routers for Stripe, subscriptions, cards, orders, and Worker Node purchases.

dFlow Cloud billing uses Stripe. The UI combines Server Actions for a few checks with tRPC routers for plans, payment methods, checkout, and Worker Node orders.

Server action

actionNameSourcePermission keys (from getActionAccess)
checkFeatureAccessActionpackages/core/src/actions/subscription/index.tsservers.read

Use this page together with customer docs under Billing and Account under Billing and Account in the sidebar for behaviour and UX.

tRPC: subscription plans

Router: subscriptions on appRouter (packages/cloud/src/trpc/routers/subscriptionPlans/index.ts).

Notable procedures include:

ProcedureAccessRole
getPlanspublicProcedureMarketing / pricing surfaces that list plans without a session.
getUserSubscriptionPlanuserProcedureCurrent subscriber state for the signed-in user.
getAddonUsageuserProcedureAdd-on consumption.
getSubscriptionPreviewuserProcedureProration and change previews.
createFreeSubscriptionuserProcedureFree tier onboarding.
updateSubscriptionuserProcedurePlan changes and upgrades.
getSubscriptionDetailsuserProcedureDetailed subscription payload.
cancelDowngradeScheduleuserProcedureCancel a scheduled downgrade.

The file contains additional helpers and mutations; inspect the router for the full list.

tRPC: Stripe customer and payment methods

Router: stripe (packages/cloud/src/trpc/routers/stripe/index.ts).

ProcedureRole
createStripeCustomerEnsure a Stripe customer exists.
getStripeCustomerFetch Stripe customer.
getSubscriptionPreviewInvoice preview for selected prices.
createSetupIntentAdd a card (SetupIntent).
hasDefaultPaymentMethodWhether default payment method is set.
attachPaymentMethodAttach a payment method to the customer.
getPaymentMethodsList saved methods.
updateDefaultPaymentMethodSet default.
deletePaymentMethodRemove a method.
cancelSubscriptionCancel at period end for a Stripe subscription id.
addWalletAmountWallet top-up checkout session.

tRPC: saved cards (Billing payment methods)

Router: card (packages/cloud/src/trpc/routers/card/index.ts).

ProcedureRole
addNewCardAdd card metadata the UI persists.
getCardsList cards.
updateCardNameRename.
deleteCardRemove.

tRPC: orders

Router: orders (packages/cloud/src/trpc/routers/orders/index.ts).

ProcedureRole
getAllOrdersList orders for the user.

tRPC: Worker Node / VPS purchases

Router: vpsOrders (packages/cloud/src/trpc/routers/vpsOrders/index.ts).

Examples include createOrder, getOrders, getOrdersById, getSubscriptions, lifecycle stopServer, startServer, restartServer, refetchServerStatus, and subscription management such as cancelServerSubscription, resumeServerSubscription, cancelOrResumeWorkerNodeAtMonthEnd. Read the router for exact inputs and side effects.

Billing and growth flows also touch coupons, rewards, discord, workerNodes (for example a getServersWithFieldsAction query backed by Payload), vpsPlans, and cloud. Explore packages/cloud/src/trpc/routers/index.ts for the authoritative router list.

Learn more

On this page