Skip to main content
Back to technical insights

API and systems integration

ERP, Commerce, Payments, and Logistics Out of Sync? Building Reliable API Integrations

Use webhook verification, event deduplication, idempotency, asynchronous retries, and reconciliation to make cross-system workflows traceable and recoverable.

By AgentTech technical team

The most dangerous integration failure is not a complete outage but partial success: a customer has paid while the order remains unpaid, a cancelled commerce order still creates an ERP shipment, a repeated carrier event sends duplicate notifications, or the daily report does not match payment settlement. Calling the API again is not enough. External services can resend the same event, delay delivery, change order, or become temporarily unavailable. Reliable integration treats every event as a business operation that must be verified, deduplicated, retried safely, traced, and reconciled.

The concrete problem: network recovery does not guarantee data recovery

An API timeout does not prove that the remote operation failed. If a commerce platform receives no response after requesting a shipment and blindly retries, it may create two labels. If a payment provider resends one successful-payment webhook and the receiver does not deduplicate it, the system can post, notify, or award points twice. Reliability design distinguishes not started, completed with a lost response, and confirmed failure.

Events are not guaranteed to arrive in business order. A refund message can be processed before the local successful-payment event, delivery can be received after an older in-transit message, and replayed history can overwrite newer status. Updating a database directly for every received event can move an order backward or create an impossible state.

Systems also use different meanings. ERP shipped may mean warehouse posting, while carrier collected means the parcel physically left. A payment transaction ID, commerce order number, and invoice number are not the same key. Without shared identifiers, mappings, and ownership boundaries, teams can only guess which record is authoritative after an incident.

  • Timeouts create unknown outcomes, and blind retries can repeat side effects
  • Webhooks can be duplicated, delayed, or out of order
  • ERP, commerce, payment, and logistics systems can define statuses, amounts, and IDs differently

When it is worth building: integration errors now affect money, fulfillment, or customer commitments

For a very small number of daily transactions, controlled export and manual reconciliation may be more economical than real-time integration. Reliability becomes a formal requirement when orders cross commerce, ERP, payments, invoicing, and logistics and a failure can cause duplicate charges, incorrect fulfillment, inaccurate stock, or a high volume of customer-service investigations.

Another signal is that only an engineer can inspect and repair a failure. If operations cannot see where an event stopped, whether it has retried, or whether it requires resubmission or manual confirmation, every exception becomes an incident. A reliable integration includes status, alerts, search, and recovery actions that operational staff can use, not code alone.

For example, a commerce platform creates an ERP order after payment and then requests a carrier label. During a promotion, the carrier API times out and the integration retries synchronously. The next day, some orders have two labels while others remain pending despite carrier success. The solution is not one additional retry; each step needs a unique identity, idempotent execution, a queue, controlled state transitions, and reconciliation.

  • Cross-system errors affect amounts, inventory, shipment, or customer promises
  • Volume or peak load makes line-by-line manual repair impractical
  • The organization needs visibility into failure location, impact, ownership, and recovery

AgentTech's method and technical design: authenticate, execute once, and recover safely

The entry point first verifies that an event is authentic. AgentTech implements the provider's signing method using a signature, shared secret, timestamp, and allowed clock tolerance, and retains the required original payload and headers for audit. Secrets are stored in a controlled environment with a rotation process. Invalid, expired, or malformed events do not enter the business workflow, and logs avoid exposing complete credentials, personal data, or payment details.

Each incoming event is deduplicated using the provider event ID or a reproducible composite key. Outbound order, refund, or shipment creation uses an idempotency key, while local uniqueness constraints and processing records protect the same intent from producing multiple outcomes. If the first response is lost, the system queries by idempotency key or external transaction ID before creating another record.

After quick verification and durable event storage, time-consuming work moves to an asynchronous queue. Transient errors use bounded retries with backoff; malformed, conflicting, or exhausted events enter a dead-letter queue for alerts and controlled human action. Every attempt keeps timestamps, response summaries, and a correlation ID so one transaction can be traced across services.

