Direct plan assignment
Direct plan assignment is the recommended path for sales-led and enterprise workflows where your system already owns commercial decisions.
Instead of relying on provider checkout as source of truth, your backend assigns the effective plan to a billing account with explicit effective windows.
Prereqs
- You can resolve
principal_id -> billing_account_id: Identity mapping: principal to billing account. - You have a billing plan definition: Plans overview.
Ownership boundaries
- CPQ/CRM/subscription system owns contract intent.
- Vluna owns runtime enforcement and billing behavior for effective assignment state.
- Support tooling must be able to answer "which plan was effective at timestamp T".
Assignment workflow
- Commercial system determines target plan and effective window.
- Backend writes assignment idempotently with stable source identity.
- Backend verifies effective assignment readback.
- Runtime gate loop reflects assignment state through authorize and commit.
Reliability requirements
- Use idempotency keys for all assignment writes.
- Keep
source_kind+source_refstable across retries and sync jobs. - Never trust client-provided
billing_account_idwithout server-side mapping validation. - Keep assignment changes auditable (
operator,reason,ticket_id,effective_at).
Metadata guidelines for direct assignment
When you need per-assignment overrides, use:
metadata.gate_bundle_keymetadata.billing.period.billing_modemetadata.billing.period.issue_anchor
Keep long-lived defaults in plan metadata, and use assignment metadata only for window-scoped exceptions.
Source-kind guidance
Choose source kinds by ownership:
ops.manualfor support/ops decisionsops.campaignfor managed rollout campaigns- provider source kinds for provider-derived subscription state
Do not mix multiple source identities for the same commercial event.
Verify
- The expected assignment is active for the expected window.
- Upgrade and downgrade transitions are explainable for any timestamp.
- Runtime decisions and pricing outputs match assigned plan semantics.
Next
- Assignment details: Plan assignments
- Window rules: Windows and precedence