# Amazon Settlement-to-Order Reconciliation (`afkdigital/amazon-settlement-order-reconciliation`) Actor

Reconcile Amazon settlement V2, orders and returns CSV/TSV. Preserve split payouts and refunds, isolate account fees and currencies, and flag missing or duplicate evidence. No Seller Central login.

- **URL**: https://apify.com/afkdigital/amazon-settlement-order-reconciliation.md
- **Developed by:** [AFK Digital](https://apify.com/afkdigital) (community)
- **Categories:** E-commerce, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 unique order revieweds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Amazon Settlement-to-Order Reconciliation

Match uploaded Amazon settlement, order and return files without Seller Central login or SP-API credentials. Get decimal money calculations, source-row evidence, review findings and separate account-level adjustments.

**Price: $0.01 per examined unique order ID ($10 per 1,000).** Multiple settlement periods, currencies, fee lines and refund lines for the same order ID are included. Account-level adjustments, technical errors and same-run retry work have no separate event. Data-quality findings (including missing orders) are examined orders and count toward the price. Platform usage is included; there is no start fee.

### Quick start

Run the prefilled controlled example. It contains 7 unique order IDs, 9 result rows and four currencies, including a partial refund in a later period, duplicate candidates, a missing order, missing amount, missing settlement and an account subscription charge. The sample contains no real customer data.

Replace each file descriptor with:

- `{"text":"CSV or TSV content including headers"}`
- `{"base64":"base64-encoded UTF-8 file"}`
- `{"url":"https://api.apify.com/v2/key-value-stores/STORE/records/orders.csv"}`

For uploads, store your file in an Apify key-value store accessible by the run and paste its record URL. Select that store in **Uploaded file stores (read only)** (`sourceStores`). This grants the limited-permission run read access only to the selected stores; it is required for file URLs. Only exact HTTPS api.apify.com KVS record URLs without query strings, redirects or fragments are accepted. Arbitrary web URLs, local paths, ZIP, XLSX, PDF and legacy XML/V1 settlement reports are not supported.

Download the default Dataset as JSON or CSV, or use the spreadsheet-safe `DETAILS.csv` file from the run's key-value store. Nested evidence is encoded as JSON in the safe CSV. Values starting with spreadsheet formula characters are prefixed with an apostrophe. Native Dataset CSV is an Apify export and is not formula-neutralized by this Actor.

### Supported reports and marketplaces

Version 1.0.0 supports UTF-8 CSV and tab-delimited TXT/TSV with English field names. Amazon.de decimal commas are supported in TSV or quoted CSV amounts. Do not include thousands separators.

| Input | Supported format | Columns |
|---|---|---|
| Settlement | Amazon Flat File V2, GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE_V2 | settlement-id, transaction-type, order-id, marketplace-name, currency, amount-type, amount-description, amount |
| Orders | All Orders by order date or last update, GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL / GET_FLAT_FILE_ALL_ORDERS_DATA_BY_LAST_UPDATE_GENERAL | amazon-order-id, sales-channel, currency; item-price, item-tax, shipping-price, shipping-tax, gift-wrap-price, gift-wrap-tax, item-promotion-discount, ship-promotion-discount |
| Normalized orders | Customer-prepared CSV/TSV | order_id, marketplace, currency, order_amount |
| Financial returns | Customer-prepared CSV/TSV | order_id, marketplace, currency, refund_amount (positive refunded gross, net of promotions, excluding fee reversals) |
| Physical returns | FBA Customer Returns-style TSV | order-id, return-date, quantity; these rows provide evidence, not a monetary refund amount |

Settlement currency may appear on the summary row and is inherited **only within the same settlement-id**. Conflicting currencies within a settlement fail validation. Summary `total-amount` is not itself a transaction and is excluded from transaction totals.

Tested with controlled representative fixtures for Amazon.com (USD), Amazon.ca (CAD), Amazon.co.uk (GBP), and Amazon.de (EUR). These are format tests, not live account certification. Other marketplace names are retained with `untested_marketplace` and no computed expected net. No marketplace is inferred from currency alone.

For native All Orders amounts, every listed monetary component must be present and nonblank. Explicit zero is accepted; blanks are not guessed to be zero. `item-price` is a line amount and is **not multiplied by quantity**. Normalize tax-inclusive reports into `order_amount` if the exported tax basis differs. Do not add separate tax again to a tax-inclusive total. Pending/cancelled orders require review.

Column mapping sections are `settlement`, `orders`, and `returns`. Keys are documented canonical column names; values are actual file headers. Example:
`{"orders":{"order_id":"Order Number","order_amount":"Gross Total","marketplace":"Market","currency":"CCY"}}`.
Mappings cannot overwrite an existing different canonical column or reuse a source header.

### What the comparison means

The result is a **combined provided-period reconciliation**, grouped by order ID, marketplace and currency. `settlement_id` is an array. Several shipments, payments and refunds remain as separate source-row evidence. No order total is assigned to a single settlement period. Include the original sale and relevant later refunds for meaningful lifecycle comparison.

- `order_amount`: sum of supplied order line gross amounts after promotions.
- `fee_total`: signed cost of observed ItemFees, ShipmentFees and ItemWithheldTax; refund fee credits reduce this cost.
- `refund_total`: positive net refunded ItemPrice/Promotion amount from settlements, or the supplied financial-return total where available.
- `reported_net`: sum of **all** settlement transaction amounts for this order/currency/marketplace.
- `expected_net = order_amount - fee_total - refund_total`.
- `difference = reported_net - expected_net`. Matched when the absolute difference is within tolerance.

This checks order gross consistency using observed fee/refund entries. It does not independently validate Amazon fee schedules, predict missing charges, prove settlement completeness, reconcile the bank deposit or establish a recoverable claim. An order with only a later refund and no original sale in the selected files can show a difference caused by the input window.

If a physical return has no monetary refund value, expected net is null. A return is not automatically a refund. Missing order amounts, ambiguous return identity, duplicate candidates and unknown transaction/amount types also make expected net null. `reported_refund_total` separately preserves the observed settlement refund when a financial-return file supplies a different expected refund.

Identical source rows are **retained**, including their amounts, and flagged `duplicate_candidate`; they are never silently discarded. Distinct shipment/adjustment IDs or dates distinguish legitimate repeated payments. Review candidates before relying on sums.

Transactions without an order ID produce separate `account_adjustment` records and are not allocated to an order or billed. Currency totals are always separate. No FX conversion or cross-currency arithmetic is performed.

### Output

Required fields: order_id, settlement_id, marketplace, currency, order_amount, fee_total, refund_total, expected_net, reported_net, difference, match_status, evidence_rows.

Amounts are decimal strings; unavailable amounts are null. Statuses: matched, difference, needs_review, missing_order, missing_settlement, account_level. Additional fields include record_type, issues, reported_refund_total and expected_net_basis.

Evidence contains file role, original 1-based CSV record number (header is row 1), settlement ID, amount metadata and date. Source order-item/shipment metadata is used for duplicate detection; raw customer contact details and product names are not exported or logged. Keep original files for a complete audit trail.

Outputs:

- Default Dataset: one result per order/marketplace/currency plus account adjustment groups.
- DETAILS and DETAILS.csv: JSON and formula-neutralized CSV.
- SUMMARY: currency totals, status counts, unique orders, delivery and billing counts.
- OUTPUT: links/summary metadata.
- ERROR: a safe validation message for invalid input.

### Limits, privacy and billing behavior

10 MiB per decoded file; 50,000 data rows per file; 128 columns; 4,096 characters per cell; maximum 10,000 unique order IDs. A single result over 8 MiB is rejected before any charge. Use smaller reporting windows when necessary. The default timeout is 240 seconds and memory 256 MiB.

All input validation and reconciliation finish before delivery begins. Invalid files create no order events. Once a result is saved it can be billed; a later technical interruption does not undo already delivered reviews. A saved order ID is never charged again when the **same run** is resurrected. An uncertain save/charge boundary can leave a free result rather than retrying a charge. A separately submitted new run is a new review.

The run spending limit is checked before each new unique order. All currencies of an admitted order are saved together for one event. Unaffordable orders are omitted and the summary flags the budget limit. Free account adjustments remain available. Summary currency/status totals describe the whole validated input; delivered counts identify the budget-limited subset.

No customer data, source file contents, identifiers or download URLs are printed to logs. Files and results are stored in the customer's Apify run storage under Apify retention/access settings. The Actor does not send files to any third-party analysis service.

### Reference documentation

Checked 2026-11-07:

- [Amazon settlement report reference](https://developer-docs.amazon/sp-api/docs/report-type-values-settlement)
- [Amazon order reports](https://developer-docs.amazon/sp-api/docs/report-type-values-order)
- [Amazon FBA reports](https://developer-docs.amazon/sp-api/docs/report-type-values-fba)
- [Apify pay-per-event pricing](https://docs.apify.com/actors/monetize/pay-per-event)
- [Apify Python PPE and idempotency](https://docs.apify.com/sdk/python/docs/concepts/pay-per-event)

Runtime dependencies: Apify Python SDK 4.2.1 (Apache-2.0), HTTPX 0.28.1 (BSD-3-Clause), Python Decimal/CSV. Amazon documentation is referenced for interoperability; no Amazon report data or documentation is redistributed. Independent AFK Digital product, not affiliated with Amazon.

# Actor input Schema

## `settlementFile` (type: `object`):

File descriptor: {"text":"..."} or {"base64":"..."} or {"url":"https://api.apify.com/v2/key-value-stores/STORE/records/FILE"}. UTF-8 CSV/TSV only, 10 MiB and 50,000 rows maximum.

## `ordersFile` (type: `object`):

File descriptor: {"text":"..."} or {"base64":"..."} or {"url":"https://api.apify.com/v2/key-value-stores/STORE/records/FILE"}. UTF-8 CSV/TSV only, 10 MiB and 50,000 rows maximum.

## `optionalReturnsFile` (type: `object`):

File descriptor: {"text":"..."} or {"base64":"..."} or {"url":"https://api.apify.com/v2/key-value-stores/STORE/records/FILE"}. UTF-8 CSV/TSV only, 10 MiB and 50,000 rows maximum.

## `columnMapping` (type: `object`):

Sections settlement, orders, returns; each maps a documented canonical column name to the source header.

## `tolerance` (type: `string`):

Ungrouped decimal amount in each row currency; default 0.01. No FX conversion.

## `maxOrders` (type: `integer`):

Fail before billing when exceeded; unique order_id across all currencies and periods.

## `sourceStores` (type: `array`):

Select each existing key-value store referenced in file URL descriptors. Required for limited-permission access to uploaded files. Not needed for text/base64 inputs.

## Actor input object example

```json
{
  "settlementFile": {
    "text": "settlement-id\ttransaction-type\torder-id\tmarketplace-name\tcurrency\tamount-type\tamount-description\tamount\tposted-date\nS1\tOrder\tA\tAmazon.com\tUSD\tItemPrice\tPrincipal\t100\t2026-10-01\nS1\tOrder\tA\tAmazon.com\tUSD\tItemFees\tCommission\t-15\t2026-10-01\nS2\tRefund\tA\tAmazon.com\tUSD\tItemPrice\tPrincipal\t-20\t2026-11-01\nS2\tRefund\tA\tAmazon.com\tUSD\tItemFees\tCommission\t3\t2026-10-01\nS1\tOrder\tB\tAmazon.com\tUSD\tItemPrice\tPrincipal\t50\t2026-10-01\nS1\tOrder\tB\tAmazon.com\tUSD\tItemPrice\tPrincipal\t50\t2026-10-01\nS1\tOrder\tD\tAmazon.com\tUSD\tItemPrice\tPrincipal\t30\t2026-10-01\nS1\tOrder\tE\tAmazon.com\tUSD\tItemPrice\tPrincipal\t25\t2026-10-01\nSEU\tOrder\tA\tAmazon.de\tEUR\tItemPrice\tPrincipal\t80\t2026-10-01\nSUK\tOrder\tG\tAmazon.co.uk\tGBP\tItemPrice\tPrincipal\t70\t2026-10-01\nSCA\tOrder\tH\tAmazon.ca\tCAD\tItemPrice\tPrincipal\t60\t2026-10-01\nS1\tServiceFee\t\tAmazon.com\tUSD\tother-transaction\tSubscriptionFee\t-39.99\t2026-10-01\n"
  },
  "ordersFile": {
    "text": "order_id,marketplace,currency,order_amount\r\nA,Amazon.com,USD,100\r\nB,Amazon.com,USD,50\r\nC,Amazon.com,USD,40\r\nE,Amazon.com,USD,\r\nA,Amazon.de,EUR,80\r\nG,Amazon.co.uk,GBP,70\r\nH,Amazon.ca,CAD,60\r\n"
  },
  "columnMapping": {},
  "tolerance": "0.01",
  "maxOrders": 10000
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `csv` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "settlementFile": {
        "text": "settlement-id\ttransaction-type\torder-id\tmarketplace-name\tcurrency\tamount-type\tamount-description\tamount\tposted-date\nS1\tOrder\tA\tAmazon.com\tUSD\tItemPrice\tPrincipal\t100\t2026-10-01\nS1\tOrder\tA\tAmazon.com\tUSD\tItemFees\tCommission\t-15\t2026-10-01\nS2\tRefund\tA\tAmazon.com\tUSD\tItemPrice\tPrincipal\t-20\t2026-11-01\nS2\tRefund\tA\tAmazon.com\tUSD\tItemFees\tCommission\t3\t2026-10-01\nS1\tOrder\tB\tAmazon.com\tUSD\tItemPrice\tPrincipal\t50\t2026-10-01\nS1\tOrder\tB\tAmazon.com\tUSD\tItemPrice\tPrincipal\t50\t2026-10-01\nS1\tOrder\tD\tAmazon.com\tUSD\tItemPrice\tPrincipal\t30\t2026-10-01\nS1\tOrder\tE\tAmazon.com\tUSD\tItemPrice\tPrincipal\t25\t2026-10-01\nSEU\tOrder\tA\tAmazon.de\tEUR\tItemPrice\tPrincipal\t80\t2026-10-01\nSUK\tOrder\tG\tAmazon.co.uk\tGBP\tItemPrice\tPrincipal\t70\t2026-10-01\nSCA\tOrder\tH\tAmazon.ca\tCAD\tItemPrice\tPrincipal\t60\t2026-10-01\nS1\tServiceFee\t\tAmazon.com\tUSD\tother-transaction\tSubscriptionFee\t-39.99\t2026-10-01\n"
    },
    "ordersFile": {
        "text": "order_id,marketplace,currency,order_amount\r\nA,Amazon.com,USD,100\r\nB,Amazon.com,USD,50\r\nC,Amazon.com,USD,40\r\nE,Amazon.com,USD,\r\nA,Amazon.de,EUR,80\r\nG,Amazon.co.uk,GBP,70\r\nH,Amazon.ca,CAD,60\r\n"
    },
    "columnMapping": {},
    "tolerance": "0.01"
};

// Run the Actor and wait for it to finish
const run = await client.actor("afkdigital/amazon-settlement-order-reconciliation").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "settlementFile": { "text": """settlement-id\ttransaction-type\torder-id\tmarketplace-name\tcurrency\tamount-type\tamount-description\tamount\tposted-date
S1\tOrder\tA\tAmazon.com\tUSD\tItemPrice\tPrincipal\t100\t2026-10-01
S1\tOrder\tA\tAmazon.com\tUSD\tItemFees\tCommission\t-15\t2026-10-01
S2\tRefund\tA\tAmazon.com\tUSD\tItemPrice\tPrincipal\t-20\t2026-11-01
S2\tRefund\tA\tAmazon.com\tUSD\tItemFees\tCommission\t3\t2026-10-01
S1\tOrder\tB\tAmazon.com\tUSD\tItemPrice\tPrincipal\t50\t2026-10-01
S1\tOrder\tB\tAmazon.com\tUSD\tItemPrice\tPrincipal\t50\t2026-10-01
S1\tOrder\tD\tAmazon.com\tUSD\tItemPrice\tPrincipal\t30\t2026-10-01
S1\tOrder\tE\tAmazon.com\tUSD\tItemPrice\tPrincipal\t25\t2026-10-01
SEU\tOrder\tA\tAmazon.de\tEUR\tItemPrice\tPrincipal\t80\t2026-10-01
SUK\tOrder\tG\tAmazon.co.uk\tGBP\tItemPrice\tPrincipal\t70\t2026-10-01
SCA\tOrder\tH\tAmazon.ca\tCAD\tItemPrice\tPrincipal\t60\t2026-10-01
S1\tServiceFee\t\tAmazon.com\tUSD\tother-transaction\tSubscriptionFee\t-39.99\t2026-10-01
""" },
    "ordersFile": { "text": """order_id,marketplace,currency,order_amount\r
A,Amazon.com,USD,100\r
B,Amazon.com,USD,50\r
C,Amazon.com,USD,40\r
E,Amazon.com,USD,\r
A,Amazon.de,EUR,80\r
G,Amazon.co.uk,GBP,70\r
H,Amazon.ca,CAD,60\r
""" },
    "columnMapping": {},
    "tolerance": "0.01",
}

# Run the Actor and wait for it to finish
run = client.actor("afkdigital/amazon-settlement-order-reconciliation").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "settlementFile": {
    "text": "settlement-id\\ttransaction-type\\torder-id\\tmarketplace-name\\tcurrency\\tamount-type\\tamount-description\\tamount\\tposted-date\\nS1\\tOrder\\tA\\tAmazon.com\\tUSD\\tItemPrice\\tPrincipal\\t100\\t2026-10-01\\nS1\\tOrder\\tA\\tAmazon.com\\tUSD\\tItemFees\\tCommission\\t-15\\t2026-10-01\\nS2\\tRefund\\tA\\tAmazon.com\\tUSD\\tItemPrice\\tPrincipal\\t-20\\t2026-11-01\\nS2\\tRefund\\tA\\tAmazon.com\\tUSD\\tItemFees\\tCommission\\t3\\t2026-10-01\\nS1\\tOrder\\tB\\tAmazon.com\\tUSD\\tItemPrice\\tPrincipal\\t50\\t2026-10-01\\nS1\\tOrder\\tB\\tAmazon.com\\tUSD\\tItemPrice\\tPrincipal\\t50\\t2026-10-01\\nS1\\tOrder\\tD\\tAmazon.com\\tUSD\\tItemPrice\\tPrincipal\\t30\\t2026-10-01\\nS1\\tOrder\\tE\\tAmazon.com\\tUSD\\tItemPrice\\tPrincipal\\t25\\t2026-10-01\\nSEU\\tOrder\\tA\\tAmazon.de\\tEUR\\tItemPrice\\tPrincipal\\t80\\t2026-10-01\\nSUK\\tOrder\\tG\\tAmazon.co.uk\\tGBP\\tItemPrice\\tPrincipal\\t70\\t2026-10-01\\nSCA\\tOrder\\tH\\tAmazon.ca\\tCAD\\tItemPrice\\tPrincipal\\t60\\t2026-10-01\\nS1\\tServiceFee\\t\\tAmazon.com\\tUSD\\tother-transaction\\tSubscriptionFee\\t-39.99\\t2026-10-01\\n"
  },
  "ordersFile": {
    "text": "order_id,marketplace,currency,order_amount\\r\\nA,Amazon.com,USD,100\\r\\nB,Amazon.com,USD,50\\r\\nC,Amazon.com,USD,40\\r\\nE,Amazon.com,USD,\\r\\nA,Amazon.de,EUR,80\\r\\nG,Amazon.co.uk,GBP,70\\r\\nH,Amazon.ca,CAD,60\\r\\n"
  },
  "columnMapping": {},
  "tolerance": "0.01"
}' |
apify call afkdigital/amazon-settlement-order-reconciliation --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,afkdigital/amazon-settlement-order-reconciliation"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/WclfOfscIdYbwoxcC/builds/stI6UyC1qR1QbVwyv/openapi.json