Out-of-order events are evaluated by a state machine rather than applied as blind overwrites. External versions, event times, and allowed transitions determine whether an update is safe. Ambiguous events are retained for review. Even with a robust real-time path, scheduled reconciliation compares orders, transactions, amounts, and states to locate missed events, long-running work, and mismatched results.

  • Signatures and timestamps authenticate events; event IDs and unique constraints prevent duplicate processing
  • Idempotency keys protect order, refund, charge, and shipment operations from repeated side effects
  • Queues, bounded retries, dead-letter handling, and state machines address transient failures and disorder
  • Correlation IDs, structured logs, metrics, alerts, and reconciliation provide end-to-end observability

Phased rollout: protect high-risk transactions before taking over more workflows

Phase one inventories interfaces, direction, authentication, rate limits, timeouts, retry behavior, and provider support contacts. Payment, order, inventory, shipment, cancellation, and refund states are mapped. Historical exceptions create a risk register, prioritizing flows that can cause financial error, duplicate fulfillment, or data loss.

Phase two builds the integration foundation: shared identifiers and mappings, webhook receiver, durable event storage, idempotency records, queue workers, retries, and dead-letter processing, then connects one valuable workflow. Testing simulates duplicate events, timeouts, disconnections, out-of-order delivery, invalid signatures, rate limits, and partial success to prove that retries do not create extra transactions.

Phase three adds operational monitoring and reconciliation. Dashboards show successful volume, failure rate, retry count, queue delay, dead-letter volume, and long-running transactions; severity-based alerts reach the accountable owner. Daily or scheduled reconciliation compares local orders with provider, carrier, or ERP records and offers permission-controlled actions to retry, ignore, correct mappings, or complete manually.

  • Phase one: interface inventory, state and data mappings, risk classification, ownership, and recovery flows
  • Phase two: reliable event-processing foundation, one critical workflow, fault injection, and integration testing
  • Phase three: operations console, severity-based alerts, reconciliation, and ongoing capacity adjustment

Final deliverables and acceptance: every transaction can be found, retried, and reconciled

AgentTech can deliver API and webhook services, signature verification, event storage, deduplication and idempotency, asynchronous queues, retry policies, dead-letter handling, state transitions, cross-system tracing, and an operations console for search and controlled recovery. Depending on scope, the solution also includes reconciliation jobs, monitoring dashboards, and alert rules so integration is not a black box understood only by developers.

Documentation includes interface contracts, field and state mappings, identifier rules, authentication and secret management, error classification, retry and escalation tables, data retention, deployment configuration, and operating procedures. Provider rate limits, maintenance windows, and consistency limitations are documented rather than presented as unconditional guarantees.

Acceptance focuses on repeatable failure scenarios: repeated delivery of the same event ID creates one outcome; retrying the same idempotency key does not create a duplicate transaction; out-of-order events do not move state backward; temporary failures retry according to policy; permanent failures enter dead-letter handling and alert; manual replay records its operator and reason; and reconciliation finds planted missing orders and amount differences. Peak capacity, alert recipients, credential rotation, and disaster recovery are also confirmed before launch.

  • Executable service: integration endpoints, event processing, workers, state synchronization, and operations console
  • Reliability controls: authentication, deduplication, idempotency, retries, dead-letter handling, ordering protection, reconciliation, and monitoring
  • Technical and operational documentation: contracts, mappings, error playbook, permissions, deployment, and recovery procedures
  • Acceptance evidence: duplicate, timeout, disorder, partial-failure, reconciliation, and capacity test records

Service for this topic

Custom systems and digital platforms

SYS Agent

Discovery, CRM, commerce, membership, booking, operations backends, permissions, APIs, deployment, and maintenance.

Explore the related service

Continue reading

Custom systems and digital platformsLead-generation websitesiOS, Android, and cross-platform apps

When Does a Wholesaler Need a B2B Ordering Platform? Integrating Tiered Pricing, Credit Terms, Inventory, and ERP

Read article
Custom systems and digital platformsLead-generation websitesiOS, Android, and cross-platform apps

When Should a Company Move Operations from Excel to a Custom Management System?

Read article

Start with clarity

Is your team facing the same problem?

Tell us how the work is handled today, where it consumes the most time, and what you want to improve. We will help clarify the right direction and next step.