scripts

command
v1.0.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

README

FlexPrice Scripts

This directory contains various scripts for managing FlexPrice data and operations.

Available Scripts

1. Assign Plan to Customers

Assigns a specific plan to all customers who don't already have a subscription for it.

Usage:

go run scripts/main.go -cmd assign-plan -tenant-id <tenant_id> -environment-id <environment_id> -plan-id <plan_id>

Example:

go run scripts/main.go -cmd assign-plan -tenant-id "tenant_123" -environment-id "env_456" -plan-id "plan_01JV2ZF6B57XZ7MRW72Q2QWQ98"

What it does:

  1. Lists all customers in the specified tenant/environment
  2. Checks which customers already have an active subscription for the specified plan
  3. Creates new subscriptions for customers who don't have the plan
  4. Uses the following default subscription settings:
    • Currency: USD
    • Billing Cadence: RECURRING
    • Billing Period: MONTHLY
    • Billing Period Count: 1
    • Billing Cycle: CALENDAR
    • Start Date: Current time

Output: The script provides detailed logging including:

  • Number of customers processed
  • Number of subscriptions created
  • Number of customers skipped (already have plan, inactive, etc.)
  • Any errors encountered
2. Sync Plan Prices

Synchronizes all prices from a plan to existing subscriptions.

Usage:

go run scripts/main.go -cmd sync-plan-prices -tenant-id <tenant_id> -environment-id <environment_id> -plan-id <plan_id>
3. Other Scripts
  • seed-events: Seed events data into Clickhouse
  • generate-apikey: Generate a new API key
  • assign-tenant: Assign tenant to user
  • onboard-tenant: Onboard a new tenant
  • migrate-subscription-line-items: Migrate subscription line items
  • import-pricing: Import pricing data
  • reprocess-events: Reprocess events

General Usage

  1. List all available commands:
go run scripts/main.go -list
  1. Run a specific command:
go run scripts/main.go -cmd <command-name> [flags...]

Environment Variables

Scripts typically require these environment variables (set via command flags):

  • TENANT_ID: The tenant identifier
  • ENVIRONMENT_ID: The environment identifier
  • PLAN_ID: The plan identifier (for plan-related scripts)

Development

When adding new scripts:

  1. Create the script function in scripts/internal/
  2. Add the command to the commands slice in scripts/main.go
  3. Update this README with usage instructions

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL