Go Back to Parent Doc

Developer Reference

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:

FolderTemplates
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, 2026 or 2026-11), next_number. Numbers are taken with an atomic UPDATE … 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_number and _ipay_vat_number.
  • Dates are site-local Y-m-d H:i:s strings. Convert with ipay_local_to_timestamp(), never strtotime().
  • Files live in uploads/invoice-payment-{random}/ (documents cache, fonts, tmp), protected by .htaccess, index.php and web.config, and always served through a permission check.

Helper functions

FunctionReturns
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

ActionFires when
ipay_loadedAll classes are loaded (Pro boots here).
ipay_installedInstall or upgrade routine finished.
ipay_before_document_generated / ipay_document_generatedBefore / after a numbered document is issued.
ipay_document_deletedA document was deleted.
ipay_invoice_status_changedAny status change: ( $document, $status, $previous ).
ipay_invoice_{status}A document reached a status, e.g. ipay_invoice_paid, ipay_invoice_overdue.
ipay_gateway_invoice_issuedThe invoice of an Invoice Payment order was just issued (the Invoice email is sent here).
ipay_document_servedJust 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_doneAfter the daily overdue / reminder / clean-up task.
ipay_settings_savedA settings section was saved: ( $section ).
ipay_admin_tab_{tab}Render an add-on tab registered with ipay_admin_tabs.
ipay_compat_loadedA third-party integration was booted.

Filters

FilterFilters
ipay_document_typesRegister document types (instances of AbstractDocumentType).
ipay_document_dataThe whole template data array before rendering.
ipay_document_partsThe sections of a document, in print order.
ipay_document_details, ipay_document_item, ipay_items_columns, ipay_document_totals, ipay_document_labels, ipay_document_codesParts of the template data.
ipay_document_cssThe stylesheet.
ipay_templates, ipay_template_pathsRegister templates and template folders.
ipay_document_locale, ipay_document_direction, ipay_rtl_languagesLanguage and direction.
ipay_mpdf_config, ipay_fontdata, ipay_font_packs, ipay_language_fontThe PDF engine and fonts.
ipay_document_filenameThe PDF file name.
ipay_number_format, ipay_number_period, ipay_number_reset_optionsNumbering.
ipay_new_document_dataColumns a new document is stored with.
ipay_attach_document_to_emailWhether a document is attached to an email.
ipay_document_access, ipay_document_urlCustomer access and signed URLs.
ipay_payment_terms_days, ipay_pay_url, ipay_is_order_paidPayment terms and payment state.
ipay_gateway_passes_restrictionsWhether the gateway may be offered.
ipay_send_default_reminderWhether the built-in reminder is sent.
ipay_einvoice_formats, ipay_einvoice_xmlAdd e-invoice formats or supply the XML.
ipay_vat_number_meta_keys, ipay_tracking_numberWhere the VAT and tracking numbers are read from.
ipay_admin_tabs, ipay_settings_sections, ipay_settings_fields, ipay_default_optionsExtend 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

CommandWhat 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 overdueRun the overdue check and send due reminders.
wp ipay clear-cacheDelete 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).

RouteMethodPurpose
/documentsGETList 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}GETOne document.
/documents/{id}/pdfGET{ filename, content } with the PDF Base64-encoded.
/documents/{id}/paymentsGET / POSTList payments / record one (amount, method, reference).
/documents/{id}/sendPOSTEmail the invoice to the customer.
/orders/{id}/documentsPOSTIssue 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.

Shopping Cart
  • Your cart is empty.