Atomic logo

Order Monitoring

Order Monitoring pulls e-commerce order data from merchants like Amazon to enrich bank transactions with itemized purchase details. This guide covers the full flow from initial account connection through ongoing data synchronization.

There are two phases: initial connection where a user authenticates with a merchant and their orders are fetched, and continuous access where Atomic refreshes the data on a recurring basis.

This guides assumes you have previously viewed the Integration Guide and installed the Transact SDK.

The initial connection flow establishes a link between the user's e-commerce account and Atomic, enabling order data retrieval.

To connect an e-commerce account, launch the Transact SDK with the appropriate configuration. You can either deeplink directly to a specific merchant or present the order connection page for future multi-merchant support.

Deeplink to Amazon

If you know the user wants to connect their Amazon account, you can deeplink directly:

React Native - Deeplink to Amazon
import { Atomic } from '@atomicfi/transact-react-native'

  Atomic.transact({
    config: {
      publicToken: 'YOUR_PUBLIC_TOKEN',
      product: 'present',
      deeplink: {
        step: 'login-company',
        companyId: 'AMAZON_COMPANY_ID'
      }
    },
    onTaskStatusUpdate: (event) => {
    console.log('Task status:', event.status)
  }
})

See the Transact SDK reference for more details on the options available for configuring the experience.

We are actively building a way to launch into an "Orders" experience for this flow. Coming soon...

When the user authenticates with the merchant Atomic uses TrueAuth to establish a persistent connection. This allows Atomic to refresh the merchant data on a preset cadence without requiring the user to re-authenticate.

On successful authentication, an account object is created and stored on Atomic's side. This account contains details about the connection, orders, bills, payment methods, and payment history.

During the connection Task, Atomic fetches the user's order history. Fetch duration scales with order count—up to a minute for users with extensive purchase history.

Atomic provides webhooks for real-time notification of events as they process. When the connection Task completes, the account's connection status is set to connected and orders become available via the GET /accounts API.

Listen to the pay-link-accounts-updatedwebhook to receive real-time updates when account and order data is saved and ready to retrieve.

pay-link-accounts-updated Webhook Payload
{
  "eventType": "pay-link-accounts-updated",
  "eventTime": "2024-10-20T18:00:54.761Z",
  "user": {
    "identifier": "YOUR_INTERNAL_IDENTIFIER"
  },
  "data": {
    "accounts": [
      {
        "_id": "ID_FOR_THE_ACCOUNT",
        "updateType": "created"
      },
      {
        "_id": "ID_FOR_THE_ACCOUNT",
        "updateType": "updated"
      },
      {
        "_id": "ID_FOR_THE_ACCOUNT",
        "updateType": "disconnected"
      }
    ]
  }
}
Key fields to monitor:
  • accounts.updateType - Indicates the state of the Account. updated means that the account data has been fullly synced to Atomic and is ready for retrieval. Refer to the API reference for full details.
  • accounts._id - Atomic-generated identifier for the connected account. Store this to retrieve orders and track updates.
  • user.identifier - The identifier for the user which was passed to Atomic when the access token was created.

After a successful connection, Atomic stores account and order data that you can retrieve via API. To integrate effectively, you'll need to store certain identifiers and understand the order object structure.

The following are a sample of useful data elements. Please refer to the API and Webhook references for more information.

Atomic provides the following account-level data:

  • connectionStatus - Whether the account is initial, connected, or disconnected
  • lastSyncedAt - Timestamp of the most recent data sync
  • _id - The Atomic account identifier you must store to correlate future updates and webhooks

Each order contains:

  • date - Order date
  • lineItems - Breakdown of costs (subtotal, shipping, tax)
  • products - Items in the order with descriptions and amounts
  • paymentMethod - Payment information including last 4 digits when available, or a text description for non-card payments (e.g., "gift card", "Affirm", "Google Play")
