1. Go to this page and download the library: Download hazem7575/zatca 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/ */
hazem7575 / zatca example snippets
Hazem\Zatca\ZatcaServiceProvider::class,
use Hazem\Zatca\Traits\HasZatcaDevice;
class Store extends Model
{
use HasZatcaDevice;
}
// Check if submitted
if ($order->isSubmittedToZatca()) {
// Get status
$status = $order->getZatcaStatus();
// Check for errors
if ($order->hasZatcaErrors()) {
$errors = $order->getZatcaErrors();
}
}
device(); // Get device relationship
registerZatcaDevice(); // Register new device
active(); // Activate device
hasZatcaDevice(); // Check device existence
getLatestZatcaDevice(); // Get latest device
scopeHasZatca(); // Query scope for models with active devices
scopeDoesntHaveZatca(); // Query scope for models without active devices
// Basic Methods
order(); // Get order relationship
prepareZatcaInvoiceData(); // Prepare invoice data ( // Check submission status
getZatcaStatus(); // Get invoice status
hasZatcaErrors(); // Check for errors
getZatcaErrors(); // Get error details
// Hash Management Methods
update_last_hash($hash); // Update the last invoice hash
last_hash(); // Get the last invoice hash (with default)
// Required Fields for prepareZatcaInvoiceData():
// - invoice_number
// - total_amount
// - vat_amount
// - is_pos
// - is_invoice
// - items
// - date
// Optional Fields:
// - buyer_name
// - buyer_tax_number
// - buyer_address
// - buyer_city
// - buyer_state
// - buyer_postal
// - buyer_building_no