Get to your first invoice
By the end of this tutorial you will have a finalized invoice in your sandbox. You’ll build the complete billing setup from scratch — meter, product, pricing plan, customer, subscription, and usage event — using the API.
What you’ll need:
- A Solvimon sandbox API key — see Send your first API request
- A billing entity configured under Settings → Billing entities in Desk
curlor any HTTP client
Overview
Solvimon’s primitives have a dependency order. You need each piece before you can create the next:
Step 1: Create a meter and meter value
A meter defines what usage you’re tracking. A meter value is the unit being measured — in this case, a count of API calls.
Create the meter value
A meter value is the specific unit being tracked within a meter. Here we’re counting calls as a NUMBER type.
Response:
Create the meter
Response:
📘 Via Desk: Usage metering → Meters → New meter. You can create the meter value inline during meter setup.
Step 2: Create a meter value calculation
The meter value calculation ties your meter and meter value together with an aggregation method. Here we use SUM to total all API calls within a billing period.
Response:
Use the id or reference of this calculation when creating the product item in Step 3.
Step 3: Create a product category, product, and product item
Products define what you sell. The product item is what appears as a line item on invoices. For usage-based billing, the product item links to your meter value calculation.
Create a product category
Create a product
Create a product item
The product item links the product to the meter value calculation. Set model_type to USAGE_BASED.
Then activate the product and product item:
📘 Via Desk: Products & plans → Product catalog → New product. You can create the category, product, and item from one screen and set the meter link inline.
Step 4: Create a pricing plan
A pricing plan defines the price per unit and the billing period. Pricing plans are versioned — you create the plan, then create a version with the billing configuration and product pricing.
📘 Via Desk: Products & plans → Pricing plans → New pricing plan. Desk provides a guided editor for setting up versions and pricing rules, which is recommended for your first plan. Once you’re familiar with the structure, use the Pricing Plans API reference for automation.
To create a plan via API: create the plan with POST /v1/pricing-plans, then create a version with POST /v1/pricing-plan-versions and add a pricing entry with POST /v1/pricings linking your product item and setting the per-unit price. Activate the version once configured.
Note the reference of your pricing plan — you’ll need it when creating the subscription.
Step 5: Create and activate a customer
A customer starts in DRAFT. Activate them before creating a subscription:
📘 Via Desk: Customers → New customer.
Step 6: Create a subscription
The /init endpoint creates the subscription and its first schedule in a single call. This is the recommended way to start a subscription.
Key fields:
billing_time: "EXACT"— invoices are generated on the same day of the month asstart_at. If the subscription starts on the 1st, invoices are always on the 1st.billing_entity_reference— the billing entity issuing the invoices. Configure one under Settings → Billing entities if you haven’t already.- Omitting
first_paymentandpayment_methodmeans invoices are generated but not auto-charged. Add those fields when you’re ready to connect a payment provider.
📘 Via Desk: Customers → select customer → Subscriptions → New subscription.
Step 7: Send a usage event
Once the subscription is active, start reporting usage. Send one event per billable action — don’t pre-aggregate.
Key fields:
reference— a unique ID for this event. If you send the same reference twice, the second event is deduplicated. Use your internal request ID or transaction ID.timestamp— when the usage occurred. Defaults to the current time if omitted.meter_values[].number— the quantity. For a COUNT meter tracking individual calls, this is"1"per event.
A 200 response means the event was accepted. Events are matched to the subscription based on the customer_reference and the meter linked to the subscription’s product item.
📘 Via Desk: You can manually create events under Usage metering → Events → New event. Use this for backfills or testing.
Step 8: View the draft invoice
Solvimon generates a draft invoice for the current billing period. Check it via the invoices endpoint:
Response (trimmed):
The invoice stays in DRAFT until the billing period ends (or the grace period expires). During this time, new usage events continue to be added to it.
📘 Via Desk: Invoicing → Invoices. You can preview the draft invoice and see the individual line items.
What happens next
At the end of the billing period, Solvimon automatically moves the invoice from DRAFT to FINAL. When that happens:
- A
invoice.finalizedwebhook fires (if you’ve configured webhooks) - The invoice is locked and no further usage is added to it
- If a payment method is on the subscription, the charge is attempted automatically
To set up payment collection, see Bill your first B2C customer.
Next steps
- Bill your first B2C customer — add payment collection via Adyen or Stripe
- Webhooks — receive real-time notifications when invoices finalize and payments complete
- Local development setup — receive webhooks on localhost during development