PHP code example of alphaolomi / simplify-vfd

1. Go to this page and download the library: Download alphaolomi/simplify-vfd 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/ */

    

alphaolomi / simplify-vfd example snippets


use Alphaolomi\SimplifyVfd\SimplifyVfd;

$config = [
    'environment' => 'stage', // or 'live'
    'username' => 'your_username',
    'password' => 'your_password',
];
$service = new SimplifyVfd($config, $client);

$data = [
    'username' => 'your_username',
    'password' => 'your_password'
];

$response = $service->userLogin($data);
print_r($response);

$data = [
    'dateTime' => date('Y-m-d'),
    'customer' => [
        'identificationType' => 'ID',
        'identificationNumber' => '1234567890',
        'vatRegistrationNumber' => '123456789',
        'name' => 'Customer Name',
        'mobileNumber' => '255123456789',
        'email' => '[email protected]',
    ],
    'invoiceAmountType' => 'GROSS',
    'items' => [
        [
            'itemName' => 'Product 1',
            'quantity' => 1,
            'price' => 100.00
        ]
    ],
    'payments' => [
        [
            'paymentType' => 'CASH',
            'amount' => 100.00
        ]
    ],
    'partnerInvoiceId' => 'unique-invoice-id'
];

$response = $service->createIssuedInvoice($data);
print_r($response);

$partnerInvoiceId = 'unique-invoice-id';

$response = $service->getInvoiceByPartnerInvoiceId($partnerInvoiceId);
print_r($response);