Transactions and refunds
Persist matched tax calculations with full jurisdiction snapshots, review net tax ledger totals, void mistakes, and record full or partial refunds.
Commit calculations
Include commit: true in POST /tax/calculate along with optional externalId, transactionDate (YYYY-MM-DD), and metadata. Net Amount stores exact integer-cent totals and the complete calculation snapshot, and returns a transaction summary containing transactionId. A committed sale needs a successful match: if the calculation cannot be produced (no_match, ambiguous, missing_rates, invalid_rates, or unresolved sourcing) the API returns HTTP 422 (commit_not_possible) and stores nothing. externalId values are unique per (owner, entityId) scope—unscoped workspace commits with no entityId form their own namespace—and stay reserved after a transaction is voided. A duplicate returns HTTP 409 (duplicate_transaction) without charging your monthly allowance.
externalId when you commit. If a request times out, retry with the same externalId: a 409 then tells you the first attempt was stored.List, paginate, and inspect transactions
Filter your committed ledger with optional query parameters: status (committed or voided), type (sale or refund), state, customerId, externalId, from and to (YYYY-MM-DD), entityId / entityCode / ein (with optional includeChildren=true), limit (1 to 100, default 50), and cursor (pass the previous page's nextCursor to walk through the full ledger without row limits). The response returns hasMore, nextCursor, and a summary object with exact net tax, tax collected, tax refunded, taxable sales, exempt sales, and counts across matching records (excluding voided transactions from monetary totals). On page 1, the summary scans up to 10,000 matching rows across paginated batches and sets truncated: true only if more than 10,000 rows match.
{
"count": 1,
"hasMore": false,
"nextCursor": null,
"truncated": false,
"summary": {
"saleCount": 1,
"refundCount": 0,
"voidedCount": 0,
"grossSales": 250,
"taxableSales": 250,
"exemptSales": 0,
"taxCollected": 18.75,
"taxRefunded": 0,
"netTax": 18.75
},
"transactions": [
{
"transactionId": "txn_4c8e1f2a9b7d6e5f4a3b2c1d0e9f8a7b",
"entityId": null,
"externalId": "order_10492",
"type": "sale",
"status": "committed",
"parentTransactionId": null,
"transactionDate": "2026-11-29",
"customerId": "cust_acme_001",
"exemptionCertificateId": null,
"exemptionReason": null,
"stateCode": "FL",
"stateName": "Florida",
"currency": "USD",
"mode": "exclusive",
"rounding": "half_up",
"taxRate": 0.075,
"subtotal": 250,
"taxableAmount": 250,
"exemptAmount": 0,
"shippingAmount": 0,
"taxAmount": 18.75,
"total": 268.75,
"committedAt": 1795881600000,
"voidedAt": null,
"voidReason": null,
"metadata": { "channel": "b2b_portal" }
}
]
}Generate a penny-reconciled sales tax filing report for any inclusive from and to date range (with optional state and entity filters: entityId, entityCode, ein, and includeChildren=true), grouped by state and taxing jurisdiction (state, county, city, and special district). Voided entries are excluded. Pass format=csv to download an RFC 4180 CSV file ready for return preparation or spreadsheet import.
Returns the transaction summary, its stored snapshot (coordinates, jurisdictions, sourcing, applied exemption, line items, and jurisdiction tax breakdown), and any linked child refunds.
Void and refund transactions
Marks a committed transaction as voided (optional reason). Voided transactions remain visible for audit trails but are excluded from ledger monetary totals. Sales with active child refunds cannot be voided (409 transaction_has_refunds); void the child refunds first or issue an adjustment.
{
"reason": "Order canceled before fulfillment"
}Creates a negative-amount refund transaction linked to a committed sale. Omit lineItems and shipping (send {} or just reason) for a full refund of 100% of remaining refundable amounts and pennies. For a partial refund, pass specific lineItems ({ id, amount } or { id, quantity }) and/or shipping. Each refunded line item needs exactly one of quantity or amount (at least $0.01). Cumulative refunds exceeding remaining line, shipping, or tax amounts are rejected with HTTP 409 (refund_exceeds_remaining). A sale accepts a limited number of refund records; past that limit the API returns HTTP 409 (refund_limit_reached). Send an externalId on every refund so a retry after a timeout returns duplicate_transaction instead of creating a second refund.
{
"externalId": "refund_10492_part1",
"reason": "Returned 1 damaged unit",
"lineItems": [
{ "id": "sku_1", "amount": 50 }
]
}Bulk CSV and JSON import
Import up to 200 historical sales or refunds per request (maximum body size 512 KiB) with format: "json" (rows) or format: "csv" (csv). For CSV imports, pass preset set to "generic", "stripe", or "shopify" to map column headers automatically. Optional top-level entityId, entityCode, or ein scopes imported rows to a legal entity.
Pass dryRun: true to validate every row without writing. Rows with an already-stored externalId are skipped cleanly as skipped_duplicate, and rows whose transactionDate falls inside a locked filed return period fail individually with filing_period_locked without blocking valid rows in open periods.
{
"format": "csv",
"preset": "stripe",
"dryRun": true,
"csv": "id,Created (UTC),Currency,Subtotal,Tax,Status,Shipping Address State\nin_1001,2026-10-15 14:22:00,usd,100.00,7.50,paid,FL"
}Commerce connectors and webhooks
Connect Stripe or Shopify to stream live USD sales and refunds directly into your committed transaction ledger. Creating a connection returns its unique webhook ingest path; pass your provider's signing secret (Stripe whsec_... or Shopify webhook secret, 16–256 chars) via webhookSecret on POST or PATCH (or omit it to generate a one-time secret and update it later). Net Amount stores the secret server-side for HMAC verification and exposes only webhookSecretLast4 on reads.
- Stripe webhooks: Subscribe to
invoice.paid,checkout.session.completed,credit_note.created, andcharge.refunded. Verified viaStripe-SignatureHMAC-SHA256 with a 5-minute replay window. Invoice-backed Checkout Sessions automatically deduplicate againstinvoice.paid, each refund insidecharge.refundedis tracked by its individual refund ID (stripe_refund:<refund_id>), and test-mode events are skipped on livecommitconnections. - Shopify webhooks: Subscribe to
orders/paidandrefunds/create. Verified via constant-timeX-Shopify-Hmac-Sha256and deduplicated withshopify:<id>/shopify_refund:<id>. - Manual JSON sync & period locks: Post up to 100 provider event payloads to
POST /integrations/connections/{connectionId}/sync(supportsdryRun: true). Both webhooks and manual syncs enforce filing-period locks (filing_period_locked) on closed entity return periods.
{
"provider": "stripe",
"label": "Stripe US Production",
"syncMode": "commit",
"webhookSecret": "whsec_your_stripe_endpoint_secret"
}Outbound webhooks
Configure up to 15 outbound HTTPS webhook endpoints per workspace (or manage them from /dashboard/webhooks) to receive real-time compliance alerts and ledger lifecycle events. Creating an endpoint or rotating its secret via PATCH /webhooks/{webhookId} with { "rotateSecret": true } returns the whsec_... signing secret once; subsequent reads expose only signingSecretLast4.
- SSRF-hardened HTTPS-only delivery: Destination URLs must use
https://on port 443 and target a fully qualified public hostname or public IP. Embedded credentials,localhost, internal suffixes (.local,.internal,.lan), private, loopback, link-local, and reserved IPv4/IPv6 ranges, and shorthand numeric/hex/octal IPs are blocked. Before delivery, Net Amount verifies DNS-resolved IPs against private and reserved ranges, sends requests withredirect: "manual"(rejecting HTTP 3xx redirects), and enforces an 8-second timeout. - Canonical JSON event envelope: Every live and test delivery (
POST /webhooks/{webhookId}/test) sends a JSON body withid(evt_...),type,apiVersion("2026-01"), ISO-8601 UTCcreatedAt, and an event-specificdataobject. - Subscribable event types (10):
nexus.approaching,nexus.exceeded,filing.due_soon,filing.status_changed,exemption.expiring_soon,usage.quota_warning,usage.quota_exceeded,transaction.committed,transaction.voided, andtransaction.refunded(pluswebhook.testonPOST /webhooks/{webhookId}/test). - HMAC-SHA256 signature headers: Each delivery sends
X-NetAmount-Signature: t=<unix_sec>,v1=<hex>,X-NetAmount-Event,X-NetAmount-Delivery, andX-NetAmount-Timestamp. Parset=and allv1=entries, validate each signature is 64 hex characters before decoding, compare the digest over${timestamp}.${rawBody}in constant time, and reject timestamps outside a 300-second replay window. - Retries & auto-disable: Deliveries enforce an 8-second timeout and retry up to 5 attempts with exponential backoff (1 min, 5 min, 15 min, 1 hr) via a 5-minute background delivery sweep. Auto-disable triggers only after 20 consecutive dead-lettered deliveries (each having exhausted all 5 retry attempts), not after transient single failed attempts. Net Amount then sets the endpoint status to
disableduntil you re-enable it.
{
"url": "https://hooks.example.com/net-amount",
"description": "Finance compliance & ledger alerts",
"events": [
"nexus.approaching",
"nexus.exceeded",
"filing.due_soon",
"exemption.expiring_soon",
"usage.quota_warning",
"transaction.committed"
]
}{
"webhook": {
"webhookId": "whk_1a2b3c4d5e6f7a8b9c0d1e2f",
"url": "https://hooks.example.com/net-amount",
"description": "Finance compliance & ledger alerts",
"events": [
"nexus.approaching",
"nexus.exceeded",
"filing.due_soon",
"exemption.expiring_soon",
"usage.quota_warning",
"transaction.committed"
],
"signingSecretLast4": "9f42",
"status": "active",
"consecutiveFailures": 0,
"lastDeliveryAt": null,
"lastSuccessAt": null,
"createdAt": 1796083200000,
"updatedAt": 1796083200000
},
"signingSecret": "whsec_0123456789abcdef0123456789abcdef0123456789ab9f42"
}{
"id": "evt_4f8e9a1b2c3d4e5f6a7b8c9d",
"type": "nexus.exceeded",
"apiVersion": "2026-01",
"createdAt": "2026-11-29T13:00:00.000Z",
"data": {
"alertId": "alt_3c4d5e6f7a8b9c0d1e2f3a4b",
"entityId": "ent_9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d",
"stateCode": "FL",
"sales": 125000,
"salesThresholdDollars": 100000
}
}import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyNetAmountSignature(
rawBody: string,
signatureHeader: string,
signingSecret: string,
): boolean {
let timestamp: string | null = null;
const signatures: string[] = [];
for (const part of signatureHeader.split(",")) {
const sep = part.indexOf("=");
if (sep <= 0) continue;
const key = part.slice(0, sep).trim();
const value = part.slice(sep + 1).trim();
if (key === "t") {
if (timestamp !== null) return false;
timestamp = value;
} else if (key === "v1") {
signatures.push(value);
}
}
if (!timestamp || !/^\d+$/.test(timestamp) || signatures.length === 0) {
return false;
}
const timestampSec = Number(timestamp);
if (
!Number.isSafeInteger(timestampSec) ||
Math.abs(Math.floor(Date.now() / 1000) - timestampSec) > 300
) {
return false;
}
const expected = createHmac("sha256", signingSecret)
.update(`${timestamp}.${rawBody}`)
.digest();
return signatures.some((sig) => {
if (!/^[0-9a-f]{64}$/i.test(sig)) return false;
const actual = Buffer.from(sig, "hex");
return actual.length === expected.length && timingSafeEqual(expected, actual);
});
}Proactive compliance alerts
Net Amount continuously monitors compliance deadlines and thresholds, surfacing deduplicated alerts in your dashboard, via GET /alerts (filter by status, category, severity, entityId, and limit), and automatically dispatching them to subscribed active outbound webhooks.
- Daily 13:00 UTC scheduled monitors: Evaluates trailing-12-month committed sales for unregistered states approaching (warning) or exceeding (critical) economic nexus thresholds, unfiled
draft/readyreturns due within 7 days (warning) or within 2 days / overdue (critical), and active exemption certificates expiring within 30 days (warning) or 7 days (critical). - Entity scoping: Entity-scoped nexus, filing, and exemption alerts carry
entityId, making them visible to entity-restricted API keys and entity-filtered dashboard views. Workspace-level quota alerts and alerts derived from unassigned transactions omitentityId(entityId: null). - Real-time quota alerts: Fires an 80% monthly included-request warning (
usage.quota_warning) and a 100% critical alert (usage.quota_exceeded) as requests settle, deduplicated per billing month. - Acknowledgement workflow: Call
POST /alerts/{alertId}/acknowledge(with an empty body or{}) to mark an alert reviewed. Requiresadminortax_managerworkspace permissions.
{
"count": 2,
"openCount": 2,
"alerts": [
{
"alertId": "alt_3c4d5e6f7a8b9c0d1e2f3a4b",
"category": "nexus",
"severity": "critical",
"eventType": "nexus.exceeded",
"entityId": "ent_9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d",
"stateCode": "FL",
"resourceId": "FL",
"title": "Economic nexus threshold exceeded in Florida",
"message": "Trailing-12-month activity in Florida ($125,000.00, 125% of sales threshold) has exceeded economic nexus thresholds and no active state registration is on file.",
"status": "open",
"acknowledgedAt": null,
"acknowledgedBy": null,
"metadata": {
"stateCode": "FL",
"sales": 125000,
"salesThresholdDollars": 100000
},
"createdAt": 1796043600000,
"updatedAt": 1796043600000
},
{
"alertId": "alt_8f7e6d5c4b3a291807162534",
"category": "filing",
"severity": "warning",
"eventType": "filing.due_soon",
"entityId": "ent_9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d",
"stateCode": "TX",
"resourceId": "flg_8f7e6d5c4b3a29180716253443526170",
"title": "Texas sales tax filing due in 5 days",
"message": "Filing flg_8f7e6d5c4b3a29180716253443526170 for Texas (2026-11-01 to 2026-11-30) is in \"ready\" status and due on 2026-12-21.",
"status": "open",
"acknowledgedAt": null,
"acknowledgedBy": null,
"metadata": {
"stateCode": "TX",
"dueDate": "2026-12-21",
"daysUntilDue": 5
},
"createdAt": 1796043600000,
"updatedAt": 1796043600000
}
]
}