Skip to content

Mercury

import { Aside } from ‘@astrojs/starlight/components’;

DPX integrates directly with Mercury — connecting Mercury’s banking layer to DPX’s settlement and oracle layer. When a Mercury payment is tagged for DPX routing, it flows automatically through oracle verification, Claude reasoning, and on-chain settlement.

Mercury payment.sent
→ DPX /mercury-webhook
→ HMAC signature verified
→ Oracle check + Claude reasoning
→ router.settle() on Base mainnet
→ Settlement receipt logged

Mercury handles the banking side (ACH, wires, balances). DPX handles the stablecoin settlement side (oracle intelligence, ESG scoring, on-chain execution).

Terminal window
curl -sSf https://cli.mercury.com/install.sh | sh
mercury login
Terminal window
mercury webhook create \
--url https://agent.untitledfinancial.com/mercury-webhook \
--events payment.sent

Copy the signing secret from the output.

Terminal window
cd dpx-agents/settlement-agent
wrangler secret put MERCURY_WEBHOOK_SECRET
# Paste the signing secret from step 2
wrangler secret put MERCURY_DEFAULT_RECIPIENT
# Paste the on-chain wallet address for unspecified recipients

Include a DPX tag in the Mercury payment note or metadata:

MethodExample
Note / memo"Intercompany Q2 dpx:0xYourWalletAddress"
Payment metadatadpx_recipient = 0xYourWalletAddress
Metadata flagdpx_route = true (uses MERCURY_DEFAULT_RECIPIENT)

Payments without a DPX tag are acknowledged but not routed — Mercury receives a 200 OK with action: ignored.

The /mercury-webhook endpoint on the Settlement Agent:

  1. Verifies the Mercury-Signature HMAC-SHA256 header
  2. Filters to payment.sent events only
  3. Converts Mercury cents → USD
  4. Extracts the on-chain recipient from metadata, note, or default
  5. Routes to the standard DPX settlement flow — oracle check, Claude decision, on-chain execution

To route a Mercury USD payment to a EUR settlement, add destination_currency to the payment metadata:

destination_currency = EUR

DPX will apply FX fee (0.40%) and route through EURC on Base.

For environments where webhooks aren’t available, the Mercury watcher polls for new transactions every 10 seconds:

Terminal window
export MERCURY_API_KEY=your_key
export DPX_AGENT_URL=https://agent.untitledfinancial.com
export DPX_DEFAULT_RECIPIENT=0xYourAddress
npm run watch
# from dpx-agents/mercury/

The watcher picks up payments containing dpx:0x... in the note field and routes them identically to the webhook flow.

Terminal window
mercury account list # Check balances
mercury payment create # Initiate a payment
mercury transaction list # Recent transactions
mercury webhook list # View registered webhooks
mercury webhook delete <id> # Remove a webhook
VariableRequiredDescription
MERCURY_WEBHOOK_SECRETYes (webhook)Signing secret from Mercury webhook registration
MERCURY_DEFAULT_RECIPIENTRecommendedFallback on-chain address for dpx_route=true payments
MERCURY_API_KEYYes (watcher)Mercury API key for polling mode

If the oracle is in CAUTION or UNSTABLE, Claude will HOLD the settlement:

{
"settlementId": "dpx_abc123",
"status": "held",
"reasoning": "CAUTION conditions with $500,000 exceeds $100K threshold. Flagging for review.",
"oracleScore": 81
}

The Mercury payment is already sent — DPX logs the hold. Resubmit when oracle returns STABLE, using the same referenceId.