Void a credit note
curl --request PUT \
--url https://api.getlago.com/api/v2/credit_notes/{lago_id}/void \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v2/credit_notes/{lago_id}/void"
headers = {"Authorization": "Bearer <token>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v2/credit_notes/{lago_id}/void', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getlago.com/api/v2/credit_notes/{lago_id}/void",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v2/credit_notes/{lago_id}/void"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.getlago.com/api/v2/credit_notes/{lago_id}/void")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/credit_notes/{lago_id}/void")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"credit_note": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"sequential_id": 1,
"number": "example",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"invoice_number": "INV-001",
"purchase_order_number": "PO-123",
"issuing_date": "2022-04-29",
"credit_status": "available",
"refund_status": "pending",
"reason": "duplicated_charge",
"description": "Example",
"currency": "USD",
"sub_total_excluding_taxes_amount_cents": 100,
"taxes_amount_cents": 100,
"sub_total_including_taxes_amount_cents": 120,
"total_amount_cents": 100,
"balance_amount_cents": 100,
"credit_amount_cents": 100,
"refund_amount_cents": 100,
"offset_amount_cents": 100,
"file_url": "https://documents.example/invoice.pdf",
"xml_url": "https://documents.example/invoice.pdf",
"self_billed": false,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"items": [
{
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"amount_cents": 100
}
],
"applied_taxes": [
{
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "example",
"tax_code": "example",
"tax_rate": 20,
"tax_description": "example",
"base_amount_cents": 100,
"amount_cents": 100
}
],
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
},
"error_details": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"error_code": "not_provided",
"details": {}
}
],
"metadata": {}
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}Credit notes
Void a credit note
Voids an eligible credit note.
PUT
/
credit_notes
/
{lago_id}
/
void
Void a credit note
curl --request PUT \
--url https://api.getlago.com/api/v2/credit_notes/{lago_id}/void \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v2/credit_notes/{lago_id}/void"
headers = {"Authorization": "Bearer <token>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v2/credit_notes/{lago_id}/void', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getlago.com/api/v2/credit_notes/{lago_id}/void",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v2/credit_notes/{lago_id}/void"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.getlago.com/api/v2/credit_notes/{lago_id}/void")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/credit_notes/{lago_id}/void")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"credit_note": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"sequential_id": 1,
"number": "example",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"invoice_number": "INV-001",
"purchase_order_number": "PO-123",
"issuing_date": "2022-04-29",
"credit_status": "available",
"refund_status": "pending",
"reason": "duplicated_charge",
"description": "Example",
"currency": "USD",
"sub_total_excluding_taxes_amount_cents": 100,
"taxes_amount_cents": 100,
"sub_total_including_taxes_amount_cents": 120,
"total_amount_cents": 100,
"balance_amount_cents": 100,
"credit_amount_cents": 100,
"refund_amount_cents": 100,
"offset_amount_cents": 100,
"file_url": "https://documents.example/invoice.pdf",
"xml_url": "https://documents.example/invoice.pdf",
"self_billed": false,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"items": [
{
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"amount_cents": 100
}
],
"applied_taxes": [
{
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "example",
"tax_code": "example",
"tax_rate": 20,
"tax_description": "example",
"base_amount_cents": 100,
"amount_cents": 100
}
],
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
},
"error_details": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"error_code": "not_provided",
"details": {}
}
],
"metadata": {}
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}API v2 is in beta. Endpoints return the
X-Lago-Endpoint-Status: beta header.This endpoint changes billing or financial records. Check the target environment, the resource identifier and the expected effect before you call it. Review the change before you run it in production.