Skip to content

G-PORTAL/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 = LagoClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new LagoClient\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 \LagoClient\Model\AppliedAddOnInput(); // \LagoClient\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 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 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/{external_customer_id}/applied_coupons/{applied_coupon_id} Delete customer's appplied coupon
CustomersApi destroyCustomer DELETE /customers/{external_id} Delete a customer
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 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 an pay in advance charge
EventsApi findEvent GET /events/{transaction_id} Retrieve a specific event
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 List all subscriptions
SubscriptionsApi updateSubscription PUT /subscriptions/{external_id} Update a 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.37.0-beta
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen