### Install Latest Release with Setup Script Source: https://docs.flexprice.io/docs/contributing-guide/frontend-setup Download, extract, and run the setup script for the latest release of the frontend. ```bash curl -s https://api.github.com/repos/flexprice/flexprice-front/releases/latest | grep "browser_download_url.*tar.gz" | cut -d '"' -f 4 | wget -qi - tar -xzf flexprice-front-*.tar.gz cd flexprice-front-* ./setup ``` -------------------------------- ### Manual Frontend Setup: Clone and Install Dependencies Source: https://docs.flexprice.io/docs/contributing-guide/frontend-setup Manually clone the repository and install project dependencies using npm. ```bash git clone https://github.com/flexprice/flexprice-front cd flexprice-front npm install ``` -------------------------------- ### Clone and Run One-Click Setup Script Source: https://docs.flexprice.io/docs/contributing-guide/frontend-setup Clone the repository and execute the automated setup script for a quick environment setup. ```bash git clone https://github.com/flexprice/flexprice-front cd flexprice-front ./setup ``` -------------------------------- ### Start a Temporal Worker in Go Source: https://docs.flexprice.io/docs/contributing-guide/architechture Shows the setup and lifecycle management for a Temporal worker, including client creation, workflow/activity registration, and running the worker. ```go func StartTemporalWorker(config *config.Config) { client := temporal.NewClient() worker := worker.New(client, "billing-queue", worker.Options{}) RegisterWorkflows(worker) RegisterActivities(worker) worker.Run(worker.InterruptCh()) } ``` -------------------------------- ### Start Development Server Source: https://docs.flexprice.io/docs/contributing-guide/frontend-setup Run this command to start the local development server. ```bash npm run dev ``` -------------------------------- ### Introductory Discount for Q1 Only Source: https://docs.flexprice.io/docs/product-catalogue/coupons/apply-discount-on-subscription This example shows how to apply a coupon for a specific quarter (Q1) by defining a phase with start and end dates. Invoices generated after the phase ends will be at full price. ```bash curl -X POST https://api.flexprice.io/v1/subscriptions \ -H "x-api-key: " \ -H "Content-Type: application/json" \ -d '{ "customer_id": "", "plan_id": "", "start_date": "2025-01-01T00:00:00Z", "phases": [ { "start_date": "2025-01-01T00:00:00Z", "end_date": "2025-03-31T23:59:59Z", "subscription_coupons": [ { "coupon_code": "Q1PROMO" } ] }, { "start_date": "2025-04-01T00:00:00Z" } ] }' ``` -------------------------------- ### Configuration File Example Source: https://docs.flexprice.io/docs/contributing-guide/architechture An example YAML configuration file demonstrating server, database, Kafka, and Temporal settings, including environment variable overrides. ```yaml # config.yaml server: port: 8080 host: "0.0.0.0" database: postgres: host: ${DB_HOST:localhost} port: ${DB_PORT:5432} database: ${DB_NAME:flexprice} clickhouse: host: ${CLICKHOUSE_HOST:localhost} port: ${CLICKHOUSE_PORT:9000} kafka: brokers: ${KAFKA_BROKERS:localhost:29092} topics: events: "events" events_lazy: "events_lazy" processed_events: "events_post_processing" system_events: "system_events" temporal: host: ${TEMPORAL_HOST:localhost:7233} namespace: ${TEMPORAL_NAMESPACE:default} ``` -------------------------------- ### Monthly Upgrade Proration Example Source: https://docs.flexprice.io/docs/subscriptions/understanding-proration Example calculation for upgrading a monthly subscription plan mid-billing cycle. ```text Current Plan: Basic Monthly ($50/month) New Plan: Premium Monthly ($100/month) Change Date: Day 10 of 30-day month Calculation: * Days used: 10 * Days remaining: 20 * Credit: (20/30) × $50 = $33.33 * Charge: (20/30) × $100 = $66.67 * Net amount: $66.67 - $33.33 = $33.34 ``` -------------------------------- ### Full Clean Start Source: https://docs.flexprice.io/docs/getting-started/self-hosting-guide Perform a complete clean start by stopping all services and destroying all data volumes. ```bash make clean-start ``` -------------------------------- ### Storage Usage Tracking Example Source: https://docs.flexprice.io/docs/event-ingestion/troubleshooting This example demonstrates how to track storage usage in GB. Verify that the 'event_name' and 'external_customer_id' match your configuration. ```json // Feature: Storage (Sum of GB) { "event_name": "storage.usage", "external_customer_id": "cust_123", "properties": { "gb": 1.5 } } ``` -------------------------------- ### User Activity Tracking Example Source: https://docs.flexprice.io/docs/event-ingestion/troubleshooting Use this example to track active users, ensuring the 'event_name', 'external_customer_id', and 'user_id' are accurately configured. ```json // Feature: Active Users (Unique Count) { "event_name": "active.users", "external_customer_id": "cust_123", "properties": { "user_id": "user_456" } } ``` -------------------------------- ### Example Invoice Preview Source: https://docs.flexprice.io/docs/event-ingestion/connecting-to-billing This is an example of how an invoice preview will look, detailing subscription, description, interval, quantity, and amount. ```text Subscription Description Interval Quantity Amount Test Feature Usage Based Aug 22 - Sep 22 2 $2 ``` -------------------------------- ### Start Kafka UI with Dev Profile Source: https://docs.flexprice.io/docs/getting-started/self-hosting-guide To access the Kafka UI, you need to start it with the 'dev' profile using the docker compose command. ```bash docker compose --profile dev up -d kafka-ui ``` -------------------------------- ### Configuration Settings Event Example Source: https://docs.flexprice.io/docs/product-catalogue/features/aggregation/latest An example event payload for updating configuration settings, such as maximum user limits. This structure is compatible with the LATEST aggregation function. ```json { "event_name": "config.update", "external_customer_id": "user_456", "properties": { "max_users": 50 } } ``` -------------------------------- ### Storage Usage Event Example Source: https://docs.flexprice.io/docs/product-catalogue/features/aggregation/sum An example of an event payload for tracking storage usage, where the 'mb' property will be summed. ```json { "event_name": "storage.usage", "external_customer_id": "merchant_789", "properties": { "mb": 512 } } ``` -------------------------------- ### Start Flexprice MCP Server with npx Source: https://docs.flexprice.io/docs/connect/mcp-server Use this command to start the MCP server for clients like Cursor, VS Code, Gemini, and Windsurf. Ensure you replace YOUR_API_KEY with your actual Flexprice API key and use the correct server URL. ```bash npx -y @flexprice/mcp-server start --server-url https://us.api.flexprice.io/v1 --api-key-auth YOUR_API_KEY ``` -------------------------------- ### Quarterly Downgrade Proration Example Source: https://docs.flexprice.io/docs/subscriptions/understanding-proration Example calculation for downgrading a quarterly subscription plan mid-billing cycle. ```text Current Plan: Premium Quarterly ($300/quarter) New Plan: Basic Quarterly ($150/quarter) Change Date: Day 45 of 90-day quarter Calculation: * Days used: 45 * Days remaining: 45 * Credit: (45/90) × $300 = $150.00 * Charge: (45/90) × $150 = $75.00 * Net amount: $75.00 - $150.00 = -$75.00 (credit) ``` -------------------------------- ### Business Analytics Example Source: https://docs.flexprice.io/docs/product-catalogue/features/aggregation/average This example demonstrates event data for business analytics, such as tracking order values. Customize 'event_name' and 'order_value' to reflect your business metrics. ```json { "event_name": "order.placed", "external_customer_id": "merchant_789", "properties": { "order_value": 125.50 } } ``` -------------------------------- ### Peak Resource Usage Event Example Source: https://docs.flexprice.io/docs/product-catalogue/features/aggregation/max An example event structure for tracking peak resource utilization like CPU or memory. Suitable for capacity-based pricing models. ```json { "event_name": "resource.peak", "external_customer_id": "user_456", "properties": { "cpu_percent": 85 } } ``` -------------------------------- ### Complete Event Payload Example Source: https://docs.flexprice.io/docs/event-ingestion/sending-events This example demonstrates a comprehensive event payload including optional fields like event_id, timestamp, and source, along with properties for aggregation. ```json { "event_name": "model.usage", "external_customer_id": "cust_123", "properties": { "credits": 2, "model": "gpt-4", "region": "us-east-1" }, "event_id": "evt_abc123", "timestamp": "2025-08-22T07:05:49.441Z", "source": "api" } ``` -------------------------------- ### API Usage Tracking Examples Source: https://docs.flexprice.io/docs/event-ingestion/troubleshooting Use these examples to track API calls and API usage, including the number of tokens consumed. Ensure the 'event_name' and 'external_customer_id' are correctly set. ```json // Feature: API Calls (Count) { "event_name": "api.calls", "external_customer_id": "cust_123" } ``` ```json // Feature: API Usage (Sum of tokens) { "event_name": "api.usage", "external_customer_id": "cust_123", "properties": { "tokens": 150 } } ``` -------------------------------- ### Get Setting API Endpoint Source: https://docs.flexprice.io/docs/settings/settings Example of a GET request to retrieve a specific setting by its key. Supports 'subscription_config' and 'invoice_config'. ```http GET /v1/settings/:key ``` -------------------------------- ### Get Setting API Response Source: https://docs.flexprice.io/docs/settings/settings Example JSON response structure for the Get Setting API endpoint, including the setting value and metadata. ```json { "value": { // Setting specific fields based on key type }, "tenant_id": "string", "environment_id": "string", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" } ``` -------------------------------- ### Clone Repository and Set Up Development Environment Source: https://docs.flexprice.io/docs/contributing-guide/backend-setup Clone the Flexprice repository and run the make dev-setup command to initialize the complete development environment, including infrastructure, application build, and service startup. ```bash git clone https://github.com/flexprice/flexprice cd flexprice make dev-setup ``` -------------------------------- ### Manual Frontend Setup: Environment Configuration Source: https://docs.flexprice.io/docs/contributing-guide/frontend-setup Copy the environment template and configure necessary variables in .env.local for development. ```bash # Copy environment template cp .env.example .env # Configure these variables in .env.local: VITE_SUPABASE_URL=your-supabase-url VITE_SUPABASE_ANON_KEY=your-supabase-anon-key VITE_API_URL=http://localhost:8080/v1 # or VITE_ENVIRONMENT=development ``` -------------------------------- ### S3 File Naming Convention Example Source: https://docs.flexprice.io/docs/data-exports/amazon-s3/export Demonstrates the file naming convention for exported data, including entity type, start time, and end time. The time format is YYMMDDHHMMSS. ```text invoice-251016100000-251016110000.csv ``` ```text events-251016000000-251017000000.csv.gz ``` ```text credit_usage-251223110000-251223120000.csv ``` -------------------------------- ### Calculate Line Item Start Date Source: https://docs.flexprice.io/docs/subscriptions/subscription-line-item-overrides Determines the start date of a line item by taking the latest of the subscription's start date, the price's start date (if set), or the request's start date (if set). Timestamps are stored in UTC and truncated to milliseconds. ```plaintext line_item.start_date = max( subscription.start_date, price.start_date (if set), request.start_date (if set) ) ``` -------------------------------- ### Manual Deployment: Build and Serve Source: https://docs.flexprice.io/docs/contributing-guide/frontend-setup Build the application for production and serve the static files using nginx or npx serve. ```bash # Build the application npm run build # Serve the static files # Using nginx cp nginx.conf /etc/nginx/conf.d/flexprice.conf nginx -s reload # Or using serve npx serve -s dist ``` -------------------------------- ### Update Metadata Only Example Source: https://docs.flexprice.io/docs/product-catalogue/plans/update-price Example of updating only the metadata of a price, which does not require a sync. ```APIDOC ## Example: Update metadata only (no sync needed) ### Request ```json PUT /prices/price_api_calls { "display_name": "API Calls — Updated Tiers", "metadata": { "updated_by": "billing-team" } } ``` No sync required. ``` -------------------------------- ### Docker Deployment: Build and Run Source: https://docs.flexprice.io/docs/contributing-guide/frontend-setup Build the Docker image for the frontend and run it as a container, configuring environment variables. ```bash # Build the Docker image docker build -t flexprice-frontend . # Run the container docker run -p 80:80 \ -e VITE_API_URL=your-api-url \ -e VITE_AUTH_DOMAIN=your-auth-domain \ flexprice-frontend ``` -------------------------------- ### Sync Workflow Started Response Source: https://docs.flexprice.io/docs/product-catalogue/plans/update-price This is the expected response when a price sync workflow is successfully started. ```json { "workflow_id": "PriceSyncWorkflow-plan_xxx", "run_id": "run_abc123", "message": "price sync workflow started successfully" } ``` -------------------------------- ### Update Usage Tiers Example Source: https://docs.flexprice.io/docs/product-catalogue/plans/update-price Example of updating a plan's price for usage-based tiers. ```APIDOC ## Example: Update usage tiers ### Request ```json PUT /prices/price_api_calls { "billing_model": "TIERED", "tier_mode": "VOLUME", "tiers": [ { "up_to": 50000, "unit_amount": "0.002" }, { "up_to": 200000, "unit_amount": "0.001" }, { "up_to": null, "unit_amount": "0.0005" } ] } ``` ``` -------------------------------- ### Send Event using Go Source: https://docs.flexprice.io/docs/event-ingestion/api-reference This Go example shows how to send an event using the standard 'net/http' package. The API key is expected in the environment variables. ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" "os" ) type Event struct { EventName string `json:"event_name"` ExternalCustomerID string `json:"external_customer_id"` Properties map[string]interface{} `json:"properties,omitempty"` Source string `json:"source,omitempty"` } func sendEvent() error { event := Event{ EventName: "model.usage", ExternalCustomerID: "cust_123", Properties: map[string]interface{}{ "credits": 2, }, Source: "api", } jsonData, err := json.Marshal(event) if err != nil { return err } req, err := http.NewRequest("POST", "https://api.cloud.flexprice.io/v1/events", bytes.NewBuffer(jsonData)) if err != nil { return err } req.Header.Set("Content-Type", "application/json") req.Header.Set("x-api-key", os.Getenv("FLEXPRICE_API_KEY")) client := &http.Client{} resp, err := client.Do(req) if err != nil { return err } defer resp.Body.Close() if resp.StatusCode == 202 { fmt.Println("Event sent successfully") } else { fmt.Printf("Error: HTTP %d\n", resp.StatusCode) } return nil } ``` -------------------------------- ### Create Pay As You Go Plan Source: https://docs.flexprice.io/docs/boiler-plate/usage-based-pricing Sets up a usage-based pricing plan with flat fees for SMS/Chat hosting. Ensure the 'Select Metered Feature' matches the created feature's lookup key. ```JSON { "plan_name": "Pay As You Go", "lookup_key": "pay_as_you_go", "plan_description": "Usage-based pricing plan with flat fees for call minutes and SMS/chat messages", "charges": [ { "feature_lookup_key": "sms_chat_hosting", "billing_currency": "USD", "billing_period": "Monthly", "billing_model": "Flat Fee", "price_per_unit": 0.005, "billing_timing": "Arrears Billing" } ] } ``` -------------------------------- ### Update a Flat Fee Amount Example Source: https://docs.flexprice.io/docs/product-catalogue/plans/update-price Example of updating a plan's price for a flat fee. ```APIDOC ## Example: Update a flat fee amount ### Request ```json PUT /prices/price_monthly_base { "amount": "79.00", "effective_from": "2026-04-01T00:00:00Z" } ``` Then sync: `POST /plans/plan_growth/sync/subscriptions` ``` -------------------------------- ### AI-assisted pricing setup - Prompt to Plan Source: https://docs.flexprice.io/docs/changelog This endpoint powers the Prompt to Plan chat workflow, allowing users to describe pricing models in natural language and receive a structured configuration. ```APIDOC ## POST /v1/ai/pricing/parse ### Description Accepts pricing descriptions in natural language and returns structured plan, price, meter, and entitlement configurations. ### Method POST ### Endpoint /v1/ai/pricing/parse ### Request Body - **pricing_description** (string) - Required - A plain English description of the pricing model. ``` -------------------------------- ### Yearly Plan Change Proration Example Source: https://docs.flexprice.io/docs/subscriptions/understanding-proration Example calculation for changing a yearly subscription plan mid-billing cycle. ```text Current Plan: Basic Yearly ($600/year) New Plan: Premium Yearly ($1200/year) Change Date: Day 100 of 365-day year Calculation: * Days used: 100 * Days remaining: 265 * Credit: (265/365) × $600 = $435.62 * Charge: (265/365) × $1200 = $871.23 * Net amount: $871.23 - $435.62 = $435.61 ``` -------------------------------- ### Credit-Based Pricing Example Source: https://docs.flexprice.io/docs/product-catalogue/features/aggregation/sum-with-multiplier Shows how to use Sum with Multiplier for pricing based on credits. The multiplier converts used credits to dollars at a rate of $0.01 per credit. ```json { "event_name": "api.credits", "external_customer_id": "user_456", "properties": { "credits_used": 250 } } ``` -------------------------------- ### Credits Consumed Event Example Source: https://docs.flexprice.io/docs/product-catalogue/features/aggregation/sum An example of an event payload for tracking consumed credits, where the 'credits' property will be summed. ```json { "event_name": "model.usage", "external_customer_id": "customer_101", "properties": { "credits": 25 } } ``` -------------------------------- ### Coupon Chaining Example Source: https://docs.flexprice.io/docs/invoices/calculation Illustrates how multiple subscription-level coupons apply sequentially, with each coupon's discount calculated on the remaining balance after the previous coupon. ```plaintext Subtotal: $100.00 Coupon A (10%): - $10.00 --> running total: $90.00 Coupon B (10%): - $9.00 --> running total: $81.00 (applies to $90, not $100) ``` -------------------------------- ### Compute Time Event Example Source: https://docs.flexprice.io/docs/product-catalogue/features/aggregation/sum An example of an event payload for tracking compute time, where the 'hours' property will be summed. ```json { "event_name": "compute.usage", "external_customer_id": "user_456", "properties": { "hours": 1.5 } } ``` -------------------------------- ### Create Coupon Source: https://docs.flexprice.io/docs/product-catalogue/coupons/create This example demonstrates how to create a new coupon using a POST request to the /v1/coupons endpoint. ```APIDOC ## POST /v1/coupons ### Description Create percentage or fixed-amount discount coupons via API. ### Method POST ### Endpoint https://api.flexprice.io/v1/coupons ### Parameters #### Request Body - **name** (string) - Required - Display name shown in the dashboard and invoice details - **type** (string) - Required - `percentage` or `fixed` - **cadence** (string) - Required - `once`, `repeated`, or `forever` - **percentage_off** (decimal string) - When `type=percentage` - Discount as a percent, e.g. "15.00" for 15% - **amount_off** (decimal string) - When `type=fixed` - Flat discount amount, e.g. "50.00" - **currency** (string) - When `type=fixed` - ISO currency code, e.g. "USD" - **duration_in_periods** (int) - When `cadence=repeated` - Number of billing cycles the discount applies. Must not be set for other cadences. - **coupon_code** (string) - Optional - Human-readable code customers can enter to redeem (e.g. "SUMMER15"). Auto-generated if omitted. - **redeem_after** (timestamp) - Optional - Earliest time a new association can be created - **redeem_before** (timestamp) - Optional - Expiry. New associations cannot be created after this time. - **max_redemptions** (int) - Optional - Cap on total associations across all subscriptions - **metadata** (object) - Optional - Key-value pairs for your own tracking ### Request Example ```json { "name": "Summer Sale", "type": "percentage", "percentage_off": "15.00", "cadence": "once", "coupon_code": "SUMMER15", "redeem_after": "2025-07-01T00:00:00Z", "redeem_before": "2025-08-31T23:59:59Z", "max_redemptions": 1000 } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the coupon - **name** (string) - Display name of the coupon - **type** (string) - Type of discount (`percentage` or `fixed`) - **percentage_off** (decimal string) - Percentage discount value - **amount_off** (decimal string) - Fixed amount discount value - **currency** (string) - Currency for fixed amount discounts - **cadence** (string) - Discount application frequency (`once`, `repeated`, or `forever`) - **duration_in_periods** (int) - Duration in billing cycles for repeated discounts - **coupon_code** (string) - The coupon code - **redeem_after** (timestamp) - The earliest redemption time - **redeem_before** (timestamp) - The expiry time - **max_redemptions** (int) - Maximum number of redemptions allowed - **total_redemptions** (int) - Current number of redemptions - **status** (string) - Current status of the coupon (`active`, `expired`, etc.) #### Response Example ```json { "id": "coup_01abc123", "name": "Summer Sale", "type": "percentage", "percentage_off": "15.00", "cadence": "once", "coupon_code": "SUMMER15", "redeem_after": "2025-07-01T00:00:00Z", "redeem_before": "2025-08-31T23:59:59Z", "max_redemptions": 1000, "total_redemptions": 0, "status": "active" } ``` ``` -------------------------------- ### Data Transfer Event Example Source: https://docs.flexprice.io/docs/product-catalogue/features/aggregation/sum An example of an event payload for tracking data transfer usage, where the 'gb' property will be summed. ```json { "event_name": "data.transfer", "external_customer_id": "acme_corp", "properties": { "gb": 2.5 } } ``` -------------------------------- ### Available Scripts: Development and Quality Source: https://docs.flexprice.io/docs/contributing-guide/frontend-setup Common npm scripts for development tasks like starting the server, building, previewing, linting, and formatting. ```bash # Development npm run dev # Start development server npm run build # Build for production npm run preview # Preview production build # Code Quality npm run lint # Run ESLint npm run lint:fix # Fix ESLint errors npm run format # Format with Prettier ``` -------------------------------- ### Run Flexprice Bento Collector with Docker Source: https://docs.flexprice.io/docs/collectors/get-started Execute the collector container, mounting the configuration file and providing necessary environment variables for API key and Kafka brokers. Check logs for operational status. ```bash docker run -d \ --name bento-collector \ -e FLEXPRICE_API_KEY=fp_live_xxxxx \ -e KAFKA_BROKERS=broker:9092 \ -v $(pwd)/config.yaml:/bento.yaml:ro \ ghcr.io/flexprice/bento-collector:latest \ -c /bento.yaml ``` -------------------------------- ### Invoice Number Generation Examples Source: https://docs.flexprice.io/docs/settings/settings Examples of invoice number generation based on different configuration settings for prefix, format, separator, and suffix length. ```text Configuration: prefix: "INV", format: "YYYYMM", separator: "-", suffix_length: 5. Generated: INV-202501-00001, INV-202501-00002. ``` ```text Configuration: prefix: "INV", format: "YYYYMM", separator: "", suffix_length: 5. Generated: INV20250100001, INV20250100002. ``` -------------------------------- ### Implement Automatic Tenant Filtering in Go Repository Source: https://docs.flexprice.io/docs/contributing-guide/architechture Shows how a concrete repository implementation automatically applies tenant and environment filters to database queries using context values. ```go func (r *PostgresRepository) GetCustomer(ctx context.Context, customerID string) (*Customer, error) { tenantID := ctx.Value(types.CtxTenantID).(string) environment := ctx.Value(types.CtxEnvironmentID).(string) return r.db.Customer. Query(). Where(customer.ID(customerID)). Where(customer.TenantID(tenantID)). Where(customer.Environment(environment)). Only(ctx) } ``` -------------------------------- ### Active Users Tracking Event Example Source: https://docs.flexprice.io/docs/product-catalogue/features/aggregation/count-unique An example of an event payload structured for tracking active users. Ensure the 'event_name' and 'properties.user_id' match your configuration. ```json { "event_name": "user.activity", "external_customer_id": "acme_corp", "properties": { "user_id": "user_12345" } } ``` -------------------------------- ### Run Flexprice Backend Without Docker Compose Source: https://docs.flexprice.io/docs/contributing-guide/backend-setup Start the required infrastructure services using Docker Compose and then run the Flexprice application locally using the go run command. ```bash # Start the required infrastructure docker compose up -d postgres kafka clickhouse temporal temporal-ui # Run the application locally go run cmd/server/main.go ``` -------------------------------- ### Create Subscription with Overridden Trial Days (0 Days) Source: https://docs.flexprice.io/docs/subscriptions/workflows/trialing Example of creating a subscription and setting `trial_period_days` to 0 to disable the trial period, making the subscription active immediately. ```APIDOC ## Create Subscription with Overridden Trial Days (0 Days) ### Description This endpoint allows you to create a new subscription. By passing `trial_period_days` with a value of 0, you can disable the trial period, causing the subscription to become active immediately upon creation. ### Method POST ### Endpoint https://api.flexprice.io/v1/subscriptions ### Parameters #### Request Body - **customer_id** (string) - Required - The ID of the customer. - **plan_id** (string) - Required - The ID of the plan. - **currency** (string) - Required - The currency for the subscription (e.g., USD). - **billing_cadence** (string) - Required - The billing cadence (e.g., RECURRING). - **billing_period** (string) - Required - The billing period (e.g., MONTHLY). - **billing_period_count** (integer) - Required - The number of billing periods. - **start_date** (string) - Required - The start date of the subscription in ISO 8601 format. - **trial_period_days** (integer) - Optional - Overrides the plan-level trial days. Set to 0 to disable the trial. ### Request Example ```json { "customer_id": "cust_01xyz", "plan_id": "plan_01abc", "currency": "USD", "billing_cadence": "RECURRING", "billing_period": "MONTHLY", "billing_period_count": 1, "start_date": "2025-05-01T00:00:00Z", "trial_period_days": 0 } ``` ### Response #### Success Response (200) (Response schema not provided in source) #### Response Example (Response example not provided in source) ```