Connect your website with the Taxify API
Add ZayconTaxify to your composer.json
file. If you are not using Composer, you should be. It's an excellent way to manage dependencies in your PHP application.
{
"require": {
"zaycon/taxify": "1.0.*"
}
}
$taxify = new ZayconTaxify\Taxify( '[YOUR_API_KEY]', ZayconTaxify\Taxify::ENV_DEV, TRUE );
$origin_address = new ZayconTaxify\Address();
$origin_address
->setStreet1( '16201 E Indiana Ave' )
->setCity( 'Spokane Valley' )
->setState( 'WA' )
->setPostalCode( '99216' );
$destination_address = new ZayconTaxify\Address();
$destination_address
->setStreet1( '16201 E Indiana Ave' )
->setCity( 'Spokane Valley' )
->setState( 'WA' )
->setPostalCode( '99216' );
$line = new ZayconTaxify\TaxLine();
$line
->setQuantity( 1 )
->setItemKey( 'SKU001' )
->setActualExtendedPrice( 100 )
->setItemDescription( 'Some Product' )
->setItemTaxabilityCode( ZayconTaxify\Code::CODE_FOOD );
$tax = new ZayconTaxify\Tax( $taxify );
$tax
->setDocumentKey( 'Order001' )
->setTaxDate( time() )
->setIsCommitted( TRUE )
->setOriginAddress( $origin_address )
->setDestinationAddress( $destination_address )
->addLine( $line );
$tax_response = $tax->calculateTax();
$tax = new ZayconTaxify\Tax( $taxify );
$tax->setDocumentKey( 'Order001' );
$tax_response = $tax->commitTax();
$tax = new ZayconTaxify\Tax( $taxify );
$tax->setDocumentKey( 'Order001' );
$tax_response = $tax->cancelTax();
$address = new ZayconTaxify\Address( $taxify );
$address
->setStreet1( '16201 E Indiana Ave' )
->setCity( 'Spokane Valley' )
->setState( 'WA' )
->setPostalCode( '99216' )
->verifyAddress();
$account = new ZayconTaxify\Account( $taxify );
$code_types = $account->getCodes();
Developed by Zaycon Fresh