Overview
A Magento Invoice can be transferred from iPaaS.com using an Add/Update sync method. This mapping supports the automated synchronization of Invoice records from iPaaS into Magento via the Invoice API (Transactions).
Mapping Collection Status
Mapping Status: Enabled.
Trigger Events: The sync is triggered by the creation or update of an invoice iPaaS.
ID Format: When manually syncing, the Transaction ID from iPaaS is used.
Conflicting Mappings: This mapping applies only to Invoice. Ensure no other mappings target the same Magento entity to prevent data from being overwritten.
Supported Child Collections
The integration supports the synchronization of the parent Invoice and its related child collections:
Invoice Line: Maps individual product line items.
System Caveats
Magento Caveats
Automatically creates or updates invoices linked to the original order.
Supports customer notification and visibility of invoice comments.
Allows automatic capture for authorized payments if configured.
iPaaS.com Caveats
Sends invoice data with structured metadata (capture, notify, comment, and visibility flags).
Determines whether to create a new invoice or update an existing one through IsInvoiceUpdate.
Setup Requirements
Magento Configuration
OriginalOrderId: Must correspond to a valid Magento order.
Invoice Entity: Must exist when updating; otherwise, iPaaS triggers creation.
Comment Fields: Must align with Magento’s order comment visibility and notification fields.
iPaaS.com Configuration
Type: Must be explicitly set to "Invoice".
Qty: Specifies the number of units invoiced per line item.
TransactionLineEntityId: Used for unique identification of invoice lines.
Authentication & Security
Magento2 API UserName: Used to access iPaaS API for fetching Company and related data.
Magento2 API Key: Used to access iPaaS API for fetching Company and related data
Integration Flow
Trigger & Retrieve Data: iPaaS triggers the mapping when a transaction with Type == "Invoice" is identified.
Determine Invoice Operation:
If IsInvoiceUpdate == true, the mapping updates an existing Magento invoice. Otherwise, a new invoice record is created.
Set Financial Flags: Configure Capture and Notify options dynamically.
Apply Comments: Insert or update invoice comments with visibility and notification preferences.
Sync Line Items: For each invoiced item, map quantities, SKUs, and unique identifiers to Magento.
Mappings
Parent Collection: Magento Invoice From iPaaS
Mapping Filter:
Type == "Invoice"
Mapping Type | Source (iPaaS.com) | Destination (Magento) | Description |
Dynamic Formula |
| IsInvoiceUpdate | This mapping determines whether the transaction should be treated as an invoice. If the isInvoiceUpdate field is not explicitly set, it defaults to true, meaning the transaction is considered an invoice by default. |
Dynamic Formula |
| Capture | This field indicates whether to capture invoices; if true, the invoice will be captured. |
Dynamic Formula |
| Notify | This field indicates whether to notify the customer about invoices. If set to true, an email will be sent to the customer when the invoice is captured. |
Dynamic Formula |
| OriginalOrderId | This mapping contains the original Magento order ID for which the invoice will be created. This field is mandatory and must be provided. |
Dynamic Formula |
| AppendComment | This mapping links the appendComment field to the invoice. If it is set to true, the comment will be appended. |
Dynamic Formula |
| Comment_Value | This mapping assigns the comment that will be appended to the invoice. Note: If the comment value is null, no comment will be added to the invoice. |
Dynamic Formula |
| Comment_Is_Visible_On_Front | This mapping assigns the value to control whether the comment is shown on the front end. If it is true, the comment will be displayed; otherwise, it will not be shown. |
Dynamic Formula |
| Order_Comment_Value | This mapping assigns the comment that will be appended to the original order’s comment section. Note: If the comment value is null, no comment will be added to the order. |
Dynamic Formula |
| Order_Comment_Is_Visible_On_Front | This mapping assigns the value that controls whether the comment is shown on the front end for the original order. If it is true, the comment will be displayed; otherwise, it will not be shown. |
Dynamic Formula |
| Order_Comment_Is_Customer_Notified | This field indicates whether to notify the customer when an invoice has been added to the order. If set to true, an email will be sent to the customer when the invoice is captured for that order. |
Dynamic Formula |
| Order_Comment_Status | This mapping assigns the order status, which can be a custom status defined in Magento, such as "Complete," "Cancelled," or "Processing." Note: Due to a defect in the Magento API, it is currently not possible to set custom order statuses with the "processing" state, even though the UI allows it. Custom statuses with the "processing" state should not be used in this mapping until the API issue is resolved. |
Magento Invoice Line items From iPaaS (Child Collection)
Mapping Type | Source (iPaaS.com) | Destination (Magento) |
Dynamic Formula |
| ParentItemId |
Field | Qty | OrderQty |
Dynamic Formula |
| Sku |
Dynamic Formula |
| InvoiceItemEntityId |
Error Handling
Collection: Invoice (Parent)
Missing OriginalOrderId
Description: The parent order reference is not provided or invalid.
Resolution: Ensure that OriginalOrderId corresponds to an existing Magento order.
Invalid Comment Visibility Flag
Description: Comment visibility flag contains a non-boolean value.
Resolution: Validate comment visibility fields as true/false.
Collection: Invoice Line Items (Child)
Missing SKU or Parent Reference
Resolution: Verify that SKU and ParentItemId fields are correctly mapped in the iPaaS payload.
Invalid Quantity
Resolution: Ensure that Qty is numeric and greater than zero for all invoice lines.
Validation Rules & Testing
Validation Checklist
Type is set to "Invoice".
OriginalOrderId correctly references a valid order in Magento.
Invoice update/create operation correctly determined by IsInvoiceUpdate.
All comments, notifications, and captures configured as per business rules.
Line-level data (Qty, Sku) mapped successfully.
Test Scenarios
Create New Invoice: Send transaction with IsInvoiceUpdate = false: A new invoice should be created in Magento.
Update Existing Invoice: Send transaction with IsInvoiceUpdate = true: Existing invoice is updated.
Invoice with Comment: Send invoice with Comment_Value and Comment_Is_Visible_On_Front = true: Comment should appear in customer portal.
Invalid Order Reference: Send transaction with incorrect OriginalOrderId: Mapping should fail validation.
Additional Notes
The Capture field determines whether the invoice will automatically capture funds for payment transactions.