Sample Order Object
{
  "_id": "67376c5befe988922e8adef6",
  "sourceId": "112-2968911-3747422",
  "date": "2024-10-20T18:00:54.761Z",
  "amount": 13.37,
  "lineItems": [
    {
      "description": "Item(s) Subtotal",
      "amount": 12.49
    },
    {
      "description": "Shipping & Handling",
      "amount": 0
    },
    {
      "description": "Estimated tax to be collected",
      "amount": 0.87
    }
  ],
  "paymentMethod": {
    "type": "card",
    "lastFour": "2345",
    "brand": "Mastercard"
  },
  "products": [
    {
      "description": "AAA Alkaline Batteries",
      "amount": 12.49,
      "returnBy": "2024-12-19T23:59:59.000Z"
    }
  ]
}

As the consumer of this data, you are responsible for:

  • Persisting the Atomic account/user ID mapping
  • Pulling orders from Atomic via the API
  • Stitching orders to bank transactions using amount, date, payment method, and merchant identification

After the initial connection, Atomic keeps order data up to date through daily scheduled refreshes without requiring user action.

For each account, a refresh Task fetches new or changed orders, such as newly settled transactions. Orders are stored the same way as the initial connection and associated with the same account ID.

To stay informed of data changes, listen for the pay-link-accounts-updated webhook, which fires when an account is created, data is saved, and other lifecyle events for an account.

On receiving these webhooks:

  1. Call GET /pay-link/accounts/:id for affected account IDs.
  2. Read connectionStatus, lastSyncedAt, and orders.
  3. Update your internal models and re-run stitching logic for impacted users.

Understanding when and why accounts become disconnected helps you build a robust integration.

An account can become disconnected due to:

  • Merchant-side security events: Password reset or security flags on the user's account with the merchant.
  • Expired sessions: The cached session has expired or been revoked
  • Transient errors: Occasionally, the merchant returns an error page, when order data is pulled, resulting in a disconnected account.

When you detect a disconnected account:

  1. Update your UI to show the account as disconnected
  2. Pause your stitching processes for this user until the account is reconnected
  3. Prompt the user to reconnect via the same connection flow
  4. Reconnection re-runs the initial connect pattern and re-establishes continuous access
For connection failures, consider showing a message like "We're unable to retrieve your data at this time. Please try again."

The following table lists common failure reasons you may encounter in Task webhooks:

ReasonDescriptionRecommended Action
session-expiredThe cached authentication session has expiredPrompt user to reconnect
credentials-invalidUser credentials are no longer validPrompt user to reconnect with updated credentials
bot-detectionMerchant detected automated accessWait and retry, or prompt user to reconnect
merchant-unavailableMerchant site is temporarily unavailableAutomatic retry on next scheduled refresh

Order-to-transaction stitching connects the detailed order data from Atomic (items, quantities, merchants) to the corresponding charges in a user's bank account. This enrichment transforms generic transaction descriptions like "AMZN MKTP US" into itemized purchase details. Since order dates and bank posting dates often differ, use multiple fields to ensure accurate matching.

FieldNotes
Amount Primary match key. May vary slightly due to tax adjustments on pending orders—reconciles once order settles.
Date Use a ~3-day window. Amazon order date often differs from bank posted date by 1 day. Bank transfers may have longer lag than credit cards.
Payment Method Last 4 digits available for most card payments. Unavailable for: gift cards, EBT, Affirm, Google Play. Use these descriptors to filter out unmatchable orders.
  • Use amount as the primary match key
  • Apply a ~3-day date window to account for posting delays
  • Filter out orders with non-card payment methods (gift cards, EBT, Affirm) that cannot be matched to bank transactions
Amazon intentionally delays posting transactions (~6 hours) to allow users to change payment methods. Orders may not appear in bank data for up to 24 hours after being placed.

Atomic provides a sandbox environment with mock merchant connectors for testing your integration.

Testing Flow
  1. Wire up your webhook handler for pay-link-accounts-updated
  2. Run a sandbox task (merchant login is mocked)
  3. Wait for webhooks, then fetch accounts and orders via GET /pay-link/accounts/:id
  4. Verify parsing of account status, lastSyncedAt, and orders
  5. Exercise your stitching logic against the sample data
Test Scenarios
ScenarioWhat to Test
Account disconnection Verify pay-link-accounts-updated shows account as disconnected; UI handles gracefully
Missing payment method Verify orders without payment method last four are handled (filtered or flagged)