Skip to main content

Sync & Data Import

uPayments uses a background worker (hosted on Railway) to sync data from your NMI gateway.

How Syncing Works

  1. Every 15 minutes, the worker checks each NMI account
  2. Queries NMI for transactions modified since the last sync (start_date parameter)
  3. Upserts transactions into the database (safe to re-run — deduplicates by NMI transaction ID)
  4. After transactions, extracts customers from email addresses
  5. Optionally detects subscriptions from payment patterns

Sync Types

TypeWhenWhat It Does
IncrementalEvery 15 min (auto)Fetches only new/modified transactions since last sync
Manual SyncClick “Sync” buttonSame as incremental but immediate
Full BackfillClick “Backfill” buttonRe-syncs ALL transaction history. Also backfills descriptions, decline reasons, and BIN data

What Gets Synced

FieldSource
Transaction IDtransaction_id
Amountamount
StatusMapped from condition (pending, complete, failed, canceled)
TypeMapped from action.action_type (sale, refund, auth, capture, void)
Customer name/emailfirst_name, last_name, email
Card detailscc_type, card last 4, BIN
Descriptionorder_description
Decline infoaction.response_code, action.response_text
Sourceaction.source (api, virtual_terminal, recurring, etc.)
Entry modeKeyed, Swiped, etc.

Sync History

View sync history on the Merchants → [Merchant] → Gateway & Sync tab. Each entry shows:
  • Sync type (incremental/backfill)
  • Status (completed/failed/running)
  • Records processed (transactions, customers, subscriptions)
  • Duration
  • Timestamp

Performance

  • Processes ~1,000 transactions per minute
  • Initial backfill of 10,000 transactions takes ~10 minutes
  • Incremental syncs typically complete in under 30 seconds
  • Sequential processing (one account at a time) to avoid connection limits

Troubleshooting

The encryption key on the worker doesn’t match the one used to encrypt the API key. Verify ENCRYPTION_KEY matches between Vercel and Railway.
A stale job from a previous deployment. The worker automatically cleans up jobs that haven’t updated in 10 minutes.
uPayments deduplicates by NMI transaction ID. If NMI shows more, some may be duplicate entries or internal settlement records (source=internal).