v1

latestOpenAPI 3.1.02026-07-228956435.8 KB
Invoices

Add invoice lines

Appends one or more line items to a draft invoice and recalculates the invoice total. The invoice must be in draft status and every line item must use the invoice currency. If any line item is invalid, the whole request fails and no line item is added.

post/invoices/{id}/add_lines

Path parameters

idstring required

The id of the invoice to add line items to.

Request body

Example request

{
  "lines": [
    {
      "amount": 30000,
      "currency": "CLP",
      "period_end": "2026-06-01T00:00:00Z",
      "period_start": "2026-05-01T00:00:00Z",
      "quantity": 1,
      "name": "Premium Plan",
      "description": "A premium plan"
    }
  ]
}

Response

The updated invoice, including the new line items and the recalculated total.

idstring required

Unique identifier of the invoice.

hosted_invoice_urlstring nullable required

URL of the hosted invoice page, where your customer can view and pay the invoice. null for test mode invoices and for invoices that are not open.

object'invoice' required

Type of the object. Always invoice.

attempt_countinteger required

Number of automatic charge attempts Fintoc has made on the invoice. 0 until the invoice is finalized and charged for the first time.

created_atstring date-time required

ISO 8601 timestamp of when the invoice was created.

currency'CLP' | 'MXN' required

Currency of the invoice, as an ISO 4217 code. Every line item uses this currency.

customerstring required

id of the customer the invoice bills.

default_payment_methodstring nullable required

id of the payment method Fintoc charges when the invoice is finalized. null for invoices without one, such as subscription invoices.

metadataobject nullable required

Set of key-value pairs attached to the invoice. null when the invoice has no metadata.

mode'live' | 'test' required

Mode of the invoice. live invoices use real data; test invoices use fake data for integration testing. An API key only sees invoices that share its mode.

next_payment_attempt_atstring date-time nullable required

ISO 8601 timestamp of the next scheduled automatic charge attempt. null when no further attempt is scheduled.

status'draft' | 'open' | 'paid' | 'void' required

Status of the invoice. Invoices start as draft, become open when finalized, and end as paid or void.

subscriptionstring nullable required

id of the subscription that generated the invoice. null for invoices not tied to a subscription.

totalinteger required

Total amount of the invoice, in the smallest unit of currency (for example, 30000 for $30000 CLP, since CLP has no minor unit, or 3000 for $30.00 MXN). Equals the sum of the line item amounts.

Example response

{
  "id": "inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe",
  "hosted_invoice_url": "https://acme.billing.fintoc.com/invoices/inv_2bVdWxLpzXq8RkNcM3JtUv9AhTe",
  "attempt_count": 1,
  "created_at": "2026-05-01T12:00:00Z",
  "currency": "CLP",
  "customer": "cus_2bVdWyTnGq4PfLs7DkXjRm0CwIo",
  "default_payment_method": "pm_2c4mDhAbCdEfGhIjKlMnOpQrStu",
  "lines": [
    {
      "id": "il_2bVdX0PqJs6RhNu9FmZlTo2EyKq",
      "amount": 30000,
      "currency": "CLP",
      "description": "A premium plan",
      "name": "Premium Plan",
      "period_end": "2026-06-01T00:00:00Z",
      "period_start": "2026-05-01T00:00:00Z",
      "quantity": 1
    }
  ],
  "mode": "live",
  "next_payment_attempt_at": "2026-05-02T12:00:00Z",
  "payments": [
    {
      "amount": 30000,
      "currency": "CLP",
      "payment_intent": "pi_2bVdX2RsLu8TjPwBHoBnVq4G0Ms",
      "status": "succeeded"
    }
  ],
  "status": "draft",
  "subscription": "sub_2bVdWzKfHr5QgMt8ElYkSn1DxJp",
  "total": 30000
}