SoftBlaze

API Reference

FakturaPL integrates with PrestaShop via hooks and provides several integration points for developers.

PrestaShop Hooks

FakturaPL registers the following hooks:

| Hook | Purpose | |---|---| | actionOrderStatusPostUpdate | Triggers invoice actions based on status change rules | | actionOrderSlipAdd | Creates correction invoice when a credit slip is generated | | displayAdminOrderSide | Adds the FakturaPL panel to the order detail page | | displayOrderDetail | Shows invoice info on the customer's order page | | displayCustomerAccount | Adds "My Invoices" link to customer account | | actionAdminOrdersListingFieldsModifier | Adds invoice column to the admin orders list |

Configuration Access

All module settings are stored in PrestaShop's ps_configuration table with the prefix FAKTURAPL_.

// Read a setting
$apiToken = Configuration::get('FAKTURAPL_API_TOKEN');
 
// Check if module is configured
$isConnected = Configuration::get('FAKTURAPL_API_CONNECTED');

Invoice Data Structure

FakturaPL stores invoice metadata in a custom database table ps_fakturapl_invoices:

| Column | Type | Description | |---|---|---| | id_invoice | int | Auto-increment primary key | | id_order | int | PrestaShop order ID | | fakturownia_id | int | Invoice ID in Fakturownia | | invoice_number | varchar | Full invoice number (e.g., "FV 2026/03/001") | | invoice_type | varchar | Type: vat, proforma, receipt, correction | | status | varchar | Status: issued, sent, paid, cancelled | | pdf_url | text | URL to download the PDF | | date_add | datetime | When the record was created |

Webhook Endpoint

When webhook sync is enabled, FakturaPL registers a webhook receiver at:

https://yourstore.com/module/fakturapl/webhook

The webhook verifies the request signature using the shared secret configured in the Advanced tab.

Error Handling

All hook methods are wrapped in try/catch blocks. Errors are logged to PrestaShop's logger:

PrestaShopLogger::addLog(
    'FakturaPL: ' . $errorMessage,
    3, // severity: error
    null,
    'FakturaPL',
    $orderId
);

You can view these logs in Advanced Parameters β†’ Logs and filter by "FakturaPL".