Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

getlago/lago-php-client

Repository files navigation

OpenAPIClient-php

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

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new OpenAPI\Client\Api\AddOnsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$applied_add_on_input = new \OpenAPI\Client\Model\AppliedAddOnInput(); // \OpenAPI\Client\Model\AppliedAddOnInput | Apply add-on payload

try {
    $result = $apiInstance->applyAddOn($applied_add_on_input);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AddOnsApi->applyAddOn: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

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

Class Method HTTP request Description
AddOnsApi applyAddOn POST /applied_add_ons Apply an add-on to a customer
AddOnsApi createAddOn POST /add_ons Create a new add-on
AddOnsApi destroyAddOn DELETE /add_ons/{code} Delete an add-on
AddOnsApi findAddOn GET /add_ons/{code} Find add-on by code
AddOnsApi findAllAddOns GET /add_ons Find add-ons
AddOnsApi updateAddOn PUT /add_ons/{code} Update an existing add-on
BillableMetricsApi createBillableMetric POST /billable_metrics Create a new billable metric
BillableMetricsApi destroyBillableMetric DELETE /billable_metrics/{code} Delete a billable metric
BillableMetricsApi findAllBillableMetricGroups GET /billable_metrics/{code}/groups Find Billable metric groups
BillableMetricsApi findAllBillableMetrics GET /billable_metrics Find Billable metrics
BillableMetricsApi findBillableMetric GET /billable_metrics/{code} Find billable metric by code
BillableMetricsApi updateBillableMetric PUT /billable_metrics/{code} Update an existing billable metric
CouponsApi applyCoupon POST /applied_coupons Apply a coupon to a customer
CouponsApi createCoupon POST /coupons Create a new coupon
CouponsApi destroyCoupon DELETE /coupons/{code} Delete a coupon
CouponsApi findAllAppliedCoupons GET /applied_coupons Find Applied Coupons
CouponsApi findAllCoupons GET /coupons Find Coupons
CouponsApi findCoupon GET /coupons/{code} Find coupon by code
CouponsApi updateCoupon PUT /coupons/{code} Update an existing coupon
CreditNotesApi createCreditNote POST /credit_notes Create a new Credit note
CreditNotesApi downloadCreditNote POST /credit_notes/{id}/download Download an existing credit note
CreditNotesApi findAllCreditNotes GET /credit_notes Find Credit notes
CreditNotesApi findCreditNote GET /credit_notes/{id} Find credit note
CreditNotesApi updateCreditNote PUT /credit_notes/{id} Update an existing credit note
CreditNotesApi voidCreditNote PUT /credit_notes/{id}/void Void existing credit note
CustomersApi createCustomer POST /customers Create a customer
CustomersApi deleteAppliedCoupon DELETE /customers/{customer_external_id}/applied_coupons/{applied_coupon_id} Delete customer's appplied coupon
CustomersApi destroyCustomer DELETE /customers/{external_id} Delete a customer
CustomersApi findAllCustomers GET /customers Find customers
CustomersApi findCustomer GET /customers/{external_id} Find customer by external ID
CustomersApi findCustomerCurrentUsage GET /customers/{customer_external_id}/current_usage Find customer current usage
CustomersApi getCustomerPortalUrl GET /customers/{customer_external_id}/portal_url Get customer portal URL
EventsApi createBatchEvents POST /events/batch Create batch events
EventsApi createEvent POST /events Create a new event
EventsApi eventEstimateFees POST /events/estimate_fees Estimate fees for an instant charge
EventsApi findEvent GET /events/{id} Find event by transaction ID
FeesApi findAllFees GET /fees Find all fees
FeesApi findFee GET /fees/{id} Find fee by ID
FeesApi updateFee PUT /fees/{id} Update an existing fee
InvoicesApi createInvoice POST /invoices Create a new invoice
InvoicesApi downloadInvoice POST /invoices/{id}/download Download an existing invoice
InvoicesApi finalizeInvoice PUT /invoices/{id}/finalize Finalize a draft invoice
InvoicesApi findAllInvoices GET /invoices Find all invoices
InvoicesApi findInvoice GET /invoices/{id} Find invoice by ID
InvoicesApi refreshInvoice PUT /invoices/{id}/refresh Refresh a draft invoice
InvoicesApi retryPayment POST /invoices/{id}/retry_payment Retry invoice payment
InvoicesApi updateInvoice PUT /invoices/{id} Update an existing invoice status
OrganizationsApi updateOrganization PUT /organizations Update an existing Organization
PlansApi createPlan POST /plans Create a new plan
PlansApi destroyPlan DELETE /plans/{code} Delete a plan
PlansApi findAllPlans GET /plans Find plans
PlansApi findPlan GET /plans/{code} Find plan by code
PlansApi updatePlan PUT /plans/{code} Update an existing plan
SubscriptionsApi createSubscription POST /subscriptions Assign a plan to a customer
SubscriptionsApi destroySubscription DELETE /subscriptions/{external_id} Terminate a subscription
SubscriptionsApi findAllSubscriptions GET /subscriptions Find subscriptions
SubscriptionsApi updateSubscription PUT /subscriptions/{external_id} Update an existing subscription
WalletsApi createWallet POST /wallets Create a new wallet
WalletsApi createWalletTransaction POST /wallet_transactions Create a new wallet transaction
WalletsApi destroyWallet DELETE /wallets/{id} Delete a wallet
WalletsApi findAllWalletTransactions GET /wallets/{id}/wallet_transactions Find wallet transactions
WalletsApi findAllWallets GET /wallets Find wallets
WalletsApi findWallet GET /wallets/{id} Find wallet
WalletsApi updateWallet PUT /wallets/{id} Update an existing wallet
WebhooksApi fetchPublicKey GET /webhooks/public_key Fetch webhook public key

Models

Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: Bearer authentication

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

[email protected]

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 0.32.0-beta
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen