African Delights® US Ecommerce

Data Source

This page documents the Amazon source feeding the dashboard, the filters currently applied, and the QuickBooks-oriented account definitions used by the dashboard when building the monthly output.

Amazon Data Sources — Architecture

Amazon data enters the dashboard through two separate APIs with different scopes and purposes. They must not be confused.

SP-API Finance Transactions

Used by: Main Profitability Dashboard

Settlement-based data — reflects exactly what Amazon deposits into the bank account. Reports advertising as an account-level total for the period, not broken out by product. Source of truth for P&L, journal entries, and cash reconciliation.

Amazon Advertising API

Used by: Product-Level P&L · Pricing Tool

Disaggregated ad spend by ASIN/campaign. Required for per-product profitability and accurate advertising cost-per-unit in the pricing calculator. Uses a separate LWA Security Profile with the advertising::campaign_management scope.

SP-API Source Report

System pulled

Amazon Selling Partner API Finances Transactions feed, requested by posted date range from the North America endpoint.

Endpoint

GET /finances/2024-06-19/transactions on sellingpartnerapi-na.amazon.com.

Marketplace filter

The app uses all marketplace IDs listed in MARKETPLACE_IDS from .env.local and aggregates them into one accounting output.

Date fields

The date picker values are sent as postedAfter and postedBefore. The dashboard is intentionally based on posted date, not order date.

Transaction filter

The current code requests only transactions where transactionStatus = RELEASED.

Manual Verification

  1. 1. Open the dashboard and note the exact start date and end date you used.
  2. 2. Pull Amazon finances or statement data for the same posted date range.
  3. 3. Use the same marketplace scope as the MARKETPLACE_IDS configured in the app.
  4. 4. Keep released transactions aligned with the same scope the API is using.
  5. 5. Compare the resulting QuickBooks account totals and validation warnings rather than expecting a line-for-line Amazon Summary replica.

Amazon Advertising API — Configuration

System pulled

Amazon Advertising API (separate from SP-API). Uses a dedicated LWA Security Profile with the advertising::campaign_management scope.

Credentials

AMAZON_ADVERTISING_CLIENT_ID and AMAZON_ADVERTISING_CLIENT_SECRET in .env.local. These are different from the SP-API LWA credentials and must not be mixed.

Where used

Product-level P&L view and Pricing Tool only. The main Profitability Dashboard uses SP-API settlement data exclusively because it reflects actual bank account deposits.

Why separate

SP-API finance transactions report advertising spend as an account-level total (not per ASIN). The Advertising API disaggregates spend by campaign and ASIN, enabling per-product profitability and accurate COGS in the pricing calculator.

Auth flow

OAuth 2.0 Authorization Code Grant. Connect via the Amazon Advertising card in the Amazon diagnostic panel on the main dashboard. Tokens stored in data/amazon-ads-auth.json.

Redirect URI

https://labels.africandelightstore.com/amazon-ads/redirect (registered in LWA Security Profile). Set AMAZON_ADS_REDIRECT_URL in .env.local to override.

SP-API Variables Used In The Pull

VariableSourceDefinition
startDateDashboard date pickerSent to Amazon as postedAfter after conversion to ISO timestamp.
endDateDashboard date pickerSent to Amazon as postedBefore after conversion to ISO timestamp.
marketplaceIds.env.local -> MARKETPLACE_IDSAll marketplace IDs in the comma-separated list are pulled and aggregated together.
transactionStatusHard-coded in API requestAlways set to RELEASED in the current implementation.
breakdown.breakdownTypeAmazon transaction breakdown payloadPrimary driver for the QuickBooks account mapping logic.
transaction.descriptionAmazon transaction payloadFallback context for mapping when breakdownType alone is not sufficient.
breakdown.breakdownAmount.currencyAmountAmazon transaction breakdown payloadThe numeric amount summed into the final account_name output.
transaction.totalAmount.currencyCodeAmazon transaction payloadUsed to set the dashboard currency display, usually USD.

QuickBooks Account Definitions

These are the account-level output lines the dashboard currently generates from the Amazon transactions. They are intentionally designed for journal-entry and profitability use, not as a replica of Amazon's native statement sections.

Account nameCategoryFBA flagDefinition
Product sales (non-FBA)IncomeFBMAmazon unified summary income line for non-FBA product sales.
Product sale refunds (non-FBA)Contra RevenueFBMAmazon unified summary income line for refunded non-FBA product sales.
FBA product salesIncomeFBAAmazon unified summary income line for FBA product sales.
FBA product sale refundsContra RevenueFBAAmazon unified summary income line for refunded FBA product sales.
FBA inventory creditIncomeFBAAmazon unified summary income line for FBA inventory credits.
FBA liquidation proceedsIncomeFBAAmazon unified summary income line for liquidation proceeds.
FBA Liquidations proceeds adjustmentsIncomeFBAAmazon unified summary income line for liquidation adjustments.
Shipping creditsIncomeN/AAmazon unified summary income line for shipping credits.
Shipping credit refundsContra RevenueN/AAmazon unified summary income line for shipping credit refunds.
Gift wrap creditsIncomeN/AAmazon unified summary income line for gift wrap credits.
Gift wrap credit refundsContra RevenueN/AAmazon unified summary income line for gift wrap credit refunds.
Promotional rebatesContra RevenueN/AAmazon unified summary income line for promotional rebates.
Promotional rebate refundsContra RevenueN/AAmazon unified summary income line for promotional rebate refunds.
A-to-z Guarantee claimsContra RevenueN/AAmazon unified summary income line for A-to-z Guarantee claims.
ChargebacksContra RevenueN/AAmazon unified summary income line for chargebacks.
Amazon Shipping Reimbursement AdjustmentsIncomeN/AAmazon unified summary income line for shipping reimbursement adjustments.
SAFE-T reimbursementIncomeN/AAmazon unified summary income line for SAFE-T reimbursement.
Seller fulfilled selling feesExpenseFBMAmazon unified summary expense line for seller fulfilled selling fees.
FBA selling feesExpenseFBAAmazon unified summary expense line for FBA selling fees.
Selling fee refundsExpenseN/AAmazon unified summary expense line for selling fee refunds.
FBA transaction feesExpenseFBAAmazon unified summary expense line for FBA transaction fees.
FBA transaction fee refundsExpenseFBAAmazon unified summary expense line for FBA transaction fee refunds.
Other transaction feesExpenseN/AAmazon unified summary expense line for other transaction fees.
Other transaction fee refundsExpenseN/AAmazon unified summary expense line for other transaction fee refunds.
FBA inventory and inbound services feesExpenseFBAAmazon unified summary expense line for FBA inventory and inbound services fees.
Shipping label purchasesExpenseFBMAmazon unified summary expense line for shipping label purchases.
Shipping label refundsExpenseFBMAmazon unified summary expense line for shipping label refunds.
Carrier shipping label adjustmentsExpenseFBMAmazon unified summary expense line for carrier shipping label adjustments.
Service feesExpenseFBAAmazon unified summary expense line for service fees.
Refund administration feesExpenseN/AAmazon unified summary expense line for refund administration fees.
AdjustmentsExpenseN/AAmazon unified summary expense line for adjustments.
Cost of AdvertisingExpenseN/AAmazon unified summary expense line for cost of advertising.
Refund for AdvertiserExpenseN/AAmazon unified summary expense line for refund for advertiser.
Liquidations feesExpenseFBAAmazon unified summary expense line for liquidations fees.
Receivables DeductionsExpenseN/AAmazon unified summary expense line for receivables deductions.
Amazon Shipping Charge AdjustmentsExpenseN/AAmazon unified summary expense line for Amazon shipping charge adjustments.
Product, shipping, gift wrap taxes and regulatory fee collectedTaxN/AAmazon unified summary tax line for collected taxes and regulatory fees.
Product, shipping, gift wrap taxes and regulatory fee refundedTaxN/AAmazon unified summary tax line for refunded taxes and regulatory fees.
Amazon Obligated Tax and Regulatory Fee WithheldTaxN/AAmazon unified summary tax line for obligated tax and regulatory fee withheld.
Transfers to bank accountTransferN/AAmazon unified summary transfer line for bank disbursements.
Failed transfers to bank accountTransferN/AAmazon unified summary transfer line for failed bank transfers.
Disburse to Amazon Gift Card balanceTransferN/AAmazon unified summary transfer line for gift card balance disbursements.
Charges to credit card and other debt recoveryTransferN/AAmazon unified summary transfer line for debt recovery and card charges.
Walmart product sales (WFS)IncomeFBAWalmart settlement gross sales revenue for WFS orders.
Walmart product sales (Seller Fulfilled)IncomeFBMWalmart settlement gross sales revenue for seller-fulfilled orders.
Walmart product sale refunds (WFS)Contra RevenueFBAWalmart settlement refunded retail sales for WFS orders.
Walmart product sale refunds (Seller Fulfilled)Contra RevenueFBMWalmart settlement refunded retail sales for seller-fulfilled orders.
Walmart funded savingsContra RevenueN/AWalmart-funded promotional discounts deducted from gross sales.
Walmart referral fees (WFS)ExpenseFBAWalmart commission on WFS sales and refunds.
Walmart referral fees (Seller Fulfilled)ExpenseFBMWalmart commission on seller-fulfilled sales and refunds.
Walmart WFS fulfillment feesExpenseFBAWalmart WFS per-unit fulfillment fees (adjustment code 5041).
Walmart WFS return processing feesExpenseFBAWalmart WFS return processing fees (adjustment code 5075).
Walmart shipping label chargesExpenseFBMWalmart shipping label service charges for seller-fulfilled orders (5046).
Walmart shipping label refundsExpenseFBMRefunds for unused Walmart shipping labels (adjustment code 5055).
Walmart return shipping chargesExpenseFBMWalmart return shipping charges for seller-fulfilled orders (5013).
Walmart shipping revenueIncomeFBMNet shipping revenue from customers on seller-fulfilled Walmart orders.
Walmart gift wrap revenueIncomeFBMNet gift wrap revenue on Walmart orders.
Walmart WFS storage feesExpenseFBAWalmart WFS storage and other fee charges (adjustment code 5073).
Walmart other fee revenueIncomeN/AWalmart settlement 'Net Fee Revenue' on SALE and REFUNDED rows (miscellaneous fees collected or refunded).
Walmart taxes collectedTaxN/ASales tax collected by Walmart on behalf of seller.
Walmart taxes refundedTaxN/ASales tax refunded on returned Walmart orders.
Walmart net disbursementTransferN/ANet settlement amount disbursed from Walmart to seller bank account.
Shopify product salesIncomeFBMShopify order subtotal revenue from online store orders.
Shopify product sale refundsContra RevenueFBMRefunded Shopify order subtotal amounts.
Shopify shipping incomeIncomeFBMShipping charged to customers on Shopify orders.
Shopify selling feesExpenseN/APlaceholder for Shopify payment processing and app fees until payout data is wired.
Shopify taxes collectedTaxN/ASales tax collected on Shopify orders.
TikTok product salesIncomeFBMTikTok Shop order revenue (best-effort from Open API order payloads).
TikTok product sale refundsContra RevenueFBMTikTok Shop refunded or cancelled order amounts (best-effort).
TikTok shipping incomeIncomeFBMTikTok Shop shipping revenue charged to customers (best-effort).
TikTok selling feesExpenseN/ATikTok Shop platform/commission fees (placeholder until finance endpoints are wired).
TikTok taxes collectedTaxN/ASales tax collected on TikTok Shop orders (best-effort).

Current mapped account lines in code: 72