1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "report_text": `settlement-id settlement-start-date settlement-end-date deposit-date total-amount currency transaction-type order-id merchant-order-id adjustment-id shipment-id marketplace-name amount-type amount-description amount fulfillment-id posted-date posted-date-time order-item-code merchant-order-item-id merchant-adjustment-item-id sku quantity-purchased promotion-id
121000000001 2026-10-01 2026-10-15 2026-10-17 8.59 USD Order 111-0000001-0000001 Amazon.com ItemPrice Principal 25.00 AFN 2026-10-02 WIDGET-1 1
131000000001 8.59 USD Order 111-0000001-0000001 Amazon.com ItemPrice Tax 2.00 AFN 2026-10-02 WIDGET-1
141000000001 8.59 USD Order 111-0000001-0000001 Amazon.com ItemFees Commission -4.05 AFN 2026-10-02 WIDGET-1
151000000001 8.59 USD Order 111-0000001-0000001 Amazon.com ItemFees FBAPerUnitFulfillmentFee -5.50 AFN 2026-10-02 WIDGET-1
161000000001 8.59 USD Order 111-0000001-0000001 Amazon.com Promotion ShippingDiscount -1.50 AFN 2026-10-02 WIDGET-1
171000000001 8.59 USD Refund 111-0000002-0000002 Amazon.com ItemPrice Principal -18.00 AFN 2026-10-05 WIDGET-2 -1
181000000001 8.59 USD Refund 111-0000002-0000002 Amazon.com ItemRelatedFees RefundCommission 2.94 AFN 2026-10-05 WIDGET-2
191000000001 8.59 USD adjustment Amazon.com Adjustment WAREHOUSE_DAMAGED 4.50 AFN 2026-10-08 WIDGET-1
201000000001 8.59 USD FBA Inventory Reimbursement Amazon.com FBA Inventory Reimbursement Reimbursement 6.20 AFN 2026-10-09 WIDGET-3
211000000001 8.59 USD MysteryCharge Amazon.com Other OTHER -3.00 2026-10-10
221000000002 2026-10-16 2026-10-31 2026-11-02 USD ServiceFee Amazon.com Subscription Subscription Fee -39.99 2026-10-16
231000000002 USD Order 111-0000003-0000003 Amazon.com ItemPrice Principal 12.49 AFN 2026-10-20 GADGET-9 1`
24};
25
26
27const run = await client.actor("tomwang/amazon-settlement-normalizer").call(input);
28
29
30console.log('Results from dataset');
31console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
32const { items } = await client.dataset(run.defaultDatasetId).listItems();
33items.forEach((item) => {
34 console.dir(item);
35});
36
37