Skip to content

What Is API Integration and How Is It Done? A Guide for ERP, CRM, Payments and E-Invoicing

The basics of API integration for connecting ERP, CRM, payment, e-invoicing, marketplace and shipping systems: REST and webhooks, architecture options, the step-by-step process, error handling, security and a decision checklist.

Published:

API integration is the practice of letting two pieces of software use each other's data and functions through a defined interface (an API), with no person copying data in between: an order placed on your online store lands in the ERP, the payment result updates the order, the invoice goes out through an e-invoicing provider and the tracking number reaches the customer. A well-built integration does more than move data. It also defines which system is the source of truth for each field, what happens when a call fails and how the same operation is kept from being processed twice. The work follows five steps: system inventory, data mapping, authentication, error handling and monitoring.

This guide is for decision makers and product teams who are about to connect ERP, CRM, payment, e-commerce, logistics and accounting systems. Instead of code samples, it gives you the framework you need to decide: which architecture fits when, which steps the process has, and what to check on security and data protection. Applications with user accounts, payment flows and third-party integrations fall within our web development service, and the framework below sums up the questions we ask on that kind of project.

What is API integration? REST, webhooks and GraphQL explained

An API (Application Programming Interface) is a contract that defines which data and operations a piece of software exposes, and under which rules. Integration means using that contract to make two or more systems part of the same business process. These are the formats you are most likely to meet:

  • REST: resource-oriented endpoints (orders, customers, products) over HTTP. GET reads, POST creates, PUT or PATCH updates, DELETE removes. It is the common format for payment, marketplace and CRM APIs.
  • Webhooks: a call in the opposite direction. Instead of asking the other system "anything new?" over and over (polling), the other system sends a notification to a URL you register whenever an event happens, such as a payment being approved or an order being cancelled.
  • GraphQL: a query language in which the client states exactly which fields it wants through a single endpoint. It makes fetching nested data in a few requests easier, and some e-commerce platforms, Shopify among them, offer their main admin API in this format.
  • SOAP and file-based transfer: some enterprise software and e-document providers offer XML-based SOAP web services. With some legacy systems, the only options are scheduled file transfer (CSV or XML over SFTP) or a database view.

A single integration usually mixes several of these: the payment provider's webhook triggers the order, the order is written to the ERP over REST, and the ERP's stock data arrives as a nightly file. The choice is driven by how fresh the data must be and what the other system offers, not by what is fashionable. How AI agents will use the same APIs is a separate layer on top; we covered it in our article on MCP and enterprise integration.

Which systems get connected? Typical integrations in the Turkish market

On the B2B side, most integration requests revolve around the same handful of system groups. Each one carries its own specific risk:

  • ERP and accounting: syncing orders, customer accounts, stock and prices. The ERP is often treated as the source of truth for stock and pricing; data originates there and flows out to sales channels. The interface the ERP offers (REST, SOAP, a database view or files) sets how deep the integration can go.
  • CRM: getting form and ad leads into the CRM, and notifying other systems when a deal changes stage. We build the two-way data pipeline between ad platforms and the CRM as part of our RevOps service.
  • Payment providers: providers such as iyzico, PayTR and Stripe offer APIs to start payments, issue refunds and query status, plus webhooks or callbacks to report the payment result. In a 3D Secure flow the customer is redirected to the bank's verification screen and the result comes back to your system. The core rule: confirm an order based on a payment result verified on your server, never on the page the browser returns to.
  • E-invoicing in Turkey: according to the Turkish Revenue Administration's e-Fatura page, an e-invoice is an electronic document based on the UBL-TR XML standard and exchanged between seller and buyer through the central GİB platform. Registered taxpayers send each other e-Fatura; for buyers who are not registered, businesses enrolled in e-Arşiv issue an e-Arşiv invoice. Software usually sends these documents through the services of private integrators authorised by GİB; the portal and direct integration are the other methods GİB defines. Other countries run their own e-invoicing systems with their own formats.
  • Marketplaces: marketplaces such as Trendyol and Hepsiburada give sellers APIs for products, stock, prices and orders. When you sell on several channels, the real risk is stock consistency: the same item can sell on two channels at the same moment.
  • Shipping and logistics: creating shipments, getting labels and querying tracking status. Writing the tracking data back to the order and to the customer is the step that closes the order flow.

These providers change their APIs, versions and terms over time. Before each integration, read the provider's current developer documentation and check its test environment (sandbox), and base your decisions on that documentation rather than on an old project.

Integration architectures: point-to-point, middleware and event-driven

How systems are wired together drives the maintenance cost of an integration more than the first line of code does. There are four common approaches. In point-to-point integration each system connects directly to the other. With ready-made connectors or iPaaS, an integration platform such as Zapier, Make or Activepieces runs the flows for you. With custom middleware, every flow passes through a single integration service you own. In an event-driven architecture, systems do not call each other directly; events such as "order created" are written to a message queue and the interested systems read from there.

