REST API
The extension provides two kinds of API functionality:
- Add E-Invoice content to Magento Sales APIs (invoice/credit memo GET)
- Custom endpoints to trigger generation (invoice/credit memo + bulk)
Include E-Invoice in Invoice / Credit Memo API
Enable it in Stores >Configuration > MageB2B > E-Invoice > REST API Settings:
- Include E-Invoice in Invoice API
- Include E-Invoice in Credit Memo API
When enabled, GET responses include extension attributes:
extension_attributes.einvoice_xml(XML string)extension_attributes.einvoice_pdf(base64-encoded PDF content, only for hybrid formats)
Examples:
GET /rest/V1/invoices/{invoiceId} GET /rest/V1/creditmemos/{creditmemoId}Trigger Generation via REST
The module registers custom endpoints:
POST /rest/V1/einvoice/invoice/{invoiceId}/generate POST /rest/V1/einvoice/creditmemo/{creditmemoId}/generate POST /rest/V1/einvoice/invoices/generate POST /rest/V1/einvoice/creditmemos/generateNotes:
- These endpoints operate on entity IDs (numeric), not increment IDs.
- Bulk endpoints use
invoiceIdsorcreditmemoIds. - The optional
forceparameter is accepted for backward compatibility.
{ "invoiceIds": [1, 2, 3], "force": true }