Skip to content

getlago/lago-php-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lago-php-client

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

⚠️ This client is generated with OpenApi Generator

Generation

You can use this command to update the client

# Replace the artifactVersion with the version of Lago you target
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i https://swagger.getlago.com/openapi.yaml -g php -p packageName=lago-php-client,vendorName=Lago,invokerPackage=Lago\\LagoPhpClient,licenseName=MIT,gitUserId=getlago,gitRepoId=lago-php-client,artifactVersion=1.31.0,composePackageName=getlago/lago-php-client -o /local/

Installation & Usage

Requirements

PHP 8.1 and later.

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/lago-php-client/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 = Lago\LagoPhpClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Lago\LagoPhpClient\Api\ActivityLogsApi(
    // 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
);
$activity_id = bdc0eda6-ea52-4f72-a46a-94f47a89b546; // string | The Activity Id of the existing activity log.

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

API Endpoints

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

Class Method HTTP request Description
ActivityLogsApi findActivityLog GET /activity_logs/{activity_id} Retrieve an activity log
ActivityLogsApi findAllActivityLogs GET /activity_logs List all activity logs
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
AnalyticsApi findAllOverdueBalances GET /analytics/overdue_balance List overdue balance
ApiLogsApi findAllApiLogs GET /api_logs List all api logs
ApiLogsApi findApiLog GET /api_logs/{request_id} Retrieve an api log
BillableMetricsApi createBillableMetric POST /billable_metrics Create a billable metric
BillableMetricsApi destroyBillableMetric DELETE /billable_metrics/{code} Delete a billable metric
BillableMetricsApi evaluateBillableMetricExpression POST /billable_metrics/evaluate_expression Evaluate an expression for a billable metric
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
BillingEntitiesApi createBillingEntity POST /billing_entities Create a billing entity
BillingEntitiesApi getBillingEntity GET /billing_entities/{code} Retrieve a billing entity
BillingEntitiesApi listBillingEntities GET /billing_entities List all billing entities
BillingEntitiesApi updateBillingEntity PUT /billing_entities/{code} Update a billing entity
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 available credit
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_customer_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_customer_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 eventBatchEstimateInstantFees POST /events/batch_estimate_instant_fees Batch estimate instant fees for a pay in advance charge
EventsApi eventEstimateFees POST /events/estimate_fees Estimate fees for a pay in advance charge
EventsApi eventEstimateInstantFees POST /events/estimate_instant_fees Estimate instant fees for a pay in advance charge
EventsApi findAllEvents GET /events List all events
EventsApi findEvent GET /events/{transaction_id} Retrieve a specific event
FeesApi deleteFee DELETE /fees/{lago_id} Delete a fee
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 invoicePaymentUrl POST /invoices/{lago_id}/payment_url Generate a payment URL
InvoicesApi invoicePreview POST /invoices/preview Create an invoice preview
InvoicesApi loseDisputeInvoice POST /invoices/{lago_id}/lose_dispute Mark an invoice payment dispute as lost
InvoicesApi refreshInvoice PUT /invoices/{lago_id}/refresh Refresh a draft invoice
InvoicesApi retryInvoice POST /invoices/{lago_id}/retry Retry generation of a failed 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
PaymentReceiptsApi findAllPaymentReceipts GET /payment_receipts List all payment receipts
PaymentReceiptsApi findPaymentReceipt GET /payment_receipts/{lago_id} Retrieve a payment receipt
PaymentRequestsApi createPaymentRequest POST /payment_requests Create a payment request
PaymentRequestsApi findAllPaymentRequests GET /payment_requests List all payment requests
PaymentsApi createPayment POST /payments Create a payment
PaymentsApi findAllPayments GET /payments List all payments
PaymentsApi findPayment GET /payments/{lago_id} Retrieve a payment
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 createSubscriptionAlert POST /subscriptions/{external_id}/alerts Create a subscription alert
SubscriptionsApi deleteSubscriptionAlert DELETE /subscriptions/{external_id}/alerts/{code} Delete a subscription alert
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 getSubscriptionAlert GET /subscriptions/{external_id}/alerts/{code} Retrieve a subscription alert
SubscriptionsApi getSubscriptionAlerts GET /subscriptions/{external_id}/alerts List subscription alerts
SubscriptionsApi getSubscriptionLifetimeUsage GET /subscriptions/{external_id}/lifetime_usage Retrieve subscription lifetime usage
SubscriptionsApi updateSubscription PUT /subscriptions/{external_id} Update a subscription
SubscriptionsApi updateSubscriptionAlert PUT /subscriptions/{external_id}/alerts/{code} Update a subscription alert
SubscriptionsApi updateSubscriptionLifetimeUsage PUT /subscriptions/{external_id}/lifetime_usage Update a subscription lifetime usage
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 findWalletTransaction GET /wallet_transactions/{lago_id} Retrieve a wallet transaction
WalletsApi updateWallet PUT /wallets/{lago_id} Update a wallet
WalletsApi walletTransactionPaymentUrl POST /wallet_transactions/{lago_id}/payment_url Generate a payment URL
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

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: 1.31.0
    • Package version: 1.31.0
    • Generator version: 7.14.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

About

PHP Client for Lago

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages