Estimate instant fees for a pay in advance charge
curl --request POST \
--url https://core.nozle.app/api/v1/events/estimate_instant_fees \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"code": "storage",
"external_subscription_id": "sub_1234567890",
"properties": {},
"transaction_id": "transaction_1234567890"
}
}
'import requests
url = "https://core.nozle.app/api/v1/events/estimate_instant_fees"
payload = { "event": {
"code": "storage",
"external_subscription_id": "sub_1234567890",
"properties": {},
"transaction_id": "transaction_1234567890"
} }
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({
event: {
code: 'storage',
external_subscription_id: 'sub_1234567890',
properties: {},
transaction_id: 'transaction_1234567890'
}
})
};
fetch('https://core.nozle.app/api/v1/events/estimate_instant_fees', 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/events/estimate_instant_fees"
payload := strings.NewReader("{\n \"event\": {\n \"code\": \"storage\",\n \"external_subscription_id\": \"sub_1234567890\",\n \"properties\": {},\n \"transaction_id\": \"transaction_1234567890\"\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/events/estimate_instant_fees")
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 \"event\": {\n \"code\": \"storage\",\n \"external_subscription_id\": \"sub_1234567890\",\n \"properties\": {},\n \"transaction_id\": \"transaction_1234567890\"\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/events/estimate_instant_fees",
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([
'event' => [
'code' => 'storage',
'external_subscription_id' => 'sub_1234567890',
'properties' => [
],
'transaction_id' => 'transaction_1234567890'
]
]),
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/events/estimate_instant_fees")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"code\": \"storage\",\n \"external_subscription_id\": \"sub_1234567890\",\n \"properties\": {},\n \"transaction_id\": \"transaction_1234567890\"\n }\n}")
.asString();{
"fees": [
{
"amount_cents": 100,
"amount_currency": "EUR",
"taxes_amount_cents": 0,
"taxes_rate": 20,
"units": "0.32",
"precise_unit_amount": 312.5,
"total_amount_cents": 120,
"total_amount_currency": "EUR",
"pay_in_advance": true,
"invoiceable": true,
"payment_status": "pending",
"item": {
"type": "charge",
"code": "startup",
"name": "Startup",
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"item_type": "Feature",
"description": "Startup description",
"invoice_display_name": "Setup Fee (SF1)",
"filter_invoice_display_name": "AWS eu-east-1",
"filters": {},
"grouped_by": {}
},
"lago_id": null,
"lago_charge_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_filter_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": null,
"lago_true_up_fee_id": null,
"lago_true_up_parent_fee_id": null,
"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,
"description": null,
"precise_coupons_amount_cents": "0.0",
"events_count": 1,
"created_at": null,
"succeeded_at": null,
"failed_at": null,
"refunded_at": null,
"event_transaction_id": "transaction_1234567890",
"amount_details": null
}
]
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 403,
"error": "Forbidden",
"code": "feature_unavailable"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Usage Events
Estimate instant fees for a pay in advance charge
Estimate the fees that would be created after reception of an event for a feature attached to one or multiple pay in advance standard or percentage charges
POST
/
events
/
estimate_instant_fees
Estimate instant fees for a pay in advance charge
curl --request POST \
--url https://core.nozle.app/api/v1/events/estimate_instant_fees \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"code": "storage",
"external_subscription_id": "sub_1234567890",
"properties": {},
"transaction_id": "transaction_1234567890"
}
}
'import requests
url = "https://core.nozle.app/api/v1/events/estimate_instant_fees"
payload = { "event": {
"code": "storage",
"external_subscription_id": "sub_1234567890",
"properties": {},
"transaction_id": "transaction_1234567890"
} }
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({
event: {
code: 'storage',
external_subscription_id: 'sub_1234567890',
properties: {},
transaction_id: 'transaction_1234567890'
}
})
};
fetch('https://core.nozle.app/api/v1/events/estimate_instant_fees', 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/events/estimate_instant_fees"
payload := strings.NewReader("{\n \"event\": {\n \"code\": \"storage\",\n \"external_subscription_id\": \"sub_1234567890\",\n \"properties\": {},\n \"transaction_id\": \"transaction_1234567890\"\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/events/estimate_instant_fees")
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 \"event\": {\n \"code\": \"storage\",\n \"external_subscription_id\": \"sub_1234567890\",\n \"properties\": {},\n \"transaction_id\": \"transaction_1234567890\"\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/events/estimate_instant_fees",
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([
'event' => [
'code' => 'storage',
'external_subscription_id' => 'sub_1234567890',
'properties' => [
],
'transaction_id' => 'transaction_1234567890'
]
]),
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/events/estimate_instant_fees")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"code\": \"storage\",\n \"external_subscription_id\": \"sub_1234567890\",\n \"properties\": {},\n \"transaction_id\": \"transaction_1234567890\"\n }\n}")
.asString();{
"fees": [
{
"amount_cents": 100,
"amount_currency": "EUR",
"taxes_amount_cents": 0,
"taxes_rate": 20,
"units": "0.32",
"precise_unit_amount": 312.5,
"total_amount_cents": 120,
"total_amount_currency": "EUR",
"pay_in_advance": true,
"invoiceable": true,
"payment_status": "pending",
"item": {
"type": "charge",
"code": "startup",
"name": "Startup",
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"item_type": "Feature",
"description": "Startup description",
"invoice_display_name": "Setup Fee (SF1)",
"filter_invoice_display_name": "AWS eu-east-1",
"filters": {},
"grouped_by": {}
},
"lago_id": null,
"lago_charge_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_charge_filter_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": null,
"lago_true_up_fee_id": null,
"lago_true_up_parent_fee_id": null,
"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,
"description": null,
"precise_coupons_amount_cents": "0.0",
"events_count": 1,
"created_at": null,
"succeeded_at": null,
"failed_at": null,
"refunded_at": null,
"event_transaction_id": "transaction_1234567890",
"amount_details": null
}
]
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 403,
"error": "Forbidden",
"code": "feature_unavailable"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}