DisputelyDocs

Custom CRM

Connect your own order system. Answer cardholder "what is this charge?" inquiries, sign customers into Flows, and run refunds and subscription cancels from your CRM.

If your orders live in your own CRM or OMS rather than a platform Disputely integrates with, you can have Disputely call your system instead. You register an HTTPS endpoint for each operation you want to handle; Disputely POSTs a signed request, you reply synchronously, and we act on your answer. One signing secret covers every endpoint on your account.

EndpointEventWhat it doesBudget
Order lookuporder.lookup.requestedFind an order. data.query.by is transaction (bank inquiries, RESOLVE) or customer (Flows sign-in: email + order number).3 s
Refund orderorder.refund.requestedRefund an order from a Flow's refund step on the Custom CRM connection.10 s
Cancel subscriptionsubscription.cancel.requestedCancel a subscription from a Flow's cancel step on the Custom CRM connection.10 s
Pause subscriptionsubscription.pause.requestedPause a subscription from a Flow's pause step.10 s
Skip next chargecharge.skip.requestedSkip upcoming charge(s) from a Flow's skip step.10 s

Every request carries its event name in type and the Disputely-Event header, so one URL can serve all of them — switch on the event, add handlers one at a time, and switch each endpoint on in Settings when it's ready. You'll only ever receive events for endpoints you've switched on.

When a cardholder questions a charge, their bank asks Disputely for the order behind it in real time — the agent is on the phone or the customer is in the banking app. Normally Disputely answers from the data it already has about your store; with Order lookup active, we ask you and relay your order to the network. The same order object powers Flows: the ids you return (orderId, payments[].transactionId, subscriptions[].subscriptionId) are echoed back verbatim when a Flow asks you to refund or cancel.

Custom CRM is enabled per account by Disputely. If you don't see a Custom CRM card under Settings → API, ask us to switch it on.

How it works

Generate your signing secret

In Settings → API → Custom CRM, click Generate signing secret. You'll be shown a whsec_… secret once — store it in your secrets manager. Every endpoint you add verifies deliveries with this one secret.

Add an endpoint URL

On the Order lookup row, enter an HTTPS URL on a public hostname and click Save.

Send a test

Click Send test. We POST a synthetic inquiry (with Disputely-Test: true) and show you the status, latency and whether your response parsed. Replying {"match":"not_found"} is a valid pass.

Switch it on

Once a test passes, flip the row's Active toggle. From then on, inquiries for your account go to your endpoint. Flip it off any time — nothing is deleted.

Pick which lookups you want (optional)

Under Use it for on the Order lookup row, Bank inquiries (RESOLVE) is on by default. Tick Customer sign-in (Flows) if your Flows let customers sign in directly with email + order number and you want those lookups answered from your CRM too. Anything unticked keeps using Disputely's normal matching.

Add actions (optional)

Repeat URL → test → activate on the Refund order, Cancel subscription, Pause subscription and Skip next charge rows (the same URL is fine — branch on the event type). Once a row is active, the Flow editor offers Custom CRM as a connection for that action step.

Only the account owner can generate or rotate the secret, change URLs, or activate endpoints. Team members see a read-only card.

The hard rule: 3 seconds, no retries

A person is waiting. Your endpoint has 3 seconds to return a 2xx with a valid body. Anything else — timeout, 5xx, 4xx, redirect, unparseable JSON — is relayed to the network as no match and the moment is gone. There is no retry; the next inquiry on the same charge arrives as a brand-new event.

Build for availability, not retry: keep the handler warm, index your orders by auth code and last four, and fail fast if your database is down.

What you receive

Every delivery is a POST with a JSON body and these headers:

Content-Type: application/json
User-Agent: Disputely-Webhook/1.0
Disputely-Event: order.lookup.requested
Disputely-Delivery: del_01JD4X8YQK2M…
Disputely-Account-Id: acct_2ZK8Q1M4
Disputely-Timestamp: 1759969200
Disputely-Signature: t=1759969200,v1=4f6c3e9b…
Disputely-Respond-Within-Ms: 3000
Disputely-Test: true            # only on test events

Body:

{
  "id": "evt_01JD4X8YQK2M3N4P5Q6R7S8T9V",
  "type": "order.lookup.requested",
  "createdAt": "2026-10-09T17:00:00.182Z",
  "account": "acct_2ZK8Q1M4",
  "data": {
    "deliveryId": "del_01JD4X8YQK2M3N4P5Q6R7S8T9V",
    "event": "order.lookup.requested",
    "accountId": "acct_2ZK8Q1M4",
    "query": { "by": "transaction" },
    "inquiry": {
      "correlationId": "0.106adc17.1783098869.cb04062",
      "issuerName": "Capital One Services LLC",
      "issuerId": "d5c91e0c81f5",
      "originatorChannel": "CALL_CENTRE",
      "transactionCategory": "PURCHASE",
      "locale": "en-US",
      "disputeContext": null
    },
    "transaction": {
      "paymentType": "MASTERCARD",
      "authCode": "00061D",
      "acquirerReferenceNumber": "24011346115100111919928",
      "amount": 40.06,
      "currency": "USD",
      "date": "2026-10-08T04:03:35Z",
      "cardInfo": { "bin": "555555", "lastFour": "0660" },
      "merchantId": "MdL9plfI6rYOWppcUyMO",
      "transactionIdentifier": { "type": "BANKNET", "value": "306115146154520" },
      "cardAcceptor": {
        "id": "123456789",
        "name": "SP YOURSTORE.COM",
        "location": "YOURSTORE.",
        "region": "NJ",
        "country": "USA"
      },
      "clearing": null
    }
  }
}

