Overview
This document outlines the configuration for automatically synchronizing Order Header records from the Magento Order Header entity to the iPaaS Transaction entity. The integration uses an API-based sync that triggers whenever an Order Header record is created in Magento.
Mapping Collection Status
Mapping Status: Enabled.
Trigger Events: The sync is triggered by the creation of Order Headers in Magento.
ID Format: When manually syncing, the Order Header ID from iPaaS is used. This can be resolved via an external ID.
Conflicting Mappings: This mapping applies only to Order Headers. 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 Order Header and its related child collections:
System Caveats
Magento Caveats
Processes only non-deposit transactions (i.e., transactions not ending with “-D”).
Excludes gift card transactions (ending with “-GC”) and fraudulent orders (with status “suspected_fraud” or “fraud”).
Provides all necessary totals and order details for deposit synchronization.
iPaaS Caveats
Receives order records with all associated child records (Lines, Payments, Taxes).
Sets the deposit record status to Pending by default.
Links Order Headers to their parent transactions via the ParentId field.
Setup Requirements
Magento Configuration
IncrementId: Must not end with “-D” or “-GC”.
Status: Orders marked as “suspected_fraud” or “fraud” are excluded.
Subtotal, TaxAmount, ShippingAmount, DiscountAmount: Required for total calculation.
iPaaS Configuration
SystemId: Derived using SpaceportSystemId.
ParentId: Retrieved dynamically through lookup for transaction association.
Transaction Type: Always set as “Order”.
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
Retrieve Data: Fetch orders from Magento matching the filter conditions.
Apply Filter: Only transactions (!IncrementId.EndsWith("-D") && !IncrementId.EndsWith("-GC") && !(Status == "suspected_fraud") && !(Status == "fraud")) are processed.
Map Fields: Populate fields such as TransactionNumber, Subtotal, Total, and Tax.
Resolve Parent Reference: Fetch related parent transaction via GetSpaceportParentTransactionIdAsync.
Send to iPaaS: Create Order Header record with child records (Lines, Payments, and Taxes).
Mappings
Order Header (Parent)
Filter
!IncrementId.EndsWith("-D") && !IncrementId.EndsWith("-GC") && !(Status == "suspected_fraud") && !(Status == "fraud")
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Dynamic Formula |
| SystemId |
Field | IncrementId | TransactionNumber |
Static | Order | Type |
Lookup Translation | Status | |
Field | CustomerEmail | EmailAddress |
Field | DiscountAmount | DiscountAmount |
Field | TaxAmount | TaxAmount |
Field | ShippingAmount | ShippingAmount |
Field | Subtotal | Subtotal |
Field | GrandTotal | Total |
Field | TotalQtyOrdered | TotalQty |
Dynamic Formula |
| TransactionCreatedDateTime |
Order Bill Address To iPaaS (Child Collection)
Filter
AddressType == "billing"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Static | true | IsPrimaryBilling |
Dynamic Formula |
| Address1 |
Dynamic Formula |
| Address2 |
Dynamic Formula |
| Address3 |
Field | City | City |
Field | RegionCode | Region |
Field | CountryId | Country |
Field | PostCode | PostCode |
Field | FirstName | FirstName |
Field | LastName | LastName |
Field | Company | Company |
Order Header Line To iPaaS (Child Collection)
Filter
IsEmpty(ParentItemId) && ProductType != "giftvoucher"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Field | SellUnit | SellingUnit (custom field) |
Dynamic Formula |
| Type |
Static | Pending | Status |
Dynamic Formula |
| Sku |
Field | Description | Description |
Field | QtyOrdered | Qty |
Dynamic Formula |
| UnitPrice |
Field | RowTotal | ExtendedPrice |
Field | OriginalPrice | OriginalUnitPrice |
Field | DiscountAmount | DiscountAmount |
Field | DiscountPercent | DiscountPercent |
Field | TaxPercent | TaxPercent |
Field | TaxAmount | EstimatedTaxAmount |
Field | Weight | Weight |
Order Line To iPaaS - Gift Card (Child Collection)
Filter
ProductType == "giftvoucher"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Field | giftcardshippedtorecipient (custom field) | Giftcard Shippedto Recipient(custom field) |
Field | giftcardnumber(custom field) | Giftcard Number(custom field) |
Field | giftcardcustommessage(custom field) | Giftcard Message(custom field) |
Dynamic Formula |
| LineInfo |
Dynamic Formula |
| Type |
Static | Pending | Status |
Dynamic Formula |
| Sku |
Field | Description | Description |
Field | QtyOrdered | Qty |
Dynamic Formula |
| UnitPrice |
Field | RowTotal | ExtendedPrice |
Field | OriginalPrice | OriginalUnitPrice |
Field | DiscountAmount | DiscountAmount |
Field | DiscountPercent | DiscountPercent |
Field | TaxPercent | TaxPercent |
Field | Weight | Weight |
Order Payment To iPaaS (Child Collection)
Filter
Method != "giftcard"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Lookup Translation | Method | |
Field | Method | Description |
Dynamic Formula |
| Amount |
Dynamic Formula |
| Status |
Order Payment To iPaaS -Gift Card (Child Collection)
Filter
Method=="giftcard"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Field | authcode (custom field) | AuthCode (custom field) |
Field | giftcardnumber (custom field) | Giftcard Number (custom field) |
Dynamic Formula |
| MethodInfo |
Lookup Translation | Method | |
Field | Method | Description |
Dynamic Formula | (Parent.Status == "pending" ? (ConvertToDecimal(AmountOrdered)-GiftCardSoldTotal(Parent.Items)) : (ConvertToDecimal(AmountPaid)-GiftCardSoldTotal(Parent.Items))) | Amount |
Static | Complete | Status |
Order Ship Address To iPaaS - Flat Rate - Fixed (Child Collection)
Filter
AddressType == "shipping" && Parent.ShippingDescription=="Flat Rate - Fixed"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Static | true | IsPrimaryShipping |
Dynamic Formula |
| Address1 |
Dynamic Formula |
| Address2 |
Dynamic Formula |
| Address3 |
Field | City | City |
Field | RegionCode | Region |
Field | CountryId | Country |
Field | PostCode | PostCode |
Static | UPS GROUND | ShippingMethod |
Field | FirstName | FirstName |
Field | LastName | LastName |
Field | Company | Company |
Order Ship Address To iPaaS - Unmapped (Child Collection)
Filter
AddressType == "shipping" && !(Parent.ShippingDescription == "Flat Rate - Fixed") && !(Parent.ShippingDescription == "Free Shipping - Free")
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Static | true | IsPrimaryShipping |
Dynamic Formula | (Street.Count > 0 ? Street[0] : Coalesce(Street, "")) | Address1 |
Dynamic Formula | (Street.Count > 1 ? Street[1] : "") | Address2 |
Dynamic Formula | (Street.Count > 2 ? Street[2] : "") | Address3 |
Field | City | City |
Field | RegionCode | Region |
Field | CountryId | Country |
Field | PostCode | PostCode |
Static | UPS GROUND | ShippingMethod |
Field | FirstName | FirstName |
Field | LastName | LastName |
Field | Company | Company |
Order Ship Address To iPaaS - Free Shipping (Child Collection)
Filter
AddressType == "shipping" && Parent.ShippingDescription=="Free Shipping - Free"
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Static | true | IsPrimaryShipping |
Dynamic Formula |
| Address1 |
Dynamic Formula |
| Address2 |
Dynamic Formula |
| Address3 |
Field | City | City |
Field | RegionCode | Region |
Field | CountryId | Country |
Field | PostCode | PostCode |
Static | UPS GROUND | ShippingMethod |
Field | FirstName | FirstName |
Field | LastName | LastName |
Field | Company | Company |
Order Header Tax To iPaaS (Child Collection)
Mapping Type | Source Field (Magento) | Destination Field (iPaaS) |
Dynamic Formula |
| Authority |
Dynamic Formula |
| Amount |
Lookup Translations
M2 Transaction Payment Method To iPaaS
Source Field (Magento) | Destination Field (iPaaS) |
authnetcim | CASH |
authorizenet | CASH |
braintree | CASH |
checkmo | CASH |
paypal_express | CASH |
purchaseorder | CASH |
giftcard | GC |
M2 Transaction Status Method To iPaaS
Source Field (Magento) | Destination Field (iPaaS) |
pending | Pending |
processing | Pending |
complete | Complete |
canceled | Cancelled |
completing | Complete |
ready_for_completion | Pending |
Error Handling
Collection: Order Header Line (Child)
Error: Missing SKU or Product Type
Resolution: Ensure all line items contain valid SKU and product type fields.
Collection: Payment (Child)
Error: Payment Method Lookup Failure
Resolution: Verify the payment method exists in the M2 Transaction Payment Method Lookup mapping.
Validation Rules & Testing
Validation Rules
The transaction number must not end with “-D” or “-GC”
Fraudulent and gift card orders excluded.
All totals (Subtotal, Tax, Shipping, Discount) correctly computed.
Payment and line details correctly linked to parent ticket.
Test Scenarios
Create a valid order: Order record should appear in iPaaS.
Send order with “-GC”: Skipped by filter.
Include invalid totals: Mapping should throw validation error.
Send payment with gift card: Routed to Gift Card Payment child mapping
Additional Notes
All child records (Line, Payment, Tax) must reference a valid parent via ParentId.
