iDoklad
iDoklad connects yStore orders to iDoklad, the Czech/Slovak online invoicing service. It registers as an invoice provider for yStore's invoicing system, authenticates against the iDoklad API via OAuth2, and adds an iDoklad section to the Craft control panel with a dashboard, an invoice list, settings, and license pages.
What it does
- Registers an
idokladinvoice provider on yStore's invoicing system (yui\craft\services\sales\InvoiceService::EVENT_REGISTER_INVOICE_PROVIDERS), so iDoklad can act as one of potentially several invoicing backends available to the store. - Authenticates with the iDoklad API using OAuth2 (Client ID, Client Secret, Redirect URI). The plugin walks through the iDoklad authorization flow from its own Settings page and persists the resulting credentials.
- Automatically creates an invoice when an order reaches one of the configured order statuses, or the invoice can be created/updated manually from the order edit page.
- Downloads and stores the generated invoice PDF as a Craft asset, and lets it be re-downloaded later without hitting the iDoklad API again.
- Applies the plugin's Tax Class setting when calculating invoice line, shipping, and payment amounts. VAT is toggled by the store-wide Tax Payer setting (yStore core), not the plugin's own Tax Payer field. The Market (Country), Language, and Rounding type fields exist in the settings form but are not yet read by invoice creation in v1.3.0 -- every invoice is currently created with Slovakia as the contact country and Slovak as the report language, regardless of these settings.
- Adds an iDoklad → Dashboard page with invoice totals (total, this period, this month) and a recent invoices table, and an iDoklad → Invoices page listing every invoice the plugin has created.
- Ships a Diagnostics tab (Settings) with a one-click connection test and a table of the most recent iDoklad API errors pulled from the store's error log.
- Exposes invoice listing, manual creation, and PDF download as MCP tools for AI-agent-driven operations (see Developer API).
Use Cases
Admin / Craft CP
- Configure the iDoklad Client ID, Client Secret, and Redirect URI (API Credentials tab), then click Authentication to complete the OAuth2 handshake with iDoklad. The Redirect URI must be identical, character for character, to the one registered in the iDoklad Developer settings.
- Choose which order statuses should trigger automatic invoice creation (Generate invoice when). The Send Invoice when order is Paid toggle is present in the settings form but has no effect in v1.3.0 -- it is not yet wired to any invoice-sending logic.
- Turn on Show iDoklad Button to add an iDoklad menu button to the order edit page, from which an admin can manually create, update, or download the invoice for that order (see manage-invoice component below).
- Set the invoice Name template (supports
{increment_id}), a formatted invoice Number pattern (YYYY/OOOOplaceholders), and the Due date offset in days. - Set the default Tax Class, which is applied when invoices are created. Tax Payer, Market (Country), Language, and Rounding type are also configurable here but are not yet applied by invoice creation in v1.3.0 -- VAT is controlled by the store-wide Tax Payer setting instead (see Settings for details).
- Toggle whether to show a Signature, Payment Info, and Slovak By Square QR payment code on the generated invoice, and whether the shipping method and payment method should be added as their own line items.
- Check Settings → Diagnostics to run a lightweight Test Connection request against the saved OAuth credentials, and review the last 10 iDoklad API errors recorded in the store logs.
- Review iDoklad → Dashboard for invoice totals and the most recent invoices, or iDoklad → Invoices for the full list (order ID, iDoklad invoice ID, stored asset ID, and a download link) -- both hidden unless Show in CP Section is enabled in the settings sidebar.
- Activate the plugin license from iDoklad → License.
- A Sandbox Mode toggle exists in the settings sidebar, but it is not yet read by the API or invoice services in v1.3.0 -- enabling it does not currently change invoice-creation behavior.
Developer / Integrator
- Read the plugin's settings and services from
Yui\IDoklad\Plugin::getInstance()to build custom invoicing logic on top of the same OAuth credentials, VAT/rounding configuration, and order-status trigger. - Call the
idoklad_get_invoices,idoklad_create_invoice, andidoklad_download_invoiceMCP tools from an AI agent or automation to inspect, trigger, or fetch iDoklad invoices for a given order (see Developer API).
Installation & Requirements
Requirements
- Craft CMS 5
yui/craft-core^1- An iDoklad account with a registered OAuth2 application (Client ID, Client Secret, and an approved Redirect URI)
- Optional:
yui/craft-mcp, for the MCP invoice tools
Installation
composer require yui/craft-idoklad
After installing, enable the plugin in Settings → Plugins, then open iDoklad → Settings and configure at minimum:
- Client ID, Client Secret, and Redirect URI (API Credentials tab) -- from your iDoklad OAuth2 application.
- Click Authentication and complete the iDoklad authorization prompt to store working OAuth credentials.
- Generate invoice when (General tab) -- the order status(es) that should trigger invoice creation.
See Settings for the full field reference.
Documentation
- Settings -- full settings reference, organized by CP form tab
- Developer API -- services, invoice provider, order-edit component, and MCP tools
- Release Notes -- version history