PHP code example of oscar-team / avatax-laravel

1. Go to this page and download the library: Download oscar-team/avatax-laravel 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/ */

    

oscar-team / avatax-laravel example snippets


composer 

php artisan vendor:publish --provider="OscarTeam\AvaTax\AvaTaxServiceProvider"

use OscarTeam\AvaTax\Facades\AvaTax;
use Avalara\DocumentType;

// Create a new transaction
$transaction = AvaTax::createTransaction([
    'companyCode' => 'DEFAULT',
    'type' => DocumentType::C_SALESINVOICE,
    'customerCode' => 'ABC',
    'addresses' => [
        'SingleLocation' => [
            'line1' => '123 Main Street',
            'city' => 'Irvine',
            'region' => 'CA',
            'postalCode' => '92615',
            'country' => 'US'
        ]
    ],
    'lines' => [
        [
            'amount' => 100.0,
            'quantity' => 1,
            'itemCode' => 'P0000000'
        ]
    ]
]);

echo '<pre>' . json_encode($transaction, JSON_PRETTY_PRINT) . '</pre>';