id is unique per delivery; a redelivery of the same event (which only happens for asynchronous events — never for this one) keeps the same id.

Matching the transaction to an order

Use transaction in this order:

  1. authCode — the authorization code your processor gave you. Exact match is near-certain.
  2. cardInfo.lastFour plus amount and date (±1 day for settlement drift).
  3. acquirerReferenceNumber if you store ARNs.

Field names mirror the alert object, so a handler you already wrote for alerts can share matching code.

Verifying the signature

Always verify before trusting a delivery. Disputely-Signature is t=<unix seconds>,v1=<hex HMAC-SHA256> where the HMAC is over the exact bytes <t>.<raw body> using your whsec_ secret.

import crypto from 'crypto';

export function verify(secret, rawBody, header, toleranceSec = 300) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
  const t = Number(parts.t);
  if (!Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
  const expected = crypto
    .createHmac('sha256', secret)
    .update(Buffer.concat([Buffer.from(`${t}.`), rawBody]))
    .digest('hex');
  const a = Buffer.from(expected, 'hex');
  const b = Buffer.from(parts.v1 || '', 'hex');
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

Use the raw request bytes. Re-serializing the JSON changes whitespace or key order and breaks the signature. Reject anything outside the 5-minute timestamp window to prevent replay. On a bad signature, return 400.

What you send back

Respond 200 with JSON. match is required:

matchMeaningAlso include
foundExactly one order matchesorder
not_foundNo order matches — answer this quickly—
multipleSeveral orders match and you can't pick one—

Don't return 4xx for a miss. not_found is the correct, fast answer.

Minimum order to count as a match

{
  "match": "found",
  "order": {
    "orderId": "ACM-100482",
    "orderDate": "2026-10-08T04:03:12Z",
    "orderStatus": "Closed_Complete",
    "currency": "USD",
    "pricing": { "subtotal": 36.99, "tax": 3.07, "shipping": 0, "total": 40.06 },
    "orderEmail": "jane.doe@example.com",
    "orderPhone": "+15125551234",
    "items": [
      { "id": "1", "productName": "Acme Classic Tee", "quantity": "1", "productPrice": 36.99, "productType": "physical" }
    ],
    "payments": [
      {
        "id": "pay_1",
        "matchedPayment": true,
        "amount": 40.06,
        "cardLastFour": "0660",
        "authCode": "00061D",
        "authorizedAt": "2026-10-08T04:03:35Z",
        "billingAddress": { "line1": "742 Evergreen Terrace", "city": "Springfield", "state": "IL", "postalCode": "62704", "country": "US" }
      }
    ],
    "deliveries": [
      {
        "id": "del_1",
        "physicalDelivery": {
          "trackingNumber": "1Z999AA10123456784",
          "shippingAddress": { "line1": "742 Evergreen Terrace", "city": "Springfield", "state": "IL", "postalCode": "62704", "country": "US" }
        }
      }
    ]
  }
}

Required for found: orderId, orderDate, currency, pricing.total (or amount), at least one item with productName, and at least one payment. Exactly one payment should carry matchedPayment: true; if none does we mark the first. orderStatus is one of Open_Pending, Open_PendingReturn, Closed_Complete, Closed_Canceled, or Other (anything else becomes Other with your value in orderStatusOther).

Worth adding

More context makes it more likely the cardholder recognizes the charge and drops the dispute:

  • deliveries[] with a shipping address or tracking number (required if you ship physical goods).
  • transactionDetails — deviceIpAddress, orderDeviceId and similar from the original checkout.
  • accountProfile.userIdName — the login/username that placed the order.
  • order.merchantProfile.name / description — override the store name shown to the cardholder for this one order (multi-brand merchants).

Fields we don't recognize are ignored, so it's safe to send your full order object.

Fields Flows uses

If you also use the lookup for Flows, add these to order so refunds and cancels can reference the right records and the Flow can reason about the order. All optional; sensible fallbacks apply.

FieldUsed for
orderNumberThe customer-facing number (if different from orderId). Matched against what they typed.
payments[].transactionIdEchoed on order.refund.requested (the matchedPayment: true leg wins).
subscriptions[][{ "subscriptionId", "status" }] — active ids are echoed on cancel.
customer{ "customerId", "email", "firstName", "lastName", "country", "orderCount" }
refundableAmount / pricing.refundedRemaining refundable balance (else total − refunded, else total).
fulfillmentStatusfulfilled / unfulfilled / partial / cancelled (else derived from orderStatus).
shippingStatusnot_shipped / in_transit / delivered (else derived from tracking).

Lookups by customer (Flows sign-in)

With Customer sign-in (Flows) ticked, a customer signing into one of your Flows with their email and order number triggers the same endpoint and the same event type, with query.by: "customer" and a query.customer block instead of inquiry / transaction:

{
  "type": "order.lookup.requested",
  "account": "acct_2ZK8Q1M4",
  "data": {
    "deliveryId": "del_…",
    "event": "order.lookup.requested",
    "accountId": "acct_2ZK8Q1M4",
    "context": "flow",
    "query": {
      "by": "customer",
      "customer": { "email": "jane.doe@example.com", "orderNumber": "#100482", "trackingNumber": null }
    }
  }
}

Bank-inquiry deliveries carry "query": { "by": "transaction" }, so one handler branches on data.query.by. Reply with the same { "match", "order" } body either way.

Disputely enforces the match itself: the returned orderEmail (or customer.email) must equal the entered email, and orderNumber / orderId must match the number they typed (or the tracking number must appear in deliveries[]). Anything else is treated as not_found, so you cannot accidentally expose another customer's order. Return the order only when you are satisfied too.

Refunds and subscription actions (Flows)

Flow action steps on the Custom CRM connection call your Refund order, Cancel subscription, Pause subscription or Skip next charge endpoint synchronously with a 10 second budget. Every request carries an idempotency key — in the body and as Disputely-Idempotency-Key — that is stable for that action on that customer journey. If you see the same key twice, return your previous answer; never move money twice.

{
  "type": "order.refund.requested",
  "account": "acct_2ZK8Q1M4",
  "data": {
    "deliveryId": "del_…",
    "event": "order.refund.requested",
    "accountId": "acct_2ZK8Q1M4",
    "context": "flow",
    "idempotencyKey": "run_7f3a…:blk_refund",
    "order": { "orderId": "ACM-100482", "orderNumber": "100482", "transactionId": "txn_123" },
    "customer": { "email": "jane.doe@example.com" },
    "refund": { "amount": 40.06, "currency": "USD", "reason": "customer_request" },
    "run": { "id": "run_7f3a…", "blockId": "blk_refund", "pageId": "page_…" }
  }
}

The subscription events replace refund with a subscription block. subscriptionId / subscriptionIds are whatever you returned from the lookup (null / [] if the customer came in through a bank link rather than your lookup — then match on customer.email + order).

Eventsubscription fields
subscription.cancel.requestedtiming: period_end | immediate | specific_date | after_terms; cancelDate (YYYY-MM-DD or null); afterTerms (integer or null)
subscription.pause.requestedtiming: until_resumed | until_date | for_cycles; pauseUntil (YYYY-MM-DD or null); pauseCycles (integer or null)
charge.skip.requestedskipCount: how many upcoming charges to skip (1–12)

Reply 200 with:

{ "status": "succeeded", "refundId": "rf_9Q2", "amount": 40.06, "currency": "USD" }
{ "status": "succeeded", "subscriptionId": "sub_1", "effectiveAt": "2026-11-01" }
{ "status": "succeeded", "subscriptionId": "sub_1", "resumesAt": "2026-12-01" }
{ "status": "succeeded", "subscriptionId": "sub_1", "skipped": 1, "nextChargeAt": "2026-12-01" }
{ "status": "failed", "error": { "code": "already_refunded", "message": "Refunded on Oct 1" } }

Everything after status is optional. amount may be lower than requested (partial) and skipped lower than skipCount; neither is ever recorded higher than what was asked. error.code is lowercase snake_case and is shown to the merchant in the Flows inbox. A timeout, non-2xx, or unparseable body parks the action for merchant review — it is not retried.

Test events for these rows carry Disputely-Test: true and a fake order (TEST-1001). Treat them as a dry run: answer succeeded without touching anything, or failed — both pass.

Changing things later

  • Edit URL — re-validated, deactivates that endpoint until a new test passes against the new URL.
  • Remove — clears the URL and deactivates the endpoint. The secret and your other endpoints are untouched.
  • Rotate secret — new whsec_ shown once. It applies to every endpoint and takes effect within about a minute; update your verifier first or do it during a quiet period.
  • Active toggle — off means that operation falls back to Disputely's normal path. Your URL and secret are kept.

Seeing what happened

Every inquiry sent to your endpoint — our request, your response, and the outcome — is recorded. Each endpoint row in Settings shows its last 48 hours of deliveries, matches, timeouts and errors, and the full lookup history is available via the Lookups endpoint with resolve_lookups:read.

On this page