1. Go to this page and download the library: Download jafar-albadarneh/jofotara 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/ */
$invoice = new JoFotaraService(
clientId: getenv('JOFOTARA_CLIENT_ID'),
clientSecret: getenv('JOFOTARA_CLIENT_SECRET')
);
$invoice->basicInformation()
->setInvoiceId('INV-001') // Required: Your unique invoice ID
->setUuid('123e4567-...') // Required: UUID v4 format
->setIssueDate('16-02-2025') // Required: Format dd-mm-yyyy
->cash() // Payment method: cash (012)
// or
->receivable() // Payment method: receivable (022)
->setNote('Optional note') // Optional: Invoice note
->setInvoiceCounter(1); // Optional: Sequential counter (ICV)
// Configure default seller info (recommended)
SellerInformation::configureDefaults(
tin: '123456789',
name: 'Your Company'
);
// Or set per invoice
$invoice->sellerInformation()
->setName('Your Company') // Required: Company name
->setTin('123456789'); // Required: Tax ID Number
$invoice->customerInformation()
->setId('987654321', 'TIN') // Required: ID and type (TIN, NIN, or PN)
->setName('Customer Name') // Required for receivables
->setPostalCode('11937') // Optional
->setCityCode('JO-IR') // Optional: Jordan city code
->setPhone('0791234567') // Optional
->setTin('987654321'); // Optional
// Set the supplier income source sequence
$invoice->supplierIncomeSource('123456789');
$invoice = new JoFotaraService('your-client-id', 'your-client-secret');
// Set basic information
$invoice->basicInformation()
->setInvoiceId('INV-001')
->setIssueDate('2024-03-20')
->cash();
// Set seller information
$invoice->sellerInformation()
->setName('Your Company')
->setTin('123456789');
// Set buyer information
$invoice->customerInformation()
->setId('987654321', 'TIN')
->setName('Customer Name');
// Set supplier income source (
bash
# Run the test suite
composer test
# Generate a test invoice
php examples/GenerateGeneralInvoice.php
# On macOS, copy to clipboard
php examples/GenerateGeneralInvoice.php | pbcopy
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.