Create a one-off invoice
curl --request POST \
--url https://core.nozle.app/api/v1/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"invoice": {
"external_customer_id": "hooli_1234",
"billing_entity_code": "default",
"currency": "EUR",
"fees": [
{
"add_on_code": "setup_fee",
"invoice_display_name": "Setup Fee (SF1)",
"unit_amount_cents": 12000,
"units": "2.5",
"description": "The description of the fee line item in the invoice. By default, the description of the add-on is used.",
"from_datetime": "2022-08-08T00:00:00Z",
"to_datetime": "2022-08-08T00:00:00Z",
"tax_codes": [
"french_standard_vat"
],
"skip_psp": true
}
],
"invoice_custom_section": {
"skip_invoice_custom_sections": false,
"invoice_custom_section_codes": [
"eu_bank_details"
]
},
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
}
'import requests
url = "https://core.nozle.app/api/v1/invoices"
payload = { "invoice": {
"external_customer_id": "hooli_1234",
"billing_entity_code": "default",
"currency": "EUR",
"fees": [
{
"add_on_code": "setup_fee",
"invoice_display_name": "Setup Fee (SF1)",
"unit_amount_cents": 12000,
"units": "2.5",
"description": "The description of the fee line item in the invoice. By default, the description of the add-on is used.",
"from_datetime": "2022-08-08T00:00:00Z",
"to_datetime": "2022-08-08T00:00:00Z",
"tax_codes": ["french_standard_vat"],
"skip_psp": True
}
],
"invoice_custom_section": {
"skip_invoice_custom_sections": False,
"invoice_custom_section_codes": ["eu_bank_details"]
},
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
invoice: {
external_customer_id: 'hooli_1234',
billing_entity_code: 'default',
currency: 'EUR',
fees: [
{
add_on_code: 'setup_fee',
invoice_display_name: 'Setup Fee (SF1)',
unit_amount_cents: 12000,
units: '2.5',
description: 'The description of the fee line item in the invoice. By default, the description of the add-on is used.',
from_datetime: '2022-08-08T00:00:00Z',
to_datetime: '2022-08-08T00:00:00Z',
tax_codes: ['french_standard_vat'],
skip_psp: true
}
],
invoice_custom_section: {
skip_invoice_custom_sections: false,
invoice_custom_section_codes: ['eu_bank_details']
},
payment_method: {
payment_method_type: 'provider',
payment_method_id: '1a901a90-1a90-1a90-1a90-1a901a901a90'
}
}
})
};
fetch('https://core.nozle.app/api/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://core.nozle.app/api/v1/invoices"
payload := strings.NewReader("{\n \"invoice\": {\n \"external_customer_id\": \"hooli_1234\",\n \"billing_entity_code\": \"default\",\n \"currency\": \"EUR\",\n \"fees\": [\n {\n \"add_on_code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee (SF1)\",\n \"unit_amount_cents\": 12000,\n \"units\": \"2.5\",\n \"description\": \"The description of the fee line item in the invoice. By default, the description of the add-on is used.\",\n \"from_datetime\": \"2022-08-08T00:00:00Z\",\n \"to_datetime\": \"2022-08-08T00:00:00Z\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"skip_psp\": true\n }\n ],\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://core.nozle.app/api/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invoice\": {\n \"external_customer_id\": \"hooli_1234\",\n \"billing_entity_code\": \"default\",\n \"currency\": \"EUR\",\n \"fees\": [\n {\n \"add_on_code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee (SF1)\",\n \"unit_amount_cents\": 12000,\n \"units\": \"2.5\",\n \"description\": \"The description of the fee line item in the invoice. By default, the description of the add-on is used.\",\n \"from_datetime\": \"2022-08-08T00:00:00Z\",\n \"to_datetime\": \"2022-08-08T00:00:00Z\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"skip_psp\": true\n }\n ],\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://core.nozle.app/api/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'invoice' => [
'external_customer_id' => 'hooli_1234',
'billing_entity_code' => 'default',
'currency' => 'EUR',
'fees' => [
[
'add_on_code' => 'setup_fee',
'invoice_display_name' => 'Setup Fee (SF1)',
'unit_amount_cents' => 12000,
'units' => '2.5',
'description' => 'The description of the fee line item in the invoice. By default, the description of the add-on is used.',
'from_datetime' => '2022-08-08T00:00:00Z',
'to_datetime' => '2022-08-08T00:00:00Z',
'tax_codes' => [
'french_standard_vat'
],
'skip_psp' => true
]
],
'invoice_custom_section' => [
'skip_invoice_custom_sections' => false,
'invoice_custom_section_codes' => [
'eu_bank_details'
]
],
'payment_method' => [
'payment_method_type' => 'provider',
'payment_method_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://core.nozle.app/api/v1/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"invoice\": {\n \"external_customer_id\": \"hooli_1234\",\n \"billing_entity_code\": \"default\",\n \"currency\": \"EUR\",\n \"fees\": [\n {\n \"add_on_code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee (SF1)\",\n \"unit_amount_cents\": 12000,\n \"units\": \"2.5\",\n \"description\": \"The description of the fee line item in the invoice. By default, the description of the add-on is used.\",\n \"from_datetime\": \"2022-08-08T00:00:00Z\",\n \"to_datetime\": \"2022-08-08T00:00:00Z\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"skip_psp\": true\n }\n ],\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}")
.asString();{
"invoice": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "acme_corp",
"number": "LAG-1234-001-002",
"issuing_date": "2022-04-30",
"invoice_type": "subscription",
"status": "finalized",
"payment_status": "succeeded",
"currency": "EUR",
"fees_amount_cents": 100,
"coupons_amount_cents": 10,
"credit_notes_amount_cents": 10,
"sub_total_excluding_taxes_amount_cents": 100,
"taxes_amount_cents": 20,
"sub_total_including_taxes_amount_cents": 120,
"prepaid_credit_amount_cents": 0,
"progressive_billing_credit_amount_cents": 0,
"total_amount_cents": 100,
"version_number": 3,
"created_at": "2022-04-29T08:59:51Z",
"updated_at": "2022-04-29T08:59:51Z",
"sequential_id": 2,
"payment_dispute_lost_at": "2022-09-14T16:35:31Z",
"payment_due_date": "2022-04-30",
"payment_overdue": true,
"net_payment_term": 30,
"prepaid_granted_credit_amount_cents": 0,
"prepaid_purchased_credit_amount_cents": 0,
"self_billed": false,
"file_url": "https://billing.example.com/invoices/example.pdf",
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"sequential_id": 1,
"slug": "LAG-1234-001",
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"applicable_timezone": "America/Los_Angeles",
"created_at": "2022-04-29T08:59:51Z",
"billing_entity_code": "acme_corp",
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"currency": "USD",
"email": "dinesh@piedpiper.test",
"legal_name": "Coleman-Blair",
"legal_number": "49-008-2965",
"logo_url": "http://hooli.com/logo.png",
"name": "Gavin Belson",
"firstname": "Gavin",
"lastname": "Belson",
"account_type": "customer",
"customer_type": "company",
"phone": "1-171-883-3711 x245",
"state": "CA",
"tax_identification_number": "EU123456789",
"timezone": "America/Los_Angeles",
"url": "http://hooli.com",
"zipcode": "91364",
"net_payment_term": 30,
"updated_at": "2022-04-29T08:59:51Z",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"billing_configuration": {
"invoice_grace_period": 3,
"subscription_invoice_issuing_date_anchor": "next_period_start",
"subscription_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "stripe",
"payment_provider_code": "stripe-eu-1",
"provider_customer_id": "cus_12345",
"sync": true,
"sync_with_provider": true,
"document_locale": "fr",
"provider_payment_methods": [
"card",
"sepa_debit",
"us_bank_account",
"bacs_debit",
"link",
"boleto",
"crypto",
"customer_balance"
]
},
"shipping_address": {
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"state": "CA",
"zipcode": "91364"
},
"metadata": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "Purchase Order",
"value": "123456789",
"display_in_invoice": true,
"created_at": "2022-04-29T08:59:51Z"
}
],
"integration_customers": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"type": "netsuite",
"integration_code": "netsuite-eu-1",
"external_customer_id": "cus_12345",
"sync_with_provider": true,
"subsidiary_id": "2",
"targeted_object": "contacts",
"email": "dinesh@piedpiper.test"
}
]
},
"metadata": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "digital_ref_id",
"value": "INV-0123456-98765",
"created_at": "2022-04-29T08:59:51Z"
}
],
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "TVA",
"tax_code": "french_standard_vat",
"tax_rate": 20,
"tax_description": "French standard VAT",
"amount_cents": 2000,
"amount_currency": "USD",
"created_at": "2022-09-14T16:35:31Z",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"fees_amount_cents": 20000
}
],
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "eu_bank_details",
"details": "Bank Name: Nozle Bank, IBAN: FR7630004000031234567890143",
"display_name": "Bank Details:",
"created_at": "2023-07-06T14:35:58Z"
}
],
"applied_usage_thresholds": [
{
"lifetime_usage_amount_cents": 2000,
"created_at": "2025-03-31T12:31:44Z",
"usage_threshold": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"threshold_display_name": "Threshold 1",
"amount_cents": 10000,
"recurring": true,
"created_at": "2023-06-27T19:43:42Z",
"updated_at": "2023-06-27T19:43:42Z"
}
}
],
"billing_periods": [
{
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "external_id",
"lago_plan_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"subscription_from_datetime": "2022-04-29T08:59:51Z",
"subscription_to_datetime": "2022-05-29T08:59:51Z",
"charges_from_datetime": "2022-04-29T08:59:51Z",
"charges_to_datetime": "2022-05-29T08:59:51Z",
"invoicing_reason": "subscription_starting"
}
],
"credits": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"amount_cents": 1200,
"amount_currency": "EUR",
"before_taxes": false,
"item": {
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"type": "coupon",
"code": "startup_deal",
"name": "Startup Deal"
},
"invoice": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"payment_status": "succeeded"
}
}
],
"fees": [
{
"amount_cents": 100,
"amount_currency": "EUR",
"taxes_amount_cents": 20,
"taxes_rate": 20,
"units": "0.32",
"precise_unit_amount": "312.5",
"total_aggregated_units": "0.32",
"total_amount_cents": 120,
"total_amount_currency": "EUR",
"pay_in_advance": true,
"invoiceable": true,
"payment_status": "pending",
"sub_total_excluding_taxes_amount_cents": 100,
"sub_total_excluding_taxes_precise_amount_cents": "100.0",
"item": {
"type": "subscription",
"code": "startup",
"name": "Startup",
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"item_type": "Subscription",
"description": "Startup",
"invoice_display_name": "Setup Fee (SF1)",
"filter_invoice_display_name": "AWS eu-east-1",
"filters": {},
"grouped_by": {}
},
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_filter_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_fixed_charge_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_parent_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "external_id",
"external_subscription_id": "external_id",
"precise_amount": "1.0001",
"precise_total_amount": "1.0212",
"taxes_precise_amount": "0.20123",
"events_count": 23,
"from_date": "2022-04-29T08:59:51Z",
"to_date": "2022-05-29T08:59:51Z",
"created_at": "2022-08-24T14:58:59Z",
"succeeded_at": "2022-08-24T14:58:59Z",
"failed_at": "2022-08-24T14:58:59Z",
"refunded_at": "2022-08-24T14:58:59Z",
"event_transaction_id": "transaction_1234567890",
"description": "Fee description",
"precise_coupons_amount_cents": "0.0",
"amount_details": {
"plan_amount_cents": 10000,
"graduated_ranges": [
{
"units": "10.0",
"from_value": 0,
"to_value": 10,
"flat_unit_amount": "1.0",
"per_unit_amount": "1.0",
"per_unit_total_amount": "10.0",
"total_with_flat_amount": "11.0"
}
],
"graduated_percentage_ranges": [
{
"units": "10.0",
"from_value": 0,
"to_value": 10,
"flat_unit_amount": "1.0",
"rate": "1.0",
"per_unit_total_amount": "10.0",
"total_with_flat_amount": "11.0"
}
],
"free_units": "10.0",
"paid_units": "40.0",
"per_package_size": 1000,
"per_package_unit_amount": "0.5",
"per_unit_total_amount": "10.0",
"units": "20.0",
"free_events": 10,
"rate": "1.0",
"paid_events": 20,
"fixed_fee_unit_amount": "1.0",
"fixed_fee_total_amount": "20.0",
"min_max_adjustment_total_amount": "20.0",
"per_unit_amount": "0.5",
"flat_unit_amount": "10.0"
},
"self_billed": false,
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "TVA",
"tax_code": "french_standard_vat",
"tax_rate": 20,
"tax_description": "French standard VAT",
"amount_cents": 2000,
"amount_currency": "USD",
"created_at": "2022-09-14T16:35:31Z",
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
],
"pricing_unit_details": {
"lago_pricing_unit_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"pricing_unit_code": "credits",
"short_name": "CR",
"amount_cents": 200,
"precise_amount_cents": "200.0",
"unit_amount_cents": 100,
"precise_unit_amount": "100.0",
"conversion_rate": "0.5"
},
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"subscriptions": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"billing_time": "anniversary",
"name": "Repository A",
"plan_code": "premium",
"status": "active",
"created_at": "2022-08-08T00:00:00Z",
"canceled_at": "2022-09-14T16:35:31Z",
"started_at": "2022-08-08T00:00:00Z",
"ending_at": "2022-10-08T00:00:00Z",
"subscription_at": "2022-08-08T00:00:00Z",
"terminated_at": "2022-09-14T16:35:31Z",
"previous_plan_code": null,
"next_plan_code": null,
"downgrade_plan_date": "2022-04-30",
"trial_ended_at": "2022-08-08T00:00:00Z",
"current_billing_period_started_at": "2022-08-08T00:00:00Z",
"current_billing_period_ending_at": "2022-09-08T00:00:00Z",
"on_termination_credit_note": "credit",
"on_termination_invoice": "generate",
"billing_entity_code": "default",
"plan_amount_cents": 10000,
"plan_amount_currency": "USD",
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z",
"invoice_custom_section": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "EU Bank Details",
"code": "eu_bank_details",
"description": "This section contains the bank details for EU customers.",
"details": "Bank Name: Nozle Bank, IBAN: FR7630004000031234567890143",
"display_name": "Bank Details:",
"applied_to_organization": true,
"organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z"
},
"invoice_custom_section_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
},
"consolidate_invoice": true,
"cancellation_reason": "payment_failed",
"activated_at": "2022-08-08T00:00:00Z",
"activation_rules": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"type": "payment",
"timeout_hours": 48,
"status": "pending",
"created_at": "2022-08-08T00:00:00Z",
"updated_at": "2022-08-08T00:00:00Z",
"expires_at": "2022-08-10T00:00:00Z"
}
]
}
],
"error_details": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"error_code": "tax_error",
"details": {
"tax_error": "taxDateTooFarInFuture"
}
}
]
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Invoices
Create a one-off invoice
This endpoint is used for issuing a one-off invoice.
POST
/
invoices
Create a one-off invoice
curl --request POST \
--url https://core.nozle.app/api/v1/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"invoice": {
"external_customer_id": "hooli_1234",
"billing_entity_code": "default",
"currency": "EUR",
"fees": [
{
"add_on_code": "setup_fee",
"invoice_display_name": "Setup Fee (SF1)",
"unit_amount_cents": 12000,
"units": "2.5",
"description": "The description of the fee line item in the invoice. By default, the description of the add-on is used.",
"from_datetime": "2022-08-08T00:00:00Z",
"to_datetime": "2022-08-08T00:00:00Z",
"tax_codes": [
"french_standard_vat"
],
"skip_psp": true
}
],
"invoice_custom_section": {
"skip_invoice_custom_sections": false,
"invoice_custom_section_codes": [
"eu_bank_details"
]
},
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
}
'import requests
url = "https://core.nozle.app/api/v1/invoices"
payload = { "invoice": {
"external_customer_id": "hooli_1234",
"billing_entity_code": "default",
"currency": "EUR",
"fees": [
{
"add_on_code": "setup_fee",
"invoice_display_name": "Setup Fee (SF1)",
"unit_amount_cents": 12000,
"units": "2.5",
"description": "The description of the fee line item in the invoice. By default, the description of the add-on is used.",
"from_datetime": "2022-08-08T00:00:00Z",
"to_datetime": "2022-08-08T00:00:00Z",
"tax_codes": ["french_standard_vat"],
"skip_psp": True
}
],
"invoice_custom_section": {
"skip_invoice_custom_sections": False,
"invoice_custom_section_codes": ["eu_bank_details"]
},
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
invoice: {
external_customer_id: 'hooli_1234',
billing_entity_code: 'default',
currency: 'EUR',
fees: [
{
add_on_code: 'setup_fee',
invoice_display_name: 'Setup Fee (SF1)',
unit_amount_cents: 12000,
units: '2.5',
description: 'The description of the fee line item in the invoice. By default, the description of the add-on is used.',
from_datetime: '2022-08-08T00:00:00Z',
to_datetime: '2022-08-08T00:00:00Z',
tax_codes: ['french_standard_vat'],
skip_psp: true
}
],
invoice_custom_section: {
skip_invoice_custom_sections: false,
invoice_custom_section_codes: ['eu_bank_details']
},
payment_method: {
payment_method_type: 'provider',
payment_method_id: '1a901a90-1a90-1a90-1a90-1a901a901a90'
}
}
})
};
fetch('https://core.nozle.app/api/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://core.nozle.app/api/v1/invoices"
payload := strings.NewReader("{\n \"invoice\": {\n \"external_customer_id\": \"hooli_1234\",\n \"billing_entity_code\": \"default\",\n \"currency\": \"EUR\",\n \"fees\": [\n {\n \"add_on_code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee (SF1)\",\n \"unit_amount_cents\": 12000,\n \"units\": \"2.5\",\n \"description\": \"The description of the fee line item in the invoice. By default, the description of the add-on is used.\",\n \"from_datetime\": \"2022-08-08T00:00:00Z\",\n \"to_datetime\": \"2022-08-08T00:00:00Z\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"skip_psp\": true\n }\n ],\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://core.nozle.app/api/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invoice\": {\n \"external_customer_id\": \"hooli_1234\",\n \"billing_entity_code\": \"default\",\n \"currency\": \"EUR\",\n \"fees\": [\n {\n \"add_on_code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee (SF1)\",\n \"unit_amount_cents\": 12000,\n \"units\": \"2.5\",\n \"description\": \"The description of the fee line item in the invoice. By default, the description of the add-on is used.\",\n \"from_datetime\": \"2022-08-08T00:00:00Z\",\n \"to_datetime\": \"2022-08-08T00:00:00Z\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"skip_psp\": true\n }\n ],\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://core.nozle.app/api/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'invoice' => [
'external_customer_id' => 'hooli_1234',
'billing_entity_code' => 'default',
'currency' => 'EUR',
'fees' => [
[
'add_on_code' => 'setup_fee',
'invoice_display_name' => 'Setup Fee (SF1)',
'unit_amount_cents' => 12000,
'units' => '2.5',
'description' => 'The description of the fee line item in the invoice. By default, the description of the add-on is used.',
'from_datetime' => '2022-08-08T00:00:00Z',
'to_datetime' => '2022-08-08T00:00:00Z',
'tax_codes' => [
'french_standard_vat'
],
'skip_psp' => true
]
],
'invoice_custom_section' => [
'skip_invoice_custom_sections' => false,
'invoice_custom_section_codes' => [
'eu_bank_details'
]
],
'payment_method' => [
'payment_method_type' => 'provider',
'payment_method_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://core.nozle.app/api/v1/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"invoice\": {\n \"external_customer_id\": \"hooli_1234\",\n \"billing_entity_code\": \"default\",\n \"currency\": \"EUR\",\n \"fees\": [\n {\n \"add_on_code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee (SF1)\",\n \"unit_amount_cents\": 12000,\n \"units\": \"2.5\",\n \"description\": \"The description of the fee line item in the invoice. By default, the description of the add-on is used.\",\n \"from_datetime\": \"2022-08-08T00:00:00Z\",\n \"to_datetime\": \"2022-08-08T00:00:00Z\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"skip_psp\": true\n }\n ],\n \"invoice_custom_section\": {\n \"skip_invoice_custom_sections\": false,\n \"invoice_custom_section_codes\": [\n \"eu_bank_details\"\n ]\n },\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}")
.asString();{
"invoice": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "acme_corp",
"number": "LAG-1234-001-002",
"issuing_date": "2022-04-30",
"invoice_type": "subscription",
"status": "finalized",
"payment_status": "succeeded",
"currency": "EUR",
"fees_amount_cents": 100,
"coupons_amount_cents": 10,
"credit_notes_amount_cents": 10,
"sub_total_excluding_taxes_amount_cents": 100,
"taxes_amount_cents": 20,
"sub_total_including_taxes_amount_cents": 120,
"prepaid_credit_amount_cents": 0,
"progressive_billing_credit_amount_cents": 0,
"total_amount_cents": 100,
"version_number": 3,
"created_at": "2022-04-29T08:59:51Z",
"updated_at": "2022-04-29T08:59:51Z",
"sequential_id": 2,
"payment_dispute_lost_at": "2022-09-14T16:35:31Z",
"payment_due_date": "2022-04-30",
"payment_overdue": true,
"net_payment_term": 30,
"prepaid_granted_credit_amount_cents": 0,
"prepaid_purchased_credit_amount_cents": 0,
"self_billed": false,
"file_url": "https://billing.example.com/invoices/example.pdf",
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"sequential_id": 1,
"slug": "LAG-1234-001",
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"applicable_timezone": "America/Los_Angeles",
"created_at": "2022-04-29T08:59:51Z",
"billing_entity_code": "acme_corp",
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"currency": "USD",
"email": "dinesh@piedpiper.test",
"legal_name": "Coleman-Blair",
"legal_number": "49-008-2965",
"logo_url": "http://hooli.com/logo.png",
"name": "Gavin Belson",
"firstname": "Gavin",
"lastname": "Belson",
"account_type": "customer",
"customer_type": "company",
"phone": "1-171-883-3711 x245",
"state": "CA",
"tax_identification_number": "EU123456789",
"timezone": "America/Los_Angeles",
"url": "http://hooli.com",
"zipcode": "91364",
"net_payment_term": 30,
"updated_at": "2022-04-29T08:59:51Z",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"billing_configuration": {
"invoice_grace_period": 3,
"subscription_invoice_issuing_date_anchor": "next_period_start",
"subscription_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "stripe",
"payment_provider_code": "stripe-eu-1",
"provider_customer_id": "cus_12345",
"sync": true,
"sync_with_provider": true,
"document_locale": "fr",
"provider_payment_methods": [
"card",
"sepa_debit",
"us_bank_account",
"bacs_debit",
"link",
"boleto",
"crypto",
"customer_balance"
]
},
"shipping_address": {
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"state": "CA",
"zipcode": "91364"
},
"metadata": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "Purchase Order",
"value": "123456789",
"display_in_invoice": true,
"created_at": "2022-04-29T08:59:51Z"
}
],
"integration_customers": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"type": "netsuite",
"integration_code": "netsuite-eu-1",
"external_customer_id": "cus_12345",
"sync_with_provider": true,
"subsidiary_id": "2",
"targeted_object": "contacts",
"email": "dinesh@piedpiper.test"
}
]
},
"metadata": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "digital_ref_id",
"value": "INV-0123456-98765",
"created_at": "2022-04-29T08:59:51Z"
}
],
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "TVA",
"tax_code": "french_standard_vat",
"tax_rate": 20,
"tax_description": "French standard VAT",
"amount_cents": 2000,
"amount_currency": "USD",
"created_at": "2022-09-14T16:35:31Z",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"fees_amount_cents": 20000
}
],
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "eu_bank_details",
"details": "Bank Name: Nozle Bank, IBAN: FR7630004000031234567890143",
"display_name": "Bank Details:",
"created_at": "2023-07-06T14:35:58Z"
}
],
"applied_usage_thresholds": [
{
"lifetime_usage_amount_cents": 2000,
"created_at": "2025-03-31T12:31:44Z",
"usage_threshold": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"threshold_display_name": "Threshold 1",
"amount_cents": 10000,
"recurring": true,
"created_at": "2023-06-27T19:43:42Z",
"updated_at": "2023-06-27T19:43:42Z"
}
}
],
"billing_periods": [
{
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "external_id",
"lago_plan_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"subscription_from_datetime": "2022-04-29T08:59:51Z",
"subscription_to_datetime": "2022-05-29T08:59:51Z",
"charges_from_datetime": "2022-04-29T08:59:51Z",
"charges_to_datetime": "2022-05-29T08:59:51Z",
"invoicing_reason": "subscription_starting"
}
],
"credits": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"amount_cents": 1200,
"amount_currency": "EUR",
"before_taxes": false,
"item": {
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"type": "coupon",
"code": "startup_deal",
"name": "Startup Deal"
},
"invoice": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"payment_status": "succeeded"
}
}
],
"fees": [
{
"amount_cents": 100,
"amount_currency": "EUR",
"taxes_amount_cents": 20,
"taxes_rate": 20,
"units": "0.32",
"precise_unit_amount": "312.5",
"total_aggregated_units": "0.32",
"total_amount_cents": 120,
"total_amount_currency": "EUR",
"pay_in_advance": true,
"invoiceable": true,
"payment_status": "pending",
"sub_total_excluding_taxes_amount_cents": 100,
"sub_total_excluding_taxes_precise_amount_cents": "100.0",
"item": {
"type": "subscription",
"code": "startup",
"name": "Startup",
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"item_type": "Subscription",
"description": "Startup",
"invoice_display_name": "Setup Fee (SF1)",
"filter_invoice_display_name": "AWS eu-east-1",
"filters": {},
"grouped_by": {}
},
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_filter_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_fixed_charge_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_parent_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "external_id",
"external_subscription_id": "external_id",
"precise_amount": "1.0001",
"precise_total_amount": "1.0212",
"taxes_precise_amount": "0.20123",
"events_count": 23,
"from_date": "2022-04-29T08:59:51Z",
"to_date": "2022-05-29T08:59:51Z",
"created_at": "2022-08-24T14:58:59Z",
"succeeded_at": "2022-08-24T14:58:59Z",
"failed_at": "2022-08-24T14:58:59Z",
"refunded_at": "2022-08-24T14:58:59Z",
"event_transaction_id": "transaction_1234567890",
"description": "Fee description",
"precise_coupons_amount_cents": "0.0",
"amount_details": {
"plan_amount_cents": 10000,
"graduated_ranges": [
{
"units": "10.0",
"from_value": 0,
"to_value": 10,
"flat_unit_amount": "1.0",
"per_unit_amount": "1.0",
"per_unit_total_amount": "10.0",
"total_with_flat_amount": "11.0"
}
],
"graduated_percentage_ranges": [
{
"units": "10.0",
"from_value": 0,
"to_value": 10,
"flat_unit_amount": "1.0",
"rate": "1.0",
"per_unit_total_amount": "10.0",
"total_with_flat_amount": "11.0"
}
],
"free_units": "10.0",
"paid_units": "40.0",
"per_package_size": 1000,
"per_package_unit_amount": "0.5",
"per_unit_total_amount": "10.0",
"units": "20.0",
"free_events": 10,
"rate": "1.0",
"paid_events": 20,
"fixed_fee_unit_amount": "1.0",
"fixed_fee_total_amount": "20.0",
"min_max_adjustment_total_amount": "20.0",
"per_unit_amount": "0.5",
"flat_unit_amount": "10.0"
},
"self_billed": false,
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "TVA",
"tax_code": "french_standard_vat",
"tax_rate": 20,
"tax_description": "French standard VAT",
"amount_cents": 2000,
"amount_currency": "USD",
"created_at": "2022-09-14T16:35:31Z",
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
],
"pricing_unit_details": {
"lago_pricing_unit_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"pricing_unit_code": "credits",
"short_name": "CR",
"amount_cents": 200,
"precise_amount_cents": "200.0",
"unit_amount_cents": 100,
"precise_unit_amount": "100.0",
"conversion_rate": "0.5"
},
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"subscriptions": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"billing_time": "anniversary",
"name": "Repository A",
"plan_code": "premium",
"status": "active",
"created_at": "2022-08-08T00:00:00Z",
"canceled_at": "2022-09-14T16:35:31Z",
"started_at": "2022-08-08T00:00:00Z",
"ending_at": "2022-10-08T00:00:00Z",
"subscription_at": "2022-08-08T00:00:00Z",
"terminated_at": "2022-09-14T16:35:31Z",
"previous_plan_code": null,
"next_plan_code": null,
"downgrade_plan_date": "2022-04-30",
"trial_ended_at": "2022-08-08T00:00:00Z",
"current_billing_period_started_at": "2022-08-08T00:00:00Z",
"current_billing_period_ending_at": "2022-09-08T00:00:00Z",
"on_termination_credit_note": "credit",
"on_termination_invoice": "generate",
"billing_entity_code": "default",
"plan_amount_cents": 10000,
"plan_amount_currency": "USD",
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z",
"invoice_custom_section": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "EU Bank Details",
"code": "eu_bank_details",
"description": "This section contains the bank details for EU customers.",
"details": "Bank Name: Nozle Bank, IBAN: FR7630004000031234567890143",
"display_name": "Bank Details:",
"applied_to_organization": true,
"organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"created_at": "2023-07-06T14:35:58Z"
},
"invoice_custom_section_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
},
"consolidate_invoice": true,
"cancellation_reason": "payment_failed",
"activated_at": "2022-08-08T00:00:00Z",
"activation_rules": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"type": "payment",
"timeout_hours": 48,
"status": "pending",
"created_at": "2022-08-08T00:00:00Z",
"updated_at": "2022-08-08T00:00:00Z",
"expires_at": "2022-08-10T00:00:00Z"
}
]
}
],
"error_details": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"error_code": "tax_error",
"details": {
"tax_error": "taxDateTooFarInFuture"
}
}
]
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}