ApproachStrengthWatch out forWhen it fits
Point-to-pointShortest path with few systems, no extra layerConnections grow quickly as systems are added (up to n(n-1)/2 for n systems); one change ripples into several placesTwo or three systems, simple flows that rarely change
Ready-made connector or iPaaSFast start, visual flow editorFields and rules the connector does not support; task limits; with subscription SaaS, data passes through third-party serversStandard flows, moderate volume, few custom business rules
Custom middlewareTransformation, mapping, error handling and logs in one placeYou own development and operationsMany systems, custom business rules, data that must stay on your own infrastructure
Event-driven (message queue)Systems run independently; if the other side is down, messages wait in the queueMessage loss, duplicate processing and ordering must be designed for; monitoring is essentialHigh volume, traffic spikes, several systems reacting to the same event

These approaches are not mutually exclusive. A common setup is custom middleware that receives the providers' webhooks and hands slow jobs to a queue, so steps such as issuing an invoice or registering a shipment never keep the customer waiting on the payment screen. On the Anneekspres marketplace, secure payment integration and real-time order tracking were built, with a RabbitMQ message queue in the infrastructure. Queues bring their own problems (lost messages, double processing, ordering), which we describe on our backend scaling page.

How to do an API integration, step by step

Most of the time lost on integration projects comes not from code but from questions nobody answered before coding started. The following order forces those answers up front:

  1. Take inventory. Which systems, which data, in which direction and how often? For each system, write down the interface it offers, whether it has a test environment, its rate limits and how current its documentation is.
  2. Decide data ownership. Pick one source of truth per field: stock in the ERP, contact consent in the CRM, payment status at the payment provider. A setup where two systems write the same field will produce conflicts sooner or later.
  3. Build a data mapping table. Map field names, formats (dates, currencies, phone numbers, tax IDs), code lists (order status, VAT rate, country code) and required fields. Also write down what happens when a value arrives that has no match.
  4. Set up authentication and permissions. The integration should connect through an account dedicated to it, with only the permissions it needs, not through a person's user account. The flow must not stop when someone leaves or changes a password.
  5. Write the failure scenarios. Agree in advance what happens when the other system does not respond, a limit is hit or data is rejected: retries, duplicate-safe requests and a manual review queue (details below).
  6. Test end to end in a sandbox. Test the unhappy paths as well as the happy one: refunds, partial cancellations, missing addresses, abandoned payments and outages, with realistic test data.
  7. Go live in a controlled way. Start with limited volume, run the old process in parallel for a while if needed, and confirm with a reconciliation report that records match in both systems.
  8. Define monitoring and ownership. Write down who receives alerts, who responds first and who contacts the provider.

The order matters. Coding that starts before the mapping table and failure scenarios exist turns into data clean-up and manual fixes in production. These two documents are also what the next person to inherit the integration will need most.

Error handling: retries, idempotency and reconciliation

Network calls fail, and a good integration treats that as normal rather than exceptional. Three mechanisms work together.

Retries. On transient errors (timeouts, server errors, 429 Too Many Requests) the request is retried. The wait between attempts grows each time (exponential backoff) and a little randomness is added so that all clients do not retry at once. If the other system sends a Retry-After header, respect it. Retrying is pointless for permanent errors such as validation failures; the record goes to a separate error queue (dead-letter queue) for review and the owner is notified.

Idempotency. An operation is idempotent when processing the same request several times has the same effect as processing it once. RFC 9110, which defines HTTP semantics, treats methods such as GET, PUT and DELETE as idempotent, and POST as not. That is why POST calls that create payments or orders carry a unique idempotency key, so that a request resent after a network error does not create a second payment or a second order. Some payment providers, Stripe among them, support this key at API level. The same rule applies to webhooks: a provider may deliver the same notification more than once, so the receiver should store the event ID and ignore repeats.

Reconciliation. Even the best design can miss a notification. A scheduled reconciliation job therefore compares records in both systems, fills the gaps and reports the differences. In our RevOps setups we give every event a deterministic ID to deduplicate repeats, and a scheduled flow scans for leads that never reached the CRM and pulls them in. We published the full architecture in our Meta Conversions API CRM feedback loop guide.

API security: OAuth 2.0, secrets, rate limits and data protection

Authorisation. OAuth 2.0, defined in RFC 6749, is an authorisation framework that lets an application access another API with a limited-scope, time-bound access token instead of the user's password. Server-to-server integrations usually use the client credentials flow, and current security recommendations are collected in RFC 9700. Grant the narrowest scopes possible: an integration that reads stock should not be able to delete orders.

Secrets management. API keys and client secrets never go into the code repository, email or shared spreadsheets; use environment variables or a secret manager. Rotate keys on a schedule and whenever the team changes. Verify that each webhook really comes from the provider using the signature the provider supplies (usually HMAC), and never confirm an order on the strength of a notification whose signature has not been checked.

OWASP risks and rate limits. The 2023 edition of the OWASP API Security Top 10 lists two risks that bear directly on integrations: unrestricted resource consumption and unsafe consumption of APIs. The first is abuse of APIs exposed without limits or quotas. The second is easy to overlook: data from a third-party API should not enter your system without the same validation you apply to user input. Rate limits cut both ways: you protect your own API and you respect the other side's limits.

Data protection. Integrations move personal data from one system to another, so they belong in your records of processing under laws such as Turkey's KVKK (Law No. 6698) or the GDPR. Practical principles: transfer only the fields you need, mask personal data in logs, and if you use a subscription integration tool, know and document which countries its servers are in. Confirm your own situation with legal counsel; this article is not legal advice.

After go-live: monitoring, version changes and maintenance

An integration is not something you set up and forget. Other systems change their API versions, retire old ones, let access tokens expire, and change limits and business rules. For an integration in production, track these signals:

  • Failed call rate and the spread of error codes.
  • Queue depth and the age of the oldest waiting message.
  • Webhook delivery delays and undelivered notifications.
  • Records waiting for manual review in the error queue.
  • Differences in the reconciliation report.
  • Expiry dates of access tokens, certificates and keys.

Who receives the alert, who responds first and who contacts the provider should live in a written runbook. Subscribe to the providers' versioning and deprecation announcements so that a version migration can be planned well before the cut-off. The account the integration runs under is another frequent source of outages: tokens tied to a personal account silently stop working when they expire or when the person leaves. A dedicated service account for the integration prevents this kind of outage from the start.

Decision checklist: ready-made connector, iPaaS or custom build?

The right approach depends on your systems, your volume and where the data must live. Before you request a quote or subscribe to a tool, answer these questions:

  • Do all the systems to be connected offer an API, a test environment and current documentation?
  • Has a source of truth been agreed in writing for every data field?
  • How fresh must the data be: real time, hourly or daily?
  • Does a ready-made connector cover the whole need, or are custom fields and business rules going to require extra development?
  • Do your flow and task volumes fit the limits and pricing model of a subscription tool?
  • Which servers does personal data pass through, and is that acceptable under the data protection rules that apply to you?
  • How are retries, duplicate protection and reconciliation handled?
  • When something fails, who finds out, through which channel and how quickly?
  • Whose name are the code, flow definitions and access accounts under, and what could you take with you if you switched providers?
  • Who will maintain the integration after go-live?

As a general direction: for standard flows at moderate volume, a ready-made connector or iPaaS is often enough. For custom business rules, high volume or data that must stay on your own infrastructure, a custom middleware layer or a self-hosted platform is the better fit. For that last reason, our RevOps setups use Activepieces Community Edition running on your own server.

We build integrations not as a standalone product but as part of the web applications, marketplaces and data pipelines we develop. Tell us through the quick quote form which systems you want to connect and which steps are done by hand today, and we can work out the scope and the right approach together.

Frequently Asked Questions

What is the difference between an API integration and a webhook? A webhook is one kind of API integration. In a classic API call your system sends a request to the other side and gets a response; with a webhook, the other system sends a notification to a URL you registered as soon as an event happens. Most integrations use both: the event arrives by webhook and the details are fetched through the API.

Can we integrate without changing our existing software? If your systems offer an API, usually yes; the integration is built as a separate layer outside the existing software. Without an API, options such as a database view, scheduled file transfer or an integration module from the software vendor are considered. Which of these is possible depends on the system itself.

Does every integration need to be real time? No. Steps such as payment results and stock deductions should be immediate, while reporting and transfers to accounting are often fine as scheduled batch jobs. Building more real-time flows than you need increases the number of moving parts to monitor and the chance of hitting the other system's limits.

What can we do if our ERP has no API? First check whether the vendor offers an add-on integration module or web service. If not, a read-only database view or scheduled file transfer (CSV, XML) can be used. With these methods data is not real time and write operations need more careful design, but they work for most stock and order flows.

Is data lost when an integration fails? In a properly designed integration a failed record is not lost: it is retried, and if that fails it waits in an error queue and the owner is notified. Scheduled reconciliation also catches records that slipped through. Still, no design guarantees zero errors, so monitoring and a manual intervention path should always be defined.

Is a ready-made integration tool or custom development the better choice? With standard flows, moderate volume and few custom rules, ready-made tools can be fast and sufficient. If you have custom business rules, high volume, complex data mapping or personal data that must stay on your own infrastructure, custom middleware is the better fit. Deciding with the checklist above avoids a migration later.

What determines the timeline and cost of an API integration? The main factors are the number of systems to connect, the quality of the interfaces they offer and whether they have a test environment, the complexity of the data mapping, how real time the data must be, and the expectations for error handling and monitoring. A reliable timeline or cost cannot be given before the inventory and mapping table exist.

Have a project in mind?

Let's bring the technologies from this article to life in your project.

Request a Free Discovery Call