Adding an integration
- Create
src/integrations/<provider>. Keep the SDK import inside that folder. - Marketplace classes must match the auto-registration regex. You need
{Provider}OrderServiceand{Provider}CatalogServiceor the provider will not register. Optional capabilities use the same prefix:Customer,Settlement,OutboundOrder,Inventory,Webhook(processeswebhook_queuedeliveries; 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. - A courier class must expose
integrationCode,ship,cancel, andtrack. - 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 onIntegrationConnection.config),configSchema(onChannel.configorCourier.config) andcredentialsSchema(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 bereadOnly, notrequired. - 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
assertDeclaredFieldsand fail if a key is undeclared.
- The API accepts exactly the declared keys in each section and rejects anything else, a missing required key, a wrong type, or the
- Store secrets on
IntegrationConnectionthrough the vault, not onChannel.config. - Webhooks are
@PublicRoute. Verify a signature in the controller. Do not accept unsigned bodies because another provider does. WhatsApp fails closed whenMETA_APP_SECRETis unset. Follow that unless you have a reason not to. - 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:
loadSyncChannelfor the channel and seller,ChannelOrderSyncRun(with aChannelOrderRetryListif the channel can read one order by id) for the poll loop and the watermark.MarketplaceOrderIngestionService.create/updatefor the order, with the channel's own hold aschannelHold(resolveChannelHold) and any AWB asoutboxEvents;cancelRemovedfor an order the channel deleted.processAddresseswith aChannelAddressInput(no placeholders for missing fields),upsertChannelCustomer/channelCustomerKey,OrderItemSyncService.syncfor lines.- Outbound: report parcels from
channelReportableShipmentsWhere; a status the channel itself reported is never pushed back.
- Long work goes to
webhook_queueor a dedicated queue. Do not hold the HTTP request for a full catalog import. - If you publish inventory, decide whether you need a
flush-channel:<CODE>job orDEFAULT. - If sync should participate in the circuit breaker, go through
SyncJobProcessorWorkerrather than a private loop. - Run
yarn di:checkafter 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.