Best Practices
This page provides the best practices to ensure an efficient integration with the Koncili API, preventing common errors and optimizing the financial reconciliation workflow.
1. Early Order Validation
Before submitting reconciliation releases, always verify that the orders/items exist within the system. This prevents process failures and ensures that only valid transactions are processed.
How to validate:
- Use the
GET /orderendpoint to query orders/items before submitting a financial entry. - Confirm that the
marketplaceCodeandaccountIdare correct. - Verify that the order status is among those expected by the system.
2. Ensuring Consistency in Entries
When submitting entries (releases), they must correspond to the extracts registered in the original order items.
Essential Rules:
-
Matching Types:
- If the order item contains a
SALEtype, the entry must also contain aSALEtype.
- If the order item contains a
-
Matching
marketplaceCode:- The order/item code must be identical in the entry submission.
-
Complete Submission in a Single Request:
- Do not submit partial entries. All components (
SALE,COMISSION,SHIP, etc.) must be included at once.
- Do not submit partial entries. All components (
If the value submitted in the entries (releases) does not exactly match the pre-registered value in the item (extracts), the reconciliation will be consolidated but marked with a discrepancy, triggering an alert for subsequent analysis.
3. Period and Batch Management
Reconciliation groups orders/items within a defined period, and this grouping must remain consistent. Boas práticas:
- Define clear periods:
periodInitDateandperiodEndDatemust cover all entry dates. Note that Koncili does not accept reconciliations with overlapping periods.
- Verify the entry count (
releasesQtd):- This value must exactly match the total number of
releasesthat will be submitted.
- This value must exactly match the total number of
- Reconciliations rejected due to inconsistency in
releasesQtd. - Errors in the reconciliation process.
4. Error Handling and Retries
Implement intelligent retry policies:
- For
4xxerrors, investigate the request payload before attempting a retry. - Use exponential backoff for transient failures.
- Log persistent failures:
- If a submission fails repeatedly, verify if the corresponding information already exists in Koncili.
5. Monitoring and Logs
Maintaining detailed logs is essential to identify and resolve issues quickly.
Log the following:
- Submission timestamps
- Reconciliation and order/item IDs
- API responses (successes and errors)
Monitor the following:
- Unreconciled orders and items
- Discrepancies between
extractsandreleases
Storing the X-Trace-ID:
Every request to the Koncili API will return a unique X-Trace-ID in the header, with the exception of authentication requests.
Log and store the X-Trace-ID returned in all Koncili API responses. This unique identifier is crucial for:
- Transaction tracking
- Rapid troubleshooting
- Auditing