Events
Estimate an upcoming fee
Estimate the fees that would be created after reception of an event for a billable metric attached to one or multiple pay in advance charges.
POST
/api/v1/events/estimate_fees
Bearer*
{
"fees": [
{
"amount_cents": "100",
"amount_currency": "EUR",
"applied_taxes": [
{
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"amount_cents": "2000",
"amount_currency": "USD",
"created_at": "2022-09-14T16:35:31Z",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_code": "french_standard_vat",
"tax_description": "French standard VAT",
"tax_name": "TVA",
"tax_rate": "20"
}
],
"created_at": "2022-08-24T14:58:59Z",
"event_transaction_id": "transaction_1234567890",
"events_count": "23",
"external_customer_id": "external_id",
"external_subscription_id": "external_id",
"failed_at": "2022-08-24T14:58:59Z",
"from_date": "2022-04-29T08:59:51Z",
"invoiceable": true,
"item": {
"code": "startup",
"item_type": "Subscription",
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Startup",
"type": "subscription"
},
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_group_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_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",
"pay_in_advance": true,
"payment_status": "pending",
"refunded_at": "2022-08-24T14:58:59Z",
"succeeded_at": "2022-08-24T14:58:59Z",
"taxes_amount_cents": "20",
"taxes_rate": "20",
"to_date": "2022-05-29T08:59:51Z",
"total_amount_cents": "120",
"total_amount_currency": "EUR",
"units": "0.32"
}
]
}
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request POST "$LAGO_URL/api/v1/events/estimate_fees" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"external_customer_id": "__YOUR_CUSTOMER_ID__",
"external_subscription_id": "__YOUR_SUBSCRIPTION_ID__",
"code": "__BILLABLE_METRIC_CODE__",
"properties": {
"custom_field": 12,
}
}
}'
Authorizations
Authorizationheaderrequired
string
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
application/json
eventrequired
object
Response
200 - application/json
feesrequired
object[]
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request POST "$LAGO_URL/api/v1/events/estimate_fees" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"external_customer_id": "__YOUR_CUSTOMER_ID__",
"external_subscription_id": "__YOUR_SUBSCRIPTION_ID__",
"code": "__BILLABLE_METRIC_CODE__",
"properties": {
"custom_field": 12,
}
}
}'
{
"fees": [
{
"amount_cents": "100",
"amount_currency": "EUR",
"applied_taxes": [
{
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"amount_cents": "2000",
"amount_currency": "USD",
"created_at": "2022-09-14T16:35:31Z",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_code": "french_standard_vat",
"tax_description": "French standard VAT",
"tax_name": "TVA",
"tax_rate": "20"
}
],
"created_at": "2022-08-24T14:58:59Z",
"event_transaction_id": "transaction_1234567890",
"events_count": "23",
"external_customer_id": "external_id",
"external_subscription_id": "external_id",
"failed_at": "2022-08-24T14:58:59Z",
"from_date": "2022-04-29T08:59:51Z",
"invoiceable": true,
"item": {
"code": "startup",
"item_type": "Subscription",
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Startup",
"type": "subscription"
},
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_group_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_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",
"pay_in_advance": true,
"payment_status": "pending",
"refunded_at": "2022-08-24T14:58:59Z",
"succeeded_at": "2022-08-24T14:58:59Z",
"taxes_amount_cents": "20",
"taxes_rate": "20",
"to_date": "2022-05-29T08:59:51Z",
"total_amount_cents": "120",
"total_amount_currency": "EUR",
"units": "0.32"
}
]
}