curl --request POST \
--url https://us.api.flexprice.io/v1/invoices/preview \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"subscription_id": "<string>",
"hide_zero_charges_line_items": false,
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z"
}
'{
"adjustment_amount": "<string>",
"amount_due": "<string>",
"amount_paid": "<string>",
"amount_remaining": "<string>",
"billing_period": "<string>",
"billing_reason": "<string>",
"billing_sequence": 123,
"coupon_applications": [
{
"applied_at": "2023-11-07T05:31:56Z",
"coupon_association_id": "<string>",
"coupon_id": "<string>",
"coupon_snapshot": {},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"discount_percentage": "<string>",
"discounted_amount": "<string>",
"environment_id": "<string>",
"final_price": "<string>",
"id": "<string>",
"invoice_id": "<string>",
"invoice_line_item_id": "<string>",
"metadata": {},
"original_price": "<string>",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer": {
"address_city": "<string>",
"address_country": "<string>",
"address_line1": "<string>",
"address_line2": "<string>",
"address_postal_code": "<string>",
"address_state": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"email": "<string>",
"environment_id": "<string>",
"external_id": "<string>",
"id": "<string>",
"integrations": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"provider_entity_id": "<string>",
"provider_type": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"customer_id": "<string>",
"description": "<string>",
"due_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"finalized_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"idempotency_key": "<string>",
"invoice_number": "<string>",
"invoice_pdf_url": "<string>",
"last_computed_at": "2023-11-07T05:31:56Z",
"line_items": [
{
"amount": "<string>",
"commitment_info": {
"amount": "<string>",
"computed_commitment_utilized_amount": "<string>",
"computed_overage_amount": "<string>",
"computed_true_up_amount": "<string>",
"is_windowed": true,
"overage_factor": "<string>",
"quantity": "<string>",
"true_up_enabled": true
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"entity_id": "<string>",
"entity_type": "<string>",
"environment_id": "<string>",
"id": "<string>",
"invoice_id": "<string>",
"invoice_level_discount": "<string>",
"line_item_discount": "<string>",
"metadata": {},
"meter_display_name": "<string>",
"meter_id": "<string>",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"plan_display_name": "<string>",
"prepaid_credits_applied": "<string>",
"price_id": "<string>",
"price_type": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_analytics": [
{
"cost": "<string>",
"event_count": 123,
"percentage": "<string>",
"source": "<string>",
"usage": "<string>"
}
],
"usage_breakdown": [
{
"cost": "<string>",
"event_count": 123,
"grouped_by": {},
"percentage": "<string>",
"usage": "<string>"
}
]
}
],
"metadata": {},
"overpaid_amount": "<string>",
"paid_at": "2023-11-07T05:31:56Z",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"recalculated_invoice_id": "<string>",
"refunded_amount": "<string>",
"subscription": {
"active_pause_id": "<string>",
"auto_invoice_threshold": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_period_count": 123,
"cancel_at": "2023-11-07T05:31:56Z",
"cancel_at_period_end": true,
"cancelled_at": "2023-11-07T05:31:56Z",
"collection_method": "<string>",
"commitment_amount": "<string>",
"coupon_associations": [
{
"coupon": {
"amount_off": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"duration_in_periods": 123,
"environment_id": "<string>",
"id": "<string>",
"max_redemptions": 123,
"metadata": {},
"name": "<string>",
"percentage_off": "<string>",
"redeem_after": "<string>",
"redeem_before": "<string>",
"rules": {},
"tenant_id": "<string>",
"total_redemptions": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"coupon_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_line_item_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"currency": "<string>",
"current_period_end": "2023-11-07T05:31:56Z",
"current_period_start": "2023-11-07T05:31:56Z",
"customer": {
"address_city": "<string>",
"address_country": "<string>",
"address_line1": "<string>",
"address_line2": "<string>",
"address_postal_code": "<string>",
"address_state": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"email": "<string>",
"environment_id": "<string>",
"external_id": "<string>",
"id": "<string>",
"integrations": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"provider_entity_id": "<string>",
"provider_type": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"customer_id": "<string>",
"customer_timezone": "<string>",
"enable_true_up": true,
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"gateway_payment_method_id": "<string>",
"id": "<string>",
"invoicing_customer_id": "<string>",
"latest_invoice": "<unknown>",
"line_items": [
{
"addon_association_id": "<string>",
"billing_period_count": 123,
"commitment_amount": "<string>",
"commitment_overage_factor": "<string>",
"commitment_quantity": "<string>",
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"meter_display_name": "<string>",
"meter_id": "<string>",
"plan_display_name": "<string>",
"price": {
"amount": "<string>",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"price_unit": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"lookup_key": "<string>",
"metadata": {},
"overage_factor": "<string>",
"parent_subscription_id": "<string>",
"pauses": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"original_period_end": "2023-11-07T05:31:56Z",
"original_period_start": "2023-11-07T05:31:56Z",
"pause_end": "2023-11-07T05:31:56Z",
"pause_start": "2023-11-07T05:31:56Z",
"reason": "<string>",
"resumed_at": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"payment_behavior": "<string>",
"phases": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": [
{
"addon": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": [
{
"addon": "<unknown>",
"amount": "<string>",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"plan": "<unknown>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"pricing_unit": {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"display_order": 123,
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": 123
},
"info": {
"threshold": 123
},
"warning": {
"threshold": 123
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"feature_id": "<string>",
"id": "<string>",
"is_enabled": true,
"is_soft_limit": true,
"parent_entitlement_id": "<string>",
"plan": "<unknown>",
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"static_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_limit": 123
}
],
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": [
{
"addon": "<unknown>",
"amount": "<string>",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"plan": "<unknown>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"pricing_unit": {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"trial_end": "2023-11-07T05:31:56Z",
"trial_start": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"version": 123
},
"subscription_customer_id": "<string>",
"subscription_id": "<string>",
"subtotal": "<string>",
"taxes": [
{
"applied_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"tax_amount": "<string>",
"tax_association_id": "<string>",
"tax_rate": {
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"fixed_value": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"percentage_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"tax_rate_id": "<string>",
"taxable_amount": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"tenant_id": "<string>",
"total": "<string>",
"total_discount": "<string>",
"total_prepaid_credits_applied": "<string>",
"total_tax": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"version": 123,
"voided_at": "2023-11-07T05:31:56Z"
}Get invoice preview
Use when showing a customer what they will be charged (e.g. preview before checkout or plan change). No invoice is created.
curl --request POST \
--url https://us.api.flexprice.io/v1/invoices/preview \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"subscription_id": "<string>",
"hide_zero_charges_line_items": false,
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z"
}
'{
"adjustment_amount": "<string>",
"amount_due": "<string>",
"amount_paid": "<string>",
"amount_remaining": "<string>",
"billing_period": "<string>",
"billing_reason": "<string>",
"billing_sequence": 123,
"coupon_applications": [
{
"applied_at": "2023-11-07T05:31:56Z",
"coupon_association_id": "<string>",
"coupon_id": "<string>",
"coupon_snapshot": {},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"discount_percentage": "<string>",
"discounted_amount": "<string>",
"environment_id": "<string>",
"final_price": "<string>",
"id": "<string>",
"invoice_id": "<string>",
"invoice_line_item_id": "<string>",
"metadata": {},
"original_price": "<string>",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer": {
"address_city": "<string>",
"address_country": "<string>",
"address_line1": "<string>",
"address_line2": "<string>",
"address_postal_code": "<string>",
"address_state": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"email": "<string>",
"environment_id": "<string>",
"external_id": "<string>",
"id": "<string>",
"integrations": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"provider_entity_id": "<string>",
"provider_type": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"customer_id": "<string>",
"description": "<string>",
"due_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"finalized_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"idempotency_key": "<string>",
"invoice_number": "<string>",
"invoice_pdf_url": "<string>",
"last_computed_at": "2023-11-07T05:31:56Z",
"line_items": [
{
"amount": "<string>",
"commitment_info": {
"amount": "<string>",
"computed_commitment_utilized_amount": "<string>",
"computed_overage_amount": "<string>",
"computed_true_up_amount": "<string>",
"is_windowed": true,
"overage_factor": "<string>",
"quantity": "<string>",
"true_up_enabled": true
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"entity_id": "<string>",
"entity_type": "<string>",
"environment_id": "<string>",
"id": "<string>",
"invoice_id": "<string>",
"invoice_level_discount": "<string>",
"line_item_discount": "<string>",
"metadata": {},
"meter_display_name": "<string>",
"meter_id": "<string>",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"plan_display_name": "<string>",
"prepaid_credits_applied": "<string>",
"price_id": "<string>",
"price_type": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_analytics": [
{
"cost": "<string>",
"event_count": 123,
"percentage": "<string>",
"source": "<string>",
"usage": "<string>"
}
],
"usage_breakdown": [
{
"cost": "<string>",
"event_count": 123,
"grouped_by": {},
"percentage": "<string>",
"usage": "<string>"
}
]
}
],
"metadata": {},
"overpaid_amount": "<string>",
"paid_at": "2023-11-07T05:31:56Z",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"recalculated_invoice_id": "<string>",
"refunded_amount": "<string>",
"subscription": {
"active_pause_id": "<string>",
"auto_invoice_threshold": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_period_count": 123,
"cancel_at": "2023-11-07T05:31:56Z",
"cancel_at_period_end": true,
"cancelled_at": "2023-11-07T05:31:56Z",
"collection_method": "<string>",
"commitment_amount": "<string>",
"coupon_associations": [
{
"coupon": {
"amount_off": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"duration_in_periods": 123,
"environment_id": "<string>",
"id": "<string>",
"max_redemptions": 123,
"metadata": {},
"name": "<string>",
"percentage_off": "<string>",
"redeem_after": "<string>",
"redeem_before": "<string>",
"rules": {},
"tenant_id": "<string>",
"total_redemptions": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"coupon_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_line_item_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"currency": "<string>",
"current_period_end": "2023-11-07T05:31:56Z",
"current_period_start": "2023-11-07T05:31:56Z",
"customer": {
"address_city": "<string>",
"address_country": "<string>",
"address_line1": "<string>",
"address_line2": "<string>",
"address_postal_code": "<string>",
"address_state": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"email": "<string>",
"environment_id": "<string>",
"external_id": "<string>",
"id": "<string>",
"integrations": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"provider_entity_id": "<string>",
"provider_type": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"customer_id": "<string>",
"customer_timezone": "<string>",
"enable_true_up": true,
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"gateway_payment_method_id": "<string>",
"id": "<string>",
"invoicing_customer_id": "<string>",
"latest_invoice": "<unknown>",
"line_items": [
{
"addon_association_id": "<string>",
"billing_period_count": 123,
"commitment_amount": "<string>",
"commitment_overage_factor": "<string>",
"commitment_quantity": "<string>",
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"meter_display_name": "<string>",
"meter_id": "<string>",
"plan_display_name": "<string>",
"price": {
"amount": "<string>",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"price_unit": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"lookup_key": "<string>",
"metadata": {},
"overage_factor": "<string>",
"parent_subscription_id": "<string>",
"pauses": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"original_period_end": "2023-11-07T05:31:56Z",
"original_period_start": "2023-11-07T05:31:56Z",
"pause_end": "2023-11-07T05:31:56Z",
"pause_start": "2023-11-07T05:31:56Z",
"reason": "<string>",
"resumed_at": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"payment_behavior": "<string>",
"phases": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": [
{
"addon": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": [
{
"addon": "<unknown>",
"amount": "<string>",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"plan": "<unknown>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"pricing_unit": {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"display_order": 123,
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": 123
},
"info": {
"threshold": 123
},
"warning": {
"threshold": 123
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"feature_id": "<string>",
"id": "<string>",
"is_enabled": true,
"is_soft_limit": true,
"parent_entitlement_id": "<string>",
"plan": "<unknown>",
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"static_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_limit": 123
}
],
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": [
{
"addon": "<unknown>",
"amount": "<string>",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"plan": "<unknown>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"pricing_unit": {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"trial_end": "2023-11-07T05:31:56Z",
"trial_start": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"version": 123
},
"subscription_customer_id": "<string>",
"subscription_id": "<string>",
"subtotal": "<string>",
"taxes": [
{
"applied_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"tax_amount": "<string>",
"tax_association_id": "<string>",
"tax_rate": {
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"fixed_value": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"percentage_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"tax_rate_id": "<string>",
"taxable_amount": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"tenant_id": "<string>",
"total": "<string>",
"total_discount": "<string>",
"total_prepaid_credits_applied": "<string>",
"total_tax": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"version": 123,
"voided_at": "2023-11-07T05:31:56Z"
}Documentation Index
Fetch the complete documentation index at: https://docs.flexprice.io/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
Enter your API key in the format x-api-key <api-key>*
Body
Preview Invoice Request
subscription_id is the unique identifier of the subscription to preview invoice for
hide_zero_charges_line_items indicates whether to hide line items with zero cost
period_end is the optional end date of the period to preview
period_start is the optional start date of the period to preview
Response
OK
adjustment_amount is the total sum of credit notes of type "adjustment". These are non-cash reductions applied to the invoice (e.g. goodwill credit, billing correction).
amount_due is the total amount that needs to be paid for this invoice
amount_paid is the amount that has already been paid towards this invoice
amount_remaining is the outstanding amount still owed on this invoice (calculated as amount_due minus amount_paid)
billing_period describes the billing period this invoice covers (e.g., "January 2024", "Q1 2024")
billing_reason indicates why this invoice was generated (e.g., "subscription_billing", "manual_charge")
billing_sequence is the sequential number indicating the billing cycle for subscription invoices
coupon_applications contains the coupon applications associated with this invoice (overrides embedded field)
Show child attributes
Show child attributes
currency is the three-letter ISO currency code (e.g., USD, EUR, GBP) that applies to all monetary amounts on this invoice
Customer response object containing all customer information
Show child attributes
Show child attributes
customer_id is the ID of the customer who will receive this invoice
description is an optional description or notes about this invoice
due_date is the date when payment for this invoice is due
environment_id is the ID of the environment this invoice belongs to (for multi-environment setups)
finalized_at is the timestamp when this invoice was finalized and made ready for payment
id is the unique identifier for this invoice
idempotency_key is a unique key used to prevent duplicate invoice creation when retrying API calls
invoice_number is the human-readable invoice number displayed to customers (e.g., INV-2024-001)
invoice_pdf_url is the URL where customers can download the PDF version of this invoice
DRAFT, FINALIZED, VOIDED, SKIPPED SUBSCRIPTION, ONE_OFF, CREDIT last_computed_at is the timestamp when this invoice was last computed by ComputeInvoice
line_items contains the individual items that make up this invoice (overrides embedded field)
Show child attributes
Show child attributes
Show child attributes
Show child attributes
overpaid_amount is the amount overpaid if payment_status is OVERPAID (amount_paid - total)
paid_at is the timestamp when this invoice was fully paid
INITIATED, PENDING, PROCESSING, SUCCEEDED, OVERPAID, FAILED, REFUNDED, PARTIALLY_REFUNDED period_end is the end date of the billing period covered by this invoice
period_start is the start date of the billing period covered by this invoice
recalculated_invoice_id is the ID of the replacement invoice created when this invoice was voided and recalculated. When set, it forms a parent→child link from this (voided) invoice to the new replacement invoice.
refunded_amount is the total sum of credit notes of type "refund". These are actual refunds issued to the customer.
published, deleted, archived Show child attributes
Show child attributes
subscription_customer_id is the subscription owner's customer ID (Subscription.CustomerID). It may differ from customer_id when the subscription uses an invoicing customer. Set internally; nullable in DB.
subscription_id is the ID of the subscription this invoice is associated with (only present for subscription-based invoices)
subtotal is the sum of all line items before any taxes, discounts, or additional fees
tax_applied_records contains the tax applied records associated with this invoice
Show child attributes
Show child attributes
total is the final amount including taxes, fees, and discounts
total_discount is the sum of all coupon discounts applied to the invoice
total_prepaid_credits_applied is the total amount of prepaid credits applied to this invoice.
total_tax is the sum of all taxes combined at the invoice level.
version is the version number for tracking changes to this invoice
voided_at is the timestamp when this invoice was voided or cancelled

