Creating Charges and Invoices
Route partner-supplied charges through Hint’s pricing engine and collect invoices confidently.
Hint allows practices to define coverage plans that determine who pays for specific services (patient vs. employer vs. sponsor) and at what price. When your integration posts a charge, Hint immediately prices it, assigns it to the appropriate invoice, and returns the routing metadata so you know the next action to take.
flowchart LR
PartnerApp[Partner app] -->|POST charge| HintCharges["/api/provider/charges"]
HintCharges -->|Match charge item<br/>+ coverage plan| Pricing[Hint pricing engine]
Pricing -->|Patient invoice| PatientInv[Customer invoice]
Pricing -->|Sponsor invoice| SponsorInv[Employer invoice]
PatientInv -->|Issue + collect| Payments[customer_invoice_payments]
SponsorInv -->|Bill via sponsor cycle| EmployerBilling[Employer billing]
classDef node fill:#ffffff,stroke:#dc2626,stroke-width:1px,color:#0f172a,font-size:12px
class PartnerApp,HintCharges,Pricing,PatientInv,SponsorInv,Payments,EmployerBilling node
Charge items vs. categories
Practices configure Hint differently - some maintain a detailed library of charge items, others rely solely on categories. Align with each practice so you know whether to send explicit charge_item identifiers or just the category metadata.
- Charge items: match by Hint
idor by the customcodeyou provide. Browse the current catalog in Admin → Charges & Taxes in your sandbox or via List Charge Items. - Categories: when an item match is not possible, pass a category
type(e.g.,labs,office_visits,medications,vaccines,retail_items,fees). Accepted values are documented alongside the Create Charge endpoint.
Create a charge
POST the charge to Create Charge. Hint tries to match an existing charge item by code, applies coverage rules, and routes the line to the correct invoice. Example (no charge item ID, match by CPT code):
{
"charge_item": {
"name": "Initial Primary Care Visit",
"code": "99381",
"code_type": "CPT"
},
"price_in_cents": 3000,
"quantity": 1,
"category": {
"type": "office_visits"
},
"patient": {
"id": "pat-ab12C345DeF6"
}
}Monitor the response for customer_invoice or sponsor_invoice data so you know which invoice to issue or whether Hint will include the charge in a future sponsor billing run.
Charges created without a price
price_in_cents is optional on Create Charge. When you omit it, Hint uses the price of the matched charge item, or 0 if the item has no price. If no charge item visible to the practice matched, nobody chose that price, so the charge is returned with price_defaulted: true:
| You send | Matched charge item | price_defaulted |
|---|---|---|
No price_in_cents | Visible to the practice | false |
No price_in_cents | None, or one hidden from the practice | true |
A price, including 0 | Any | false |
To set the price of a charge on a customer invoice, send price_in_cents to Update Customer Invoice Charge while the invoice is in draft. Any price that is applied, including 0, changes price_defaulted to false. The practice can also set the price in Hint. For a charge on a sponsor invoice, the practice has to do it, since Update Customer Invoice Charge does not apply.
A charge with a coverage discount keeps its price: a different price_in_cents is ignored. While blocking (below) is on for the practice, sending a different price for a defaulted charge with a coverage discount returns 422 instead, saying the discount has to be removed first. The practice can remove it in Hint and then set the price, or you can delete the charge and create it again with price_in_cents.
Send price_in_cents: 0 when the service is free, so the charge is not marked as defaulted.
An invoice with a defaulted charge can be blocked from issuing. When this is turned on for the practice, Issue Customer Invoice returns 400 while any charge on the invoice has price_defaulted: true, and the invoice stays in draft:
{
"status": 400,
"code": "bad_request",
"message": "This invoice can't be issued because some of its charges were created without a price."
}The message does not name the charges. To find them, look for price_defaulted: true on the invoice's charges. Set their price as described above, then issue the invoice again. Sponsor invoices are blocked the same way: Hint leaves a blocked sponsor invoice in draft instead of issuing it on its scheduled date, and notifies the practice.
Release dependency: Blocking requires the API change tracked in DARK-4438. Publish this paragraph after that change is deployed.
Add a charge to a specific patient invoice
If your integration already creates a draft customer invoice, add the line with
Create Customer Invoice Charge.
Both this endpoint and Update Customer Invoice Charge
accept a standard category type, so you do not need to maintain a different
category ID for every practice:
{
"name": "Medication",
"quantity": 1,
"price_in_cents": 12345,
"patient": { "id": "pat-ab12C345DeF6" },
"category": { "type": "medications" }
}Category types match case-insensitively within the authenticated practice.
For custom categories, send category.id instead. If both are supplied, the ID
takes precedence and the type is ignored. An unknown ID returns 404 without
falling back to the type. The global Create Charge endpoint uses the same category
selection rules. An unknown type or a standard type missing from the practice
returns 422. Existing invoice and reporting-period edit restrictions still
apply; a category change in a locked reporting period is ignored.
This adds the charge to the invoice you specify. Use the global Create Charge
endpoint described above when you want Hint to determine invoice routing.
Release dependency: This category-type support requires the API change tracked
in PLAT-2775. Publish this section after
that change is deployed.
How a location is assigned
Both customer invoices and individual charges carry a location. Hint resolves it with a simple precedence, plus one rule about timing that is easy to miss. Getting this right matters if you segment billed revenue by location.
Precedence when a record is created
- A
locationyou send is always used. Pass alocationobject (byid) to set it explicitly. - A charge with no
locationinherits its invoice's location. If the invoice has no location, the charge falls back to its patient's assigned location. - An invoice with no
locationyou send defaults to the payer's location - the assigned location on the patient who pays the bill (theownerif you send one, otherwise the patient's linked payer, otherwise the patient).
So the reliable way to keep every line on one location is to set it on the invoice when you create it. Charges added afterward inherit it, and the patient-profile fallback never gets a chance to assign the wrong one.
Timing matters: updating an invoice's location overwrites its charges
When you change a customer invoice's location, Hint re-applies that location to every charge already on the invoice, replacing any location previously set on those charges. The most recent invoice-location update always wins. Adding a new charge afterward does not re-trigger this, so order your calls accordingly:
- To give every line the same location, set it on the invoice (or update it) - the charges follow automatically.
- To keep per-charge locations that differ from the invoice, set them on the charges after any invoice-location change, and avoid changing the invoice location afterward (it would overwrite them).
For example: create an invoice for location "Longevity", add a charge with no location (it inherits "Longevity"), then update the invoice to "Main Clinic" - the charge is now "Main Clinic", not "Longevity".
Issue invoices and collect payment
Issuing an invoice does not schedule or collect payment, even for a patient on autopay. Hint collects membership invoices automatically for patients on autopay, but your integration decides whether to collect an invoice it creates:
- After adding all charges, issue the customer invoice referenced in the charge response. If it returns
400because a charge was created without a price, see Charges created without a price. - If your workflow should respect the patient's autopay preference, retrieve the invoice owner and check
autopay. The owner is the patient who pays the invoice, which can differ from the patient on the charge. Creating a payment does not check this setting, so skip the next step whenautopayisfalse. - Create a payment to charge the saved payment method or log an external collection.
To fix or remove a charge after this point, or to void or refund the invoice, see Correcting, Refunding, and Voiding Invoices.
Email the invoice to the patient
Invoices you create through the API are not emailed automatically. To send the invoice to the patient (the same email a provider can send from the invoice screen in Hint), call email the customer invoice. This is typically done once the invoice is issued or payment has been processed.
The email is sent to the invoice owner's profile email. If it cannot be delivered (for example, the owner has no email address on file, the address is invalid, or a previous message bounced), the endpoint returns a 422 with a descriptive message so your integration can surface or retry it.
Sponsor invoices (employer billing) follow the employer's cadence automatically - no extra calls are needed from your integration unless you are surfacing status back to the employer.
Record an invoice you sent yourself
If your integration delivers the invoice in its own email or message, call mark the customer invoice as sent after your message goes out. Hint records the send and emails nothing. An issued invoice moves to sent; a sent invoice stays sent.
Pass the time your message went out as sent_at, an ISO 8601 date-time with a timezone offset:
{
"sent_at": "2026-11-02T21:30:00Z"
}last_sent_at keeps the latest send, so an earlier or equal sent_at returns 200 without changing it. Omit sent_at (do not send null) to record the send at the time of the request. When you retry a request for the same message, send the same sent_at so the retry does not record a later send.
The endpoint returns 422 when the invoice is not issued or sent, or when sent_at is null, empty, not a date-time, or more than a minute ahead of Hint's clock.
Updated 3 days ago

