Skip to content

The billit.io API Client for PHP.

License

Notifications You must be signed in to change notification settings

drakakisgeo/billit

Repository files navigation

Billit client

Latest Version on Packagist Software License Build Status

This PHP client can be used to connect with the billit.io API .

Note: Billit.io also has an integration with zapier.com, Contact us in order to give you access to our beta zapier app.

Install

Via Composer

$ composer require drakakisgeo/billit

Laravel Framework

If you use the Laravel Framework you need to provide your Billit API key and Base url, so add a key to your config/services.php file as:

'billit' => [
        'token' => env('BILLIT_API_TOKEN'),
        'sandbox' => env('BILLIT_API_IS_SANDBOX'),
        'version' => 'v1',
        'timeout' => 2.0
    ]

To initialize the client is just a call as this:

$client = resolve('billit');

You can of course also use the Billit Facade like so

Billit::myAccount();

Examples

List contacts
use Drakakisgeo\Billit\Billit;

$client = new Billit('yourToken');
$client->contacts();
Get Account details
$client->myAccount();
Get Customers
$client->contacts();
Create contact
$client->contactCreate([
    'customerType' => 'company',
    'company' => 'Awesome S.A.',
    'inCharge' => 'Kalampakopoulos George',
    'lang' => 'el',
    'VatId'=>'075101010'
]);
Update contact
$client->contactUpdate([
    'customerType' => 'company',
    'company' => 'Awesome S.A.',
    'inCharge' => 'Kalampakopoulos George',
    'lang' => 'el',
    'VatId'=>'075101010'
]);
Get contact
$client->contactShow(1010);
Delete contact
$client->contactDelete(1010);
Create invoice

A full rather complicated example, MyData enabled

$client->invoiceCreate([
    "customerId"=>694,
    "sendMail"=> false,
    "excludeMydata"=> true,
    "invoiceDate"=>"2021-04-15",
    "invoiceTypeId"=>349,
    "isPaid" => true,
    "mydataInvoiceType" => "2.1",
    "taxes"=> [
        [
            "taxId"=> 514
        ],
        [
            "taxId"=> 524,
            "taxVatShow"=> 1
        ]
    ],
    "products"=> [
        [
            "productId"=> null,
            "details"=> "test",
            "measurementUnit"=> 1,
            "vatId" => 376,
            "price" => 123.32,
            "quantity"=> 1,
            "incomeClassificationCat"=>"category1_3",
            "incomeClassificationType"=>"E3_561_001"
        ]
    ],
    "tags" => ["billit","test-tag"],
    "mydataPayment"=>[
        "paidAmount"=> 0.32,
        "paymentMethod"=> 3,
        "epiPistosi"=> 10
    ]
]
);

Check the rest of the methods to src/Billit.php and the official API regarding the options that can be used in each case.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

The MIT License (MIT). Please see License File for more information.