Factoring Integration
This guide describes how factoring can be activated for a company through the Unimicro API, how invoices are marked as waiting for factoring, and how a factoring partner can accept or decline invoices.
Factoring is configured through FactoringSettings. The activation payload follows the structure of ActivateFactoringDto. Invoices are handled through the CustomerInvoice model.
How factoring works
The factoring flow consists of four main steps:
- Factoring is activated for the company.
- The factoring setup is stored as
FactoringSettings. - When an invoice is sent with factoring, the invoice is put on hold with status
42503—Waiting for factoring. - The factoring partner accepts or declines the invoice through an invoice action.
When the invoice is accepted, Unimicro sends the invoice and handles accounting according to the factoring setup.
Prerequisites
Before activating factoring, the following must exist on the company:
- A bank account used for payment/KID.
- An account or subledger account for the factoring company.
- A loan or interim account for the factoring flow.
- A valid KID/payment setup using
PaymentInfoType.
The activation payload uses account numbers, not internal account IDs.
Typical fields:
| Field | Description |
|---|---|
| BankAccountNumber | Bank account used for payment/KID |
| FactoringAccountNumber | Account/subledger account for the factoring company. |
| FactoringLoanAccountNumber | Loan/interim account used in the factoring flow. |
| FactoringCustomerNumber | Customer reference at the factoring company. |
| FactoringPaymentInfo | KID/payment setup. |
Activate factoring
Factoring is activated by calling the activate-factoring action on FactoringSettings.
PUT /api/biz/factoringsettings?action=activate-factoring The request body follows the structure of ActivateFactoringDto.
Example request
{
"BankAccountNumber": "62631284979",
"FactoringAccountNumber": 1501,
"FactoringCustomerNumber": "8055",
"FactoringDistribution": 1,
"FactoringLoanAccountNumber": 2381,
"FactoringPaymentInfo": {
"Length": 18,
"Modulus": 10,
"HasKid": true,
"Name": "test factoring",
"PaymentInfoTypeParts": [
{
"Part": "kid_prefix",
"Length": 1,
"SortIndex": 1
},
{
"Part": "customer_number",
"Length": 4,
"SortIndex": 2
},
{
"Part": "invoice_number",
"Length": 8,
"SortIndex": 3
},
{
"Part": "kid_code",
"Length": 2,
"SortIndex": 4
},
{
"Part": "check_digit",
"Length": 1,
"SortIndex": 5
}
],
"StatusCode": 42400,
"Type": 1
},
"NotificationsText": "The invoice has been transferred to a factoring company. Payment must be made to the specified account/KID.",
"SkipJournalEntry": false
}
A successful activation returns the created factoring setup. Factoring will then be available as a sending option for invoices.
Activation payload
| Field | Type | Description |
|---|---|---|
| BankAccountNumber | string | Bank account used for payment/KID. Must exist on the company. |
| FactoringAccountNumber | integer | Account/subledger account for the factoring company. Must exist in the chart of accounts. |
| FactoringCustomerNumber | string | Customer reference at the factoring company. |
| FactoringDistribution | integer | Defines how factoring distribution is handled. |
| FactoringLoanAccountNumber | integer | Loan/interim account for the factoring flow. Must exist in the chart of accounts. |
| FactoringPaymentInfo | object | KID/payment setup. |
| NotificationsText | string | Text shown on the invoice. |
| SkipJournalEntry | boolean | Controls whether journal entry/closing against the customer should be skipped in the factoring flow. |
FactoringDistribution
| Value | Meaning |
|---|---|
| 0 | NotSet |
| 1 | DistributeFromSoftrig |
| 2 | DistributeFromFactoringCompany |
Use 1 when the invoice should be distributed from the Unimicro/Softrig flow.
KID and PaymentInfoType
FactoringPaymentInfo describes how the KID is built.
The example above uses these KID parts:
| Part | Length | Description |
|---|---|---|
| kid_prefix | 1 | Fixed KID prefix. |
| customer_number | 4 | Customer number/reference at the factoring company |
| invoice_number | 8 | Invoice number. |
| kid_code | 2 | Fixed KID code. |
| check_digit | 1 | Check digit. |
Rules:
Lengthmust match the total KID length.PaymentInfoTypePartsare sorted bySortIndex.- Numeric parts are left-padded according to the defined length.
- Use
Modulus: 10for modulus 10. - Do not use the string value
"modulus10". - Set
HasKidtotruewhen KID should be used.
Retrieve factoring settings
The factoring setup can be retrieved from FactoringSettings.
GET /api/biz/factoringsettings Example with expanded relations:
GET /api/biz/factoringsettings?$expand=FactoringAccount,FactoringLoanAccount,FactoringBankAccount,FactoringPaymentInfoType Relevant fields include:
| Field | Description |
|---|---|
| FactoringAccountID | Internal ID for the factoring account/subledger account. |
| FactoringBankAccountID | Internal ID for the bank account. |
| FactoringLoanAccountID | Internal ID for the loan/interim account. |
| FactoringCustomerNumber | Customer reference at the factoring company. |
| FactoringDistribution | Distribution setting. |
| FactoringNotificationText | Text used on the invoice. |
| FactoringPaymentInfoTypeID | Internal ID for the payment/KID setup. |
| SkipJournalEntry | Whether journal entry/closing against the customer should be skipped. |
Note: GET /factoringsettings may return previously created factoring settings. The response does not necessarily indicate clearly which setup is currently active.
Deactivate factoring
Factoring can be deactivated with the deactivate-factoring action.
PUT /api/biz/factoringsettings?action=deactivate-factoring A successful deactivation normally returns:
204 No Content Deactivation removes factoring as an available sending option. Existing FactoringSettings may still be returned from GET /factoringsettings.
Invoices waiting for factoring
When an invoice is sent with factoring, the invoice is put on hold while waiting for the factoring partner.
| Field | Value | Meaning |
|---|---|---|
| CustomerInvoice.StatusCode | 42503 | Waiting for factoring |
The partner can retrieve invoices waiting for factoring by filtering invoices on status code.
GET /api/biz/invoices?$filter=StatusCode eq 42503 Example with selected fields:
GET /api/biz/invoices?$filter=StatusCode eq 42503&$select=ID,InvoiceNumber,CustomerID,StatusCode,ExternalStatusCode For more information about filtering, see
Accept or decline an invoice
When an invoice is waiting for factoring, the factoring partner must accept or decline it.
Accept invoice
PUT /api/biz/invoices/{id}?action=factoring-accepted Fields:
| Field | Type | Description |
|---|---|---|
| externalStatus | integer | External status from the partner. |
| externalDebtCollectionReference | string | External reference/case number at the partner. |
| externalDebtCollectionNotes | string | Note/comment from the partner. |
Example:
{
"externalStatus": 42601,
"externalDebtCollectionReference": "CASE-123456",
"externalDebtCollectionNotes": "Accepted for financing"
}
When accepted, the invoice is sent and Unimicro handles accounting according to the factoring setup.
Decline invoice
PUT /api/biz/invoices/{id}?action=factoring-declined Fields:
| Field | Type | Description |
|---|---|---|
| reason | string | Reason for declining the invoice. |
Example:
{
"reason": "Credit limit exceeded"
}
When declined, a reason can be added explaining why the invoice was not accepted.
External invoice status
The factoring partner can set an external status on the invoice.
ExternalStatusCodeCustomerInvoice:
public enum ExternalStatusCodeCustomerInvoice
{
Registered = 42601,
PartlyCompleted = 42602,
Completed = 42603,
Reminded = 42604,
Objection = 42605
} | Value | Name | Meaning |
|---|---|---|
| 42601 | Registered | Registered at the partner. |
| 42602 | PartlyCompleted | Partly completed. |
| 42603 | Completed | Completed. |
| 42604 | Reminded | Reminder/follow-up started. |
| 42605 | Objection | Objection/dispute. |
This is the partner’s external status and should not be confused with CustomerInvoice.StatusCode.
Accounting effect when accepted
When the partner accepts the invoice:
- Unimicro uses the setup stored in
FactoringSettings. - The invoice is posted according to the factoring setup.
- The factoring company is handled through the configured account/subledger and loan/interim account flow.
- Settlement is normally handled against the loan/interim account.
The exact accounting effect depends on the company’s chart of accounts and factoring setup.
Polling and webhooks
A partner can retrieve invoices waiting for factoring by polling:
GET /api/biz/invoices?$filter=StatusCode eq 42503 Alternatively, the partner can be configured with webhook/Eventplan for invoice-related events. For general webhook setup, see
Configuring Webhooks with Eventplans.
When using webhooks, the filter should be limited to the invoice statuses/events relevant to the factoring flow. Confirm the concrete webhook filter for each integration.
Common error sources
Account does not exist
Activation fails if the bank account or account numbers in the payload do not exist on the company.
Check especially:
BankAccountNumberFactoringAccountNumberFactoringLoanAccountNumber
Error message may point to an unclear account reference
When an account is missing, the error message may be unclear. Check both the factoring account and the loan/interim account if activation fails on account lookup.
Incorrect KID setup
Check that:
Lengthmatches the expected KID length.PaymentInfoTypePartshave the correctLength.SortIndexis in the correct order.Modulusis set to10for modulus 10.HasKidistrue.- KID parts are left-padded correctly.
Deactivation is not clearly visible in the API response
After deactivation, GET /factoringsettings may still return the setup. This does not necessarily mean that factoring is active. Check whether factoring is available as a sending option.
Complete example
Activate factoring
PUT /api/biz/factoringsettings?action=activate-factoring
Content-Type: application/json
Authorization: Bearer {token} {
"BankAccountNumber": "62631284979",
"FactoringAccountNumber": 1501,
"FactoringCustomerNumber": "8055",
"FactoringDistribution": 1,
"FactoringLoanAccountNumber": 2381,
"FactoringPaymentInfo": {
"Length": 18,
"Modulus": 10,
"HasKid": true,
"Name": "test factoring",
"PaymentInfoTypeParts": [
{
"Part": "kid_prefix",
"Length": 1,
"SortIndex": 1
},
{
"Part": "customer_number",
"Length": 4,
"SortIndex": 2
},
{
"Part": "invoice_number",
"Length": 8,
"SortIndex": 3
},
{
"Part": "kid_code",
"Length": 2,
"SortIndex": 4
},
{
"Part": "check_digit",
"Length": 1,
"SortIndex": 5
}
],
"StatusCode": 42400,
"Type": 1
},
"NotificationsText": "The invoice has been transferred to a factoring company. Payment must be made to the specified account/KID.",
"SkipJournalEntry": false
}
Retrieve factoring settings
GET /api/biz/factoringsettings Find invoices waiting for factoring
GET /api/biz/invoices?$filter=StatusCode eq 42503 Accept invoice
PUT /api/biz/invoices/{id}?action=factoring-accepted
Content-Type: application/json
Authorization: Bearer {token} {
"externalStatus": 42601,
"externalDebtCollectionReference": "CASE-123456",
"externalDebtCollectionNotes": "Accepted for financing"
}
Decline invoice
PUT /api/biz/invoices/{id}?action=factoring-declined
Content-Type: application/json
Authorization: Bearer {token} {
"reason": "Credit limit exceeded"
}
Deactivate factoring
PUT /api/biz/factoringsettings?action=deactivate-factoring
Authorization: Bearer {token} Expected response:
204 No Content Partner onboarding checklist
- Bank account exists on the company.
- Factoring account exists in the chart of accounts.
- Loan/interim account exists in the chart of accounts.
FactoringCustomerNumberis clarified with the factoring company.FactoringDistributionis set correctly.FactoringPaymentInfois configured with the correct KID format.- Factoring is activated with
PUT /factoringsettings?action=activate-factoring. - Factoring appears as an available sending option.
- Partner can retrieve invoices with
StatusCode = 42503. - Partner can accept invoices with
factoring-accepted. - Partner can decline invoices with
factoring-declined. - Polling or webhook/Eventplan setup is clarified.