Skip to main content

Adding an integration

  1. Create src/integrations/<provider>. Keep the SDK import inside that folder.
  2. Marketplace classes must match the auto-registration regex. You need {Provider}OrderService and {Provider}CatalogService or the provider will not register. Optional capabilities use the same prefix: Customer, Settlement, OutboundOrder, Inventory, Webhook (processes webhook_queue deliveries; the worker finds it through the registry), WebhookHealth. The provider token must be one of Shopify, WooCommerce, Amazon, Flipkart, BigCommerce, Meesho. A new marketplace name will not match until that regex is updated.
  3. A courier class must expose integrationCode, ship, cancel, and track.
  4. Add a registry seed entry if the connection hub should list it. The entry is the whole contract for the integration's settings, in three sections: connectionConfigSchema (stored on IntegrationConnection.config), configSchema (on Channel.config or Courier.config) and credentialsSchema (in the vault). Declare every key the code reads or writes, in the section it lives in:
    • The API accepts exactly the declared keys in each section and rejects anything else, a missing required key, a wrong type, or the [REDACTED] placeholder. A section that is sent replaces the stored one, and a section left out is kept.
    • Mark keys that only the system writes (OAuth tokens, expiries, provider-assigned ids) readOnly: true. People cannot send them, and a person's save keeps their stored values. A required key that only OAuth fills in should be readOnly, not required.
    • A value that only lives in memory, such as a short-lived access token minted from client credentials, is cached in the service, not written to config.
    • Seeds check their data against the registry with assertDeclaredFields and fail if a key is undeclared.
  5. Store secrets on IntegrationConnection through the vault, not on Channel.config.
  6. Webhooks are @PublicRoute. Verify a signature in the controller. Do not accept unsigned bodies because another provider does. WhatsApp fails closed when META_APP_SECRET is unset. Follow that unless you have a reason not to.
  7. A marketplace order service only reads and translates; it uses the shared pieces in Integrations overview → Marketplace pattern and writes nothing to an order itself:
    • loadSyncChannel for the channel and seller, ChannelOrderSyncRun (with a ChannelOrderRetryList if the channel can read one order by id) for the poll loop and the watermark.
    • MarketplaceOrderIngestionService.create / update for the order, with the channel's own hold as channelHold (resolveChannelHold) and any AWB as outboxEvents; cancelRemoved for an order the channel deleted.
    • processAddresses with a ChannelAddressInput (no placeholders for missing fields), upsertChannelCustomer / channelCustomerKey, OrderItemSyncService.sync for lines.
    • Outbound: report parcels from channelReportableShipmentsWhere; a status the channel itself reported is never pushed back.
  8. Long work goes to webhook_queue or a dedicated queue. Do not hold the HTTP request for a full catalog import.
  9. If you publish inventory, decide whether you need a flush-channel:<CODE> job or DEFAULT.
  10. If sync should participate in the circuit breaker, go through SyncJobProcessorWorker rather than a private loop.
  11. Run yarn di:check after registering the new providers.

A payment gateway for settlement reconciliation is a different pattern: an adapter behind PAYMENT_GATEWAY_PORT, not a marketplace class, and the tenant connects it as a PaymentAccount from Integrations → Payments. See Payment gateway settlements. Accounting ERPs follow the same idea behind ACCOUNTING_SYSTEM_PORT; see Accounting systems and ADR-0004.

CUSTOM is not a pattern to copy for a real channel. The scheduler skips unknown types.

See Integrations overview.