Skip to content

getlago/lago-java-client

Repository files navigation

lago-java-client

Lago API documentation

  • API version: 0.53.0-beta

  • Build date: 2023-12-27T14:12:55.372025191Z[Etc/UTC]

Lago API allows your application to push customer information and metrics (events) from your application to the billing application.

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>org.openapitools</groupId>
  <artifactId>lago-java-client</artifactId>
  <version>0.53.0-beta</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'lago-java-client' jar has been published to maven central.
    mavenLocal()       // Needed if the 'lago-java-client' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "org.openapitools:lago-java-client:0.53.0-beta"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/lago-java-client-0.53.0-beta.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import org.getlago.client.*;
import org.getlago.client.auth.*;
import org.openapitools.client.model.*;
import org.getlago.client.api.AddOnsApi;

public class AddOnsApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.getlago.com/api/v1");
        
        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken("BEARER TOKEN");

        AddOnsApi apiInstance = new AddOnsApi(defaultClient);
        AddOnCreateInput addOnCreateInput = new AddOnCreateInput(); // AddOnCreateInput | Add-on payload
        try {
            AddOn result = apiInstance.createAddOn(addOnCreateInput);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AddOnsApi#createAddOn");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.getlago.com/api/v1

Class Method HTTP request Description
AddOnsApi createAddOn POST /add_ons Create an add-on
AddOnsApi destroyAddOn DELETE /add_ons/{code} Delete an add-on
AddOnsApi findAddOn GET /add_ons/{code} Retrieve an add-on
AddOnsApi findAllAddOns GET /add_ons List all add-ons
AddOnsApi updateAddOn PUT /add_ons/{code} Update an add-on
AnalyticsApi findAllGrossRevenues GET /analytics/gross_revenue List gross revenue
AnalyticsApi findAllInvoiceCollections GET /analytics/invoice_collection List of finalized invoices
AnalyticsApi findAllInvoicedUsages GET /analytics/invoiced_usage List usage revenue
AnalyticsApi findAllMrrs GET /analytics/mrr List MRR
BillableMetricsApi createBillableMetric POST /billable_metrics Create a billable metric
BillableMetricsApi destroyBillableMetric DELETE /billable_metrics/{code} Delete a billable metric
BillableMetricsApi findAllBillableMetricGroups GET /billable_metrics/{code}/groups Find a billable metric's groups
BillableMetricsApi findAllBillableMetrics GET /billable_metrics List all billable metrics
BillableMetricsApi findBillableMetric GET /billable_metrics/{code} Retrieve a billable metric
BillableMetricsApi updateBillableMetric PUT /billable_metrics/{code} Update a billable metric
CouponsApi applyCoupon POST /applied_coupons Apply a coupon to a customer
CouponsApi createCoupon POST /coupons Create a coupon
CouponsApi deleteAppliedCoupon DELETE /customers/{external_customer_id}/applied_coupons/{applied_coupon_id} Delete an applied coupon
CouponsApi destroyCoupon DELETE /coupons/{code} Delete a coupon
CouponsApi findAllAppliedCoupons GET /applied_coupons List all applied coupons
CouponsApi findAllCoupons GET /coupons List all coupons
CouponsApi findCoupon GET /coupons/{code} Retrieve a coupon
CouponsApi updateCoupon PUT /coupons/{code} Update a coupon
CreditNotesApi createCreditNote POST /credit_notes Create a credit note
CreditNotesApi downloadCreditNote POST /credit_notes/{lago_id}/download Download a credit note PDF
CreditNotesApi estimateCreditNote POST /credit_notes/estimate Estimate amounts for a new credit note
CreditNotesApi findAllCreditNotes GET /credit_notes List all credit notes
CreditNotesApi findCreditNote GET /credit_notes/{lago_id} Retrieve a credit note
CreditNotesApi updateCreditNote PUT /credit_notes/{lago_id} Update a credit note
CreditNotesApi voidCreditNote PUT /credit_notes/{lago_id}/void Void a credit note
CustomersApi createCustomer POST /customers Create a customer
CustomersApi deleteAppliedCoupon DELETE /customers/{external_customer_id}/applied_coupons/{applied_coupon_id} Delete an applied coupon
CustomersApi destroyCustomer DELETE /customers/{external_id} Delete a customer
CustomersApi findAllCustomerPastUsage GET /customers/{external_customer_id}/past_usage Retrieve customer past usage
CustomersApi findAllCustomers GET /customers List all customers
CustomersApi findCustomer GET /customers/{external_id} Retrieve a customer
CustomersApi findCustomerCurrentUsage GET /customers/{external_customer_id}/current_usage Retrieve customer current usage
CustomersApi generateCustomerCheckoutURL POST /customers/{external_customer_id}/checkout_url Generate a Customer Payment Provider Checkout URL
CustomersApi getCustomerPortalUrl GET /customers/{external_customer_id}/portal_url Get a customer portal URL
EventsApi createBatchEvents POST /events/batch Batch multiple events
EventsApi createEvent POST /events Send usage events
EventsApi eventEstimateFees POST /events/estimate_fees Estimate fees for a pay in advance charge
EventsApi findEvent GET /events/{transaction_id} Retrieve a specific event
FeesApi findAllFees GET /fees List all fees
FeesApi findFee GET /fees/{lago_id} Retrieve a specific fee
FeesApi updateFee PUT /fees/{lago_id} Update a fee
InvoicesApi createInvoice POST /invoices Create a one-off invoice
InvoicesApi downloadInvoice POST /invoices/{lago_id}/download Download an invoice PDF
InvoicesApi finalizeInvoice PUT /invoices/{lago_id}/finalize Finalize a draft invoice
InvoicesApi findAllInvoices GET /invoices List all invoices
InvoicesApi findInvoice GET /invoices/{lago_id} Retrieve an invoice
InvoicesApi refreshInvoice PUT /invoices/{lago_id}/refresh Refresh a draft invoice
InvoicesApi retryPayment POST /invoices/{lago_id}/retry_payment Retry an invoice payment
InvoicesApi updateInvoice PUT /invoices/{lago_id} Update an invoice
InvoicesApi voidInvoice POST /invoices/{lago_id}/void Void an invoice
OrganizationsApi updateOrganization PUT /organizations Update your organization
PlansApi createPlan POST /plans Create a plan
PlansApi destroyPlan DELETE /plans/{code} Delete a plan
PlansApi findAllPlans GET /plans List all plans
PlansApi findPlan GET /plans/{code} Retrieve a plan
PlansApi updatePlan PUT /plans/{code} Update a plan
SubscriptionsApi createSubscription POST /subscriptions Assign a plan to a customer
SubscriptionsApi destroySubscription DELETE /subscriptions/{external_id} Terminate a subscription
SubscriptionsApi findAllSubscriptions GET /subscriptions List all subscriptions
SubscriptionsApi findSubscription GET /subscriptions/{external_id} Retrieve a subscription
SubscriptionsApi updateSubscription PUT /subscriptions/{external_id} Update a subscription
TaxesApi createTax POST /taxes Create a tax
TaxesApi destroyTax DELETE /taxes/{code} Delete a tax
TaxesApi findAllTaxes GET /taxes List all taxes
TaxesApi findTax GET /taxes/{code} Retrieve a Tax
TaxesApi updateTax PUT /taxes/{code} Update a tax
WalletsApi createWallet POST /wallets Create a wallet
WalletsApi createWalletTransaction POST /wallet_transactions Top up a wallet
WalletsApi destroyWallet DELETE /wallets/{lago_id} Terminate a wallet
WalletsApi findAllWalletTransactions GET /wallets/{lago_id}/wallet_transactions List all wallet transactions
WalletsApi findAllWallets GET /wallets List all wallets
WalletsApi findWallet GET /wallets/{lago_id} Retrieve a wallet
WalletsApi updateWallet PUT /wallets/{lago_id} Update a wallet
WebhookEndpointsApi createWebhookEndpoint POST /webhook_endpoints Create a webhook_endpoint
WebhookEndpointsApi destroyWebhookEndpoint DELETE /webhook_endpoints/{lago_id} Delete a webhook endpoint
WebhookEndpointsApi findAllWebhookEndpoints GET /webhook_endpoints List all webhook endpoints
WebhookEndpointsApi findWebhookEndpoint GET /webhook_endpoints/{lago_id} Retrieve a webhook endpoint
WebhookEndpointsApi updateWebhookEndpoint PUT /webhook_endpoints/{lago_id} Update a webhook endpoint
WebhooksApi fetchPublicKey GET /webhooks/public_key Retrieve webhook public key

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: HTTP Bearer Token authentication

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

tech@getlago.com