Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/supplycart/e-invoice
https://github.com/supplycart/e-invoice
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/supplycart/e-invoice
- Owner: supplycart
- License: mit
- Created: 2024-07-11T02:45:14.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-11-06T18:21:37.000Z (about 2 months ago)
- Last Synced: 2024-11-21T14:06:32.668Z (about 1 month ago)
- Language: PHP
- Size: 74.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
To install, run:
```zsh
$ composer require supplycart/e-invoice
```## Usage with Laravel (tested on Laravel 11)
#### Login as Taxpayer System
```php
use Supplycart\EInvoice\EInvoiceClient;
use Illuminate\Support\Facades\Cache;$isProd = false;
$clientId = '5b75ce93-a6d1-4e02-943f-a24ffa1b46ec';
$clientSecret = 'e4d2fcc8-90a8-40cd-99be-08f3401fbb93';$client = new EInvoiceClient(
clientId: $clientId,
clientSecret: $clientSecret,
isProd: isProd
);$client->login();
$accessToken = $client->getAccessToken();
//Alternative to store in cache and get it later
Cache::remember('some-key', $accessToken, 3600) // expires in 3600s (1hour)// To reuse the cached accessToken
$client->setAccessToken(Cache::get('some-key'));
```#### Login as Intermediary System
```php
// same as login, just need to set $onBehalfOf which is the entity's TIN
$client->setOnBehalfOf($onBehalfOf);
```#### Validate Taxpayer's TIN
```php
$tin = 'C1234567890';
$idType = 'BRN';
$idValue = '1234567890';$response = $client->validateTaxPayerTin(
tin: $tin,
idType: $idType,
idValue: $idValue
);
```#### Get Document Details
```php
$documentUuid = '5a282618-8ad0-4ad6-bc1d-7f2a326562cf';$response = $client->getDocumentDetail($documentUuid);
```