PHP code example of deviddev / billingo-api-v3-wrapper

1. Go to this page and download the library: Download deviddev/billingo-api-v3-wrapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

deviddev / billingo-api-v3-wrapper example snippets


use BillingoApiV3Wrapper as BillingoApi;

use Deviddev\BillingoApiV3Wrapper\BillingoApiV3Wrapper as BillingoApi;

$billingoApi = new BillingoApi('YOUR_API_KEY_HERE');

api(string $apiName);

make(array $data);

model(string $modelName, array $data = null);

withHttpInfo();

get(int $id);

delete(int $id);

deletePayment(int $id);

create();

update(int $id);

cancelInvoice(int $invoiceId);

createInvoiceFromProforma(int $invoiceId);

checkTaxNumber(string $taxNumber);

list(array $conditions);

downloadInvoice(int $invoiceId, string $path = null, string $extension = null);

sendInvoice(int $invoiceId);

getPublicUrl(int $id);

getResponse();

getId();

$partner = [
    'name' => 'Test Company',
    'address' => [
        'country_code' => 'HU',
        'post_code' => '1010',
        'city' => 'Budapest',
        'address' => 'Nagy Lajos 12.',
    ],
    'emails' => ['[email protected]'],
    'taxcode' => '',
];

BillingoApi::api('Partner')->model('PartnerUpsert', $partner)->create()->getResponse();

BillingoApi::api('Partner')->make($partner)->model('PartnerUpsert')->create()->getResponse();

BillingoApi::api('Partner')->model('PartnerUpsert', $partner)->create()->getId();

BillingoApi::api('Partner')->make($partner)->model('PartnerUpsert')->create()->getId();

$billingoApi->api('Partner')->model('PartnerUpsert', $partner)->create()->getResponse();

$billingoApi->api('Partner')->make($partner)->model('PartnerUpsert')->create()->getResponse();

$billingoApi->api('Partner')->model('PartnerUpsert', $partner)->create()->getId();

$billingoApi->api('Partner')->make($partner)->model('PartnerUpsert')->create()->getId();

$partner = [
    'name' => 'Test Company updated',
    'address' => [
        'country_code' => 'HU',
        'post_code' => '1010',
        'city' => 'Budapest',
        'address' => 'Nagy Lajos 12.',
    ],
    'emails' => ['[email protected]'],
    'taxcode' => '',
];

BillingoApi::api('Partner')->model('Partner', $partner)->update('BILLINGO_PARTNER_ID')->getResponse();

BillingoApi::api('Partner')->make($partner)->model('Partner')->update('BILLINGO_PARTNER_ID')->getResponse();

BillingoApi::api('Partner')->model('Partner', $partner)->update('BILLINGO_PARTNER_ID')->getId();

BillingoApi::api('Partner')->make($partner)->model('Partner')->update('BILLINGO_PARTNER_ID')->getId();

$billingoApi->api('Partner')->model('Partner', $partner)->update('BILLINGO_PARTNER_ID')->getResponse();

$billingoApi->api('Partner')->make($partner)->model('Partner')->update('BILLINGO_PARTNER_ID')->getResponse();

$billingoApi->api('Partner')->model('Partner', $partner)->update('BILLINGO_PARTNER_ID')->getId();

$billingoApi->api('Partner')->make($partner)->model('Partner')->update('BILLINGO_PARTNER_ID')->getId();

$invoice = [
    'partner_id' => BILLINGO_PARTNER_ID, // REQUIRED int
    'block_id' => YOUR_BILLINGO_BLOCK_ID, // REQUIRED int
    'bank_account_id' => YOUR_BILLINGO_BANK_ACCOUNT_ID, // int
    'type' => 'invoice', // REQUIRED
    'fulfillment_date' => Carbon::now('Europe/Budapest')->format('Y-m-d'), // REQUIRED, set up other time zone if it's necessaray
    'due_date' => Carbon::now('Europe/Budapest')->format('Y-m-d'), // REQUIRED, set up other time zone if it's necessaray
    'payment_method' => 'online_bankcard', // REQUIRED, see other types in billingo documentation
    'language' => 'hu', // REQUIRED, see others in billingo documentation
    'currency' => 'HUF', // REQUIRED, see others in billingo documentation
    'conversion_rate' => 1, // see others in billingo documentation
    'electronic' => false, // see others in billingo documentation
    'paid' => false, // see others in billingo documentation
    'items' =>  [
        [
            'name' => 'Laptop', // REQUIRED
            'unit_price' => '100000', // REQUIRED
            'unit_price_type' => 'gross', // REQUIRED
            'quantity' => 2, // REQUIRED int
            'unit' => 'db', // REQUIRED
            'vat' => '27%', // REQUIRED
            'comment' => 'some comment here...',
        ],
    ],
    'comment' => 'some comment here...',
    'settings' => [
        'mediated_servicíe' => false,
        'without_financial_fulfillment' => false,
        'online_payment' => '',
        'round' => 'five',
        'place_id' => 0,
    ],
];

BillingoApi::api('Document')->model('DocumentInsert', $invoice)->create()->getResponse();

BillingoApi::api('Document')->make($invoice)->model('DocumentInsert')->create()->getResponse();

BillingoApi::api('Document')->model('DocumentInsert', $invoice)->create()->getId();

BillingoApi::api('Document')->make($invoice)->model('DocumentInsert')->create()->getId();

$billingo->api('Document')->model('DocumentInsert', $invoice)->create()->getResponse();

$billingo->api('Document')->make($invoice)->model('DocumentInsert')->create()->getResponse();

$billingo->api('Document')->model('DocumentInsert', $invoice)->create()->getId();

$billingo->api('Document')->make($invoice)->model('DocumentInsert')->create()->getId();

BillingoApi::api('Document')->list([
    'page' => 1,
    'per_page' => 25,
    'block_id' => 42432,
    'partner_id' => 13123123,
    'payment_method' => 'cash',
    'payment_status' => 'paid',
    'start_date' => '2020-05-10',
    'end_date' => '2020-05-15',
    'start_number' => '1',
    'end_number' => '10',
    'start_year' => 2020,
    'end_year' => 2020
])->getResponse();

BillingoApi::api('Partner')->list([
    'page' => 1,
    'per_page' => 5
])->getResponse();

BillingoApi::api('Partner')->list([
    'page' => 1,
    'per_page' => 5,
    'query' => 'Teszt partner'
])->getResponse();

BillingoApi::api('DocumentBlock')->list([
    'page' => 1,
    'per_page' => 5
])->getResponse();

BillingoApi::api('BankAccount')->list([
    'page' => 1,
    'per_page' => 5
])->getResponse();

BillingoApi::api('Products')->list([
    'page' => 1,
    'per_page' => 5
])->getResponse();

$billingoApi->api('Document')->list([
    'page' => 1,
    'per_page' => 25,
    'block_id' => 42432,
    'partner_id' => 13123123,
    'payment_method' => 'cash',
    'payment_status' => 'paid',
    'start_date' => '2020-05-10',
    'end_date' => '2020-05-15',
    'start_number' => '1',
    'end_number' => '10',
    'start_year' => 2020,
    'end_year' => 2020
])->getResponse();

$billingoApi->api('Partner')->list([
    'page' => 1,
    'per_page' => 5
])->getResponse();

$billingoApi->api('Partner')->list([
    'page' => 1,
    'per_page' => 5,
    'query' => 'Teszt partner'
])->getResponse();

$billingoApi->api('DocumentBlock')->list([
    'page' => 1,
    'per_page' => 5
])->getResponse();

$billingoApi->api('BankAccount')->list([
    'page' => 1,
    'per_page' => 5
])->getResponse();

$billingoApi->api('Products')->list([
    'page' => 1,
    'per_page' => 5
])->getResponse();

path: "invoices/11246867.pdf"

BillingoApi::api('Document')->downloadInvoice(INVOICE_ID)->getResponse();

BillingoApi::api('Document')->downloadInvoice(INVOICE_ID, 'PATH', 'EXTENSION')->getResponse();

emails: [
    "[email protected]"
]

BillingoApi::api('Document')->sendInvoice(INVOICE_ID)->getResponse();

$billingoApi->api('Document')->sendInvoice(INVOICE_ID)->getResponse();

[
    public_url: "https://api.billingo.hu/document-access/K3drE0Gvb2eRwQNYlypfasdOlJADB4Y"
]

BillingoApi::api('Document')->getPublicUrl(INVOICE_ID)->getResponse();

$billingoApi->api('Document')->getPublicUrl(INVOICE_ID)->getResponse();

BillingoApi::api('Document')->cancelInvoice(INVOICE_ID)->getResponse();

$billingoApi->api('Document')->cancelInvoice(INVOICE_ID)->getResponse();

BillingoApi::api('Document')->createInvoiceFromProforma(INVOICE_ID)->getResponse();

$billingoApi->api('Document')->createInvoiceFromProforma(INVOICE_ID)->getResponse();

BillingoApi::api('Util')->checkTaxNumber('tax_number')->getResponse();

$billingoApi->api('Util')->checkTaxNumber('tax_number')->getResponse();

BillingoApi::api('Document')->get(INVOICE_ID)->getResponse();

BillingoApi::api('Partner')->get(PARTNER_ID)->getResponse();

BillingoApi::api('Product')->get(PRODUCT_ID)->getResponse();

$billingoApi->api('Document')->get(INVOICE_ID)->getResponse();

$billingoApi->api('Partner')->get(PARTNER_ID)->getResponse();

$billingoApi->api('Product')->get(PRODUCT_ID)->getResponse();

BillingoApi::api('Partner')->delete(PARTNER_ID)->getResponse();

BillingoApi::api('Product')->get(PRODUCT_ID)->getResponse();

$billingoApi->api('Partner')->delete(PARTNER_ID)->getResponse();

$billingoApi->api('Product')->get(PRODUCT_ID)->getResponse();

BillingoApi::api('Partner')->deletePayment(PAYMENT_ID)->getResponse();

$billingoApi->api('Partner')->deletePayment(PAYMENT_ID)->getResponse();

BillingoApi::api('Product')->withHttpInfo()->list(['page' => 1, 'per_page' => 5])->getResponse();

$billingoApi->api('Product')->withHttpInfo()->list(['page' => 1, 'per_page' => 5])->getResponse();