Skip to main content

PayFabric from iPaaS.com Invoice Mapping Documentation

PayFabric from iPaaS.com Invoice Mapping Documentation

PayFabric invoices can be created and updated from iPaaS.com transactions through manual sync or automatic outbound transfers. When a transaction is created or updated in iPaaS.com, the integration writes the invoice header to PayFabric through the Receivables Sync API, along with its address and line items.

ID Format

Manual Sync ID Format

On the iPaaS.com Manual Sync page, enter the iPaaS.com Transaction Id of the invoice to transfer.

External ID Format

After a successful transfer, iPaaS.com records the PayFabric InvoiceId as the external id on a dedicated external-id record, which routes subsequent updates to the same PayFabric invoice. The default template also maps the transaction number into InvoiceId, which provides visibility on the PayFabric record and serves as a fallback match when no external-id record yet exists.

Deleted Record Support

Outbound delete is not supported for this collection or its children. The Invoice, Invoice Address, and Invoice Item models' delete operations are not implemented, delete mappings are not included in the default templates, and deleting a transaction in iPaaS.com does not remove the corresponding invoice in PayFabric.

Custom Field Support

PayFabric invoices expose no subscriber-mappable destination custom fields. However, several invoice values are sourced from iPaaS.com transaction custom fields and should be populated on the transaction for complete invoices: Currency, Batch Number, Payment Terms, and Due Date.

Mapping Collection Status

Status: Enabled (gated by the parent filter below)

Trigger Events: Transaction Create, Transaction Update (subscribed under Outbound Data Flows as transaction/created and transaction/updated). Manual Sync is also available at any time.

Duplicate or Conflicting Mappings

Update PayFabric Invoice Refund FROM iPaaS.com operates on the same iPaaS.com Transaction entity but handles the refund path. The two collections are complementary through their filters: this collection skips refund-flagged transactions, and the refund collection processes only refund-flagged transactions. Review both filters before customizing either so a transaction is processed by exactly one path.

Supported Child Collections

  • Add/Update PayFabric Invoice Address FROM iPaaS.com — writes the invoice's billing/shipping address.

  • Add/Update PayFabric Invoice Item FROM iPaaS.com — writes the invoice line items; each line references the parent invoice number.

Both are invoked as part of this parent's transfer.

System Caveats

PayFabric Caveats

  • The transaction Type must map to a valid PayFabric InvoiceType; non-invoice types are filtered out.

  • Currency code maximum length is 10.

  • Line item ItemCode must not exceed 50 characters (enforced by the line-item child).

iPaaS.com Caveats

  • The invoice's customer or company is resolved by external-id lookup during the transfer; the related customer/company should be transferable to PayFabric so the invoice associates with the correct PayFabric customer.

Setup Requirements

PayFabric Configuration

  • Set Integration Method to API only in the PayFabric portal.

iPaaS.com Configuration

Integration Flow

  1. A transaction is created or updated in iPaaS.com, or is manually synced by Transaction Id.

  2. The collection filter evaluates the transaction (see the Mapping Filter below). Refund-flagged transactions are skipped here and handled by the refund collection.

  3. The customer or company is resolved by external-id lookup (customer first, then company).

  4. The invoice header is created or updated in PayFabric via POST /receivables/sync/api/{PortalName}/api/invoices.

  5. The invoice address and line items are written through the child collections during the same transfer.

  6. The PayFabric InvoiceId is recorded as the external id so later transfers update the same invoice.

Mappings

Add/Update PayFabric Invoice FROM iPaaS.com

Mapping Filter

bool isValid = Type == "Invoice" && (CustomerId != null || CompanyId != null);if (!string.IsNullOrEmpty(await GetExternalIdAsync(Id, "Transaction", SpaceportSystemId)))
{
    if (Payments?.Count > 0)
    {
        isValid = isValid &&
            Payments.All(p =>
                string.IsNullOrEmpty(GetCustomFieldValue(p.CustomFields, "IsRefundable")?.ToString()) ||
                GetCustomFieldValue(p.CustomFields, "IsRefundable")?.ToString().ToLower() != "true"
            ) &&
            Payments.All(p =>
                string.IsNullOrEmpty(GetCustomFieldValue(p.CustomFields, "AlreadyRefunded")?.ToString()) ||
                GetCustomFieldValue(p.CustomFields, "AlreadyRefunded")?.ToString().ToLower() != "true"
            );
    }
    // else: Payments.Count == 0, skip payment checks, still valid if Type/CustomerId/CompanyId is okay
}return isValid;

Filter Description. A transaction is processed only when its Type is Invoice and it has a CustomerId or a CompanyId. If the invoice already exists in PayFabric (an external id is linked for the Transaction) and any of its payments is flagged refundable (IsRefundable is true) or already refunded (AlreadyRefunded is true), the transaction is treated as a refund and skipped here — the refund collections handle it. Transactions with no payments still pass when the Type and Customer/Company conditions are met. This prevents a refund update from being reprocessed as an ordinary invoice write.

Description. Creates or updates the PayFabric invoice header from the iPaaS.com transaction.

Mapping Type

Source Field (iPaaS.com)

Destination Field (PayFabric)

Description

Field

TransactionNumber

InvoiceId

Required. The PayFabric invoice identifier; used to link the invoice for updates and refunds.

Field

Type

InvoiceType

Required. Must resolve to a valid PayFabric invoice type.

Dynamic Formula

external-id lookup (see formula below)

CustomerId

Required. The PayFabric customer for the invoice; resolves the transaction's Customer external id, falling back to the Company external id.

Dynamic Formula

external-id lookup (see formula below)

InvoicedToCustomerID

The bill-to customer, resolved by the same lookup as CustomerId.

Field

Total

Amount

The invoice total amount.

Field

Total

BalanceDue

The outstanding balance, initialized from the transaction Total.

Field

Subtotal

SubTotal

The invoice subtotal.

Field

TaxAmount

Tax

The total tax amount.

Field

ShippingAmount

Freight

The freight (shipping) amount.

Field

DiscountAmount

Discount

The discount amount.

Field

Type

DocumentType

The document type, from the transaction Type.

Field

EmailAddress

Email

The email address associated with the invoice.

Field

Custom.Currency

Currency

Optional. PayFabric currency code from the iPaaS.com Currency custom field (maximum 10 characters).

Field

Custom.Batch Number

BatchNumber

Optional. From the iPaaS.com Batch Number custom field.

Field

Custom.Payment Terms

PaymentTerms

Optional. From the iPaaS.com Payment Terms custom field; the terms should already exist in PayFabric.

Dynamic Formula

Due Date custom field (see formula below)

DueDate

Optional. Parsed from the Due Date custom field; left blank if missing or invalid.

Dynamic Formula

TransactionCreatedDateTime?.UtcDateTime;

PostingDate

The invoice posting date, from the transaction created date/time (UTC).

Dynamic Formula

FieldFromFirstMatch(Addresses, "IsPrimaryShipping == true", "ShippingMethod");

ShippingMethod

The shipping method from the primary shipping address.

Lookup

Lookup Translation: PayFabric Invoice Status FROM iPaaS.com

Status

Translates the iPaaS.com transaction status to a PayFabric invoice status.

Dynamic Formula

aggregate of Notes (see formula below)

Comments

All transaction note texts joined by commas; empty when there are none.

Dynamic Formula

aggregate of Tracking (see formula below)

TrackingNumber

All tracking numbers joined by commas; empty when there are none.

CustomerId / InvoicedToCustomerID formula:

var ExternlCustomerID = await GetExternalIdAsync(CustomerId, "Customer", SpaceportSystemId);
if(ExternlCustomerID == null || ExternlCustomerID == ""){
    return await GetExternalIdAsync(CompanyId, "Company", SpaceportSystemId);
}
return ExternlCustomerID;

DueDate formula:

var dueDate = GetCustomFieldValue(CustomFields, "Due Date");
if (!string.IsNullOrEmpty(dueDate)){
    if (DateTime.TryParse(dueDate, out DateTime parsedDate)){
        return parsedDate;
    }
}
return null;

Comments formula:

if (Notes != null && Notes.Count > 0)
{
    var comments = string.Join(", ", Notes
        .Where(n => n != null && !string.IsNullOrWhiteSpace(n.Text))
        .Select(n => n.Text));    return comments;
}

TrackingNumber formula:

if (Tracking != null && Tracking.Count > 0)
{
    var trackingNumbers = string.Join(", ", Tracking
        .Where(t => t != null && !string.IsNullOrWhiteSpace(t.TrackingNumber))
        .Select(t => t.TrackingNumber));    return trackingNumbers;
}

Lookup Translation — PayFabric Invoice Status FROM iPaaS.com. The transaction Status is translated to the PayFabric invoice Status through this translation collection. The value pairs are configured per environment; review them in iPaaS.com to confirm they match your PayFabric status set before relying on the mapping in production.

Add/Update PayFabric Invoice Address FROM iPaaS.com

Description. Writes the invoice's billing/shipping address. This collection has no mapping filter.

Mapping Type

Source Field (iPaaS.com)

Destination Field (PayFabric)

Description

Field

Id

AddressID

Required. The PayFabric invoice address identifier, from the iPaaS.com transaction address Id.

Field

Address1

Address1

The first address line.

Field

Address2

Address2

The second address line. Optional.

Field

Address3

Address3

The third address line. Optional.

Field

City

City

The city.

Field

Region

State

The state or region.

Field

PostalCode

Zip

The postal/ZIP code.

Field

Country

Country

The country.

Dynamic Formula

first + last name (see formula below)

Name

The address contact name.

Field

IsPrimaryBilling

IsDefaultBilling

Designates the billing address.

Field

IsPrimaryShipping

IsDefaultShipping

Designates the shipping address; the primary shipping address also supplies the invoice ShippingMethod.

Name formula:

string name = string.Empty;if(!string.IsNullOrWhiteSpace(FirstName))
name = FirstName;
if(!string.IsNullOrWhiteSpace(LastName))
name += " " + LastName;
if(!string.IsNullOrWhiteSpace(name))
return name;

Add/Update PayFabric Invoice Item FROM iPaaS.com

Description. Writes the invoice line items. This collection has no mapping filter.

Mapping Type

Source Field (iPaaS.com)

Destination Field (PayFabric)

Description

Dynamic Formula

string.IsNullOrEmpty(Sku) ? Sku : Sku.Substring(0, Math.Min(Sku.Length, 50));

ItemCode

Required. The PayFabric item code, derived from the SKU and truncated to 50 characters to satisfy PayFabric's length limit.

Dynamic Formula

Parent.TransactionNumber;

InvoiceNumber

Required. Set to the parent invoice's transaction number so the line attaches to the correct invoice.

Field

Description

Description

The line-item description.

Field

Qty

Quantity

The quantity ordered.

Field

UnitPrice

UnitPrice

The per-unit price.

Field

ExtendedPrice

ExtendedPrice

The extended price (quantity times unit price).

Field

EstimatedTaxAmount

TaxAmount

The line tax amount.

Field

SequenceNumber

Sequence

The line sequence number, controlling line order.

Dynamic Formula

return $"Type of the line item is: {Type} and Status is: {Status}.";

Comment

A descriptive comment composed from the line item's type and status.

Error Handling

  • "PayFabric Invoice could not be created" — Appears in the iPaaS.com Error Logs when PayFabric rejects the invoice create. Confirm the InvoiceType resolves, the customer/company is linked, and required amounts are present.

  • "PayFabric Invoice could not be updated" — Appears when PayFabric rejects the invoice update. Verify the invoice exists in PayFabric and the mapped values are valid.

Testing & Validation

Test Scenarios

  1. Create an Invoice-type transaction with a customer, line items, and an address in iPaaS.com; verify the invoice, its lines, and address appear in PayFabric.

  2. Update the invoice total or a line item and verify the change propagates to the same PayFabric invoice.

  3. Verify the filter: a transaction whose Type is not Invoice, or that has no Customer/Company, is not transferred.

  4. Verify a refund-flagged transaction (payment with IsRefundable = true) is skipped by this collection.

  5. Manually sync an invoice by its iPaaS.com Transaction Id and confirm success.

  6. Verify a line-item SKU longer than 50 characters is truncated to a valid ItemCode without error.

Validation Checklist

  • InvoiceType resolves to a valid PayFabric type.

  • CustomerId/Company external-id lookup returns the expected PayFabric customer.

  • Currency and the Status translation have been reviewed for the target environment.

Additional Notes

  • The same transaction must not be processed by both this collection and Update PayFabric Invoice Refund FROM iPaaS.com; the complementary filters enforce this, so review both before customizing either.

Related Documents

Did this answer your question?