Invoice Payment is built to be extended — the Pro add-on itself uses only these public hooks. Text domain: invoice-payment; namespace: InvoicePayment; function, hook and option prefix: ipay_; order meta prefix: _ipay_; constants: IPAY_*. Pro uses ipayp_, InvoicePaymentPro and IPAY_PRO_*.
Template overrides
Copy any file from the plugin’s templates/ folder into yourtheme/woocommerce/, keeping the same relative path. See Templates, Languages & RTL for the document files. Others:
| Folder | Templates |
|---|---|
emails/, emails/plain/ | ipay-invoice.php, ipay-payment-reminder.php (Pro: ipayp-upcoming-payment.php, ipayp-document-copy.php) |
myaccount/ | ipay-invoices.php |
ipay-documents/partials/ | Pro adds payments.php and pick-items.php |
Document templates receive one variable, $data — the array built by InvoicePayment\DocumentData::get(): order, document, type_object, labels, shop, details, columns, items, totals, payment, codes, direction, start / end (left / right, swapped for RTL), parts and more. Templates never need to read the order themselves. Print a section with ipay_document_part( 'items', $data ).
Data model
- Documents table
{prefix}ipay_documents— one row per issued numbered document:order_id,type,number,formatted_number,date_issued,date_due,date_paid,status,total,currency,customer_id,meta(JSON). - Sequences table
{prefix}ipay_sequences—type,period(all,2026or2026-11),next_number. Numbers are taken with an atomicUPDATE … LAST_INSERT_ID(). - Payments table
{prefix}ipay_payments—document_id,amount,method,reference,note,date_created. - Order meta mirrors the key fields:
_ipay_invoice_number,_ipay_invoice_date,_ipay_invoice_status,_ipay_invoice_due, plus_ipay_po_numberand_ipay_vat_number. - Dates are site-local
Y-m-d H:i:sstrings. Convert withipay_local_to_timestamp(), neverstrtotime(). - Files live in
uploads/invoice-payment-{random}/(documents cache, fonts, tmp), protected by.htaccess,index.phpandweb.config, and always served through a permission check.
Helper functions
| Function | Returns |
|---|---|
ipay_get_document( $order, $type = 'invoice' ) | The stored InvoicePayment\Document, or null. |
ipay_get_invoice_number( $order ) | The formatted invoice number, or ''. |
ipay_get_document_url( $order, $type, $args ) | A document URL: context = admin (nonce) or customer (signed); output = inline, download, html or xml. |
ipay_get_document_types( $only_enabled ) / ipay_get_document_type( $id ) | Registered document types. |
ipay_get_invoice_statuses() | Status labels keyed by slug. |
ipay_get_option( $name ) / ipay_is_enabled( $name ) | Plugin options with their defaults (name without ipay_). |
ipay_price( $amount, $currency ) / ipay_price_text() | Price HTML / plain text in a given currency. |
ipay_local_to_timestamp( $date ), ipay_format_date( $date ) | Date helpers. |
ipay_is_rtl_locale( $locale ) | Whether a locale is written right to left. |
ipay_is_pro_active() | Whether Pro is running. |
Classes worth knowing: Generator::generate( $order, $type ) issues (or returns) a document; Renderer::get_pdf( $order, $type ), Renderer::get_bulk_pdf( $orders, $type ) and Renderer::html_to_pdf( $html, $args ) return PDF bytes or a WP_Error; Payments::mark_paid( $document, $args ) / mark_unpaid(); InvoiceStatus::set( $document, $status ).
Actions
| Action | Fires when |
|---|---|
ipay_loaded | All classes are loaded (Pro boots here). |
ipay_installed | Install or upgrade routine finished. |
ipay_before_document_generated / ipay_document_generated | Before / after a numbered document is issued. |
ipay_document_deleted | A document was deleted. |
ipay_invoice_status_changed | Any status change: ( $document, $status, $previous ). |
ipay_invoice_{status} | A document reached a status, e.g. ipay_invoice_paid, ipay_invoice_overdue. |
ipay_gateway_invoice_issued | The invoice of an Invoice Payment order was just issued (the Invoice email is sent here). |
ipay_document_served | Just before a document is sent to the browser. |
ipay_document_before_{part} / ipay_document_after_{part} | Around each section of a document. |
ipay_document_part_{part} | For a section that has no template file — print your own section. |
ipay_daily_tasks_done | After the daily overdue / reminder / clean-up task. |
ipay_settings_saved | A settings section was saved: ( $section ). |
ipay_admin_tab_{tab} | Render an add-on tab registered with ipay_admin_tabs. |
ipay_compat_loaded | A third-party integration was booted. |
Filters
| Filter | Filters |
|---|---|
ipay_document_types | Register document types (instances of AbstractDocumentType). |
ipay_document_data | The whole template data array before rendering. |
ipay_document_parts | The sections of a document, in print order. |
ipay_document_details, ipay_document_item, ipay_items_columns, ipay_document_totals, ipay_document_labels, ipay_document_codes | Parts of the template data. |
ipay_document_css | The stylesheet. |
ipay_templates, ipay_template_paths | Register templates and template folders. |
ipay_document_locale, ipay_document_direction, ipay_rtl_languages | Language and direction. |
ipay_mpdf_config, ipay_fontdata, ipay_font_packs, ipay_language_font | The PDF engine and fonts. |
ipay_document_filename | The PDF file name. |
ipay_number_format, ipay_number_period, ipay_number_reset_options | Numbering. |
ipay_new_document_data | Columns a new document is stored with. |
ipay_attach_document_to_email | Whether a document is attached to an email. |
ipay_document_access, ipay_document_url | Customer access and signed URLs. |
ipay_payment_terms_days, ipay_pay_url, ipay_is_order_paid | Payment terms and payment state. |
ipay_gateway_passes_restrictions | Whether the gateway may be offered. |
ipay_send_default_reminder | Whether the built-in reminder is sent. |
ipay_einvoice_formats, ipay_einvoice_xml | Add e-invoice formats or supply the XML. |
ipay_vat_number_meta_keys, ipay_tracking_number | Where the VAT and tracking numbers are read from. |
ipay_admin_tabs, ipay_settings_sections, ipay_settings_fields, ipay_default_options | Extend the admin screens and settings. |
Adding a document type
class My_Warranty_Card extends \InvoicePayment\DocumentTypes\AbstractDocumentType {
public function get_id() { return 'warranty_card'; }
public function get_label() { return __( 'Warranty Card', 'my-plugin' ); }
public function get_parts() { return array( 'header', 'parties', 'items', 'footer' ); }
public function get_template_file() { return 'packing-slip.php'; }
}
add_filter( 'ipay_document_types', function ( $types ) {
$types[] = new My_Warranty_Card();
return $types;
} );
The new document gets its settings block, order-screen button, print button and bulk action automatically.
WP-CLI
| Command | What it does |
|---|---|
wp ipay generate <order_id>... [--type=invoice] | Issue a document for orders. |
wp ipay export <order_id> <file> [--type=invoice] | Save a PDF to a file. |
wp ipay overdue | Run the overdue check and send due reminders. |
wp ipay clear-cache | Delete the cached PDFs. |
wp ipay fonts list / wp ipay fonts install <pack> | Manage font packs. |
wp ipay migrate --from=wpo|webtoffee [--skip-settings] | Import from another invoice plugin. |
REST API (Pro)
Namespace invoice-payment/v1. Every route requires the manage_woocommerce capability (cookie + nonce, application passwords or WooCommerce API keys).
| Route | Method | Purpose |
|---|---|---|
/documents | GET | List documents. Filters: type, status (or unpaid), customer_id, order_id, date_from, date_to, search, page, per_page. Total in X-WP-Total. |
/documents/{id} | GET | One document. |
/documents/{id}/pdf | GET | { filename, content } with the PDF Base64-encoded. |
/documents/{id}/payments | GET / POST | List payments / record one (amount, method, reference). |
/documents/{id}/send | POST | Email the invoice to the customer. |
/orders/{id}/documents | POST | Issue a document (type, default invoice). |
Webhook payloads use the same document shape: id, type, number, order_id, customer_id, status, total, amount_paid, amount_due, currency, date_issued, date_due, date_paid, customer. Verify them with hash_hmac( 'sha256', $raw_body, $secret ) against the X-IPay-Signature header.