亚马逊FinanceAPI是亚马逊开放平台提供的一组接口,允许开发者访问和获取亚马逊电商平台的财务数据。这些数据包括订单销售额、成本、利润、库存情况等关键指标,涵盖了从个体产品到整个市场的广泛信息。通过亚马逊FinanceAPI,用户可以实时获取并分析这些数据。
在本文中,我们将展示如何使用Java编程语言调用亚马逊FinanceAPI,获取并解析返回的财务数据。
官方文档:
Finances API referencedeveloper-docs.amazon.com/sp-api/docs/finances-api-reference
FinanceAPI是按事件类型返回费用数据的,和后台结算报告有很大差异。
先来看看常用的事件类型和费用类型
事件类型
类型名 | 中文名称 | FinanceAPI | 描述 |
---|---|---|---|
Adjustment | 调整 | AdjustmentEventList | 亚马逊库存赔偿、亚马逊费用调整及预留金额 |
Chargeback | 拒付 | ChargebackEventList | 买家信用卡拒付 |
ProductAdsPayment | 广告 | ProductAdsPaymentEventList | CPC广告服务,若卖家的广告服务使用卖家账户扣款则在此服务中结算,若选择信用卡支付则不在此服务中结算 |
Shipment | 配送 | ShipmentEventList | 亚马逊订单交易,包含亚马逊的订单收入及订单费用 |
DebtRecovery | 信用卡扣款 | DebtRecoveryEventList | 当用户应收金额不足以支付账单费用,在此类型中执行信用卡扣款业务,此类型不含广告费直接信用扣款 |
SellerReviewEnrollment | 早期评论人计划 | SellerReviewEnrollmentPaymentEventList | 亚马逊早期评论人计划扣款 |
RemovalShipment | 清算调整费用 | RemovalShipmentAdjustmentEventList | 对应summary中Liquidation Adjustment |
ServiceFee | 服务费 | ServiceFeeEventList | 亚马逊店铺或账号维度的服务费,主要包括订阅费、促销费等 |
SellerDealPayment | 秒杀费用 | SellerDealPaymentEventList | 亚马逊Lightning Deal Fee费用 |
Refund | 退款 | RefundEventList | 亚马逊订单退款,包含亚马逊的订单退款及订单退款 |
PayWithAmazon | 亚马逊支付 | PayWithAmazonEventList | 用户使用亚马逊账户绑定第三方平台进行收款,亚马逊会提供收款服务在此服务中扣除手续费 |
CouponPayment | 优惠券手续费 | CouponPaymentEventList | 产生促销订单后扣除优惠券的手续费用,0.06美元(美国)或60日元(日本) |
FBALiquidation | 亚马逊库存清算服务 | FbALiquidationEventList | 移除中类型为清算的订单,费用在此类型中结算 |
Retrocharge | 赔偿撤销 | RetrochargeEventList | 分两种 order撤销和赔偿撤销。属于已经赔偿后重新撤销的金额,目前此事件含税费 |
费用类型
明细费用类型,大部分已经有了
Type | 描述 |
---|---|
Subscription | 订阅 |
Principal | 主要的 |
Tax | 税 |
FBAPerUnitFulfillmentFee | FBA每单位配送费 |
Commission | 委员会 |
MarketplaceFacilitatorVAT-Principal | 市场促进者增值税-本金 |
PromotionDiscount | 促销折扣 |
PromotionDiscountTax | 促销折扣税 |
ShippingCharge | 运费 |
ShippingTax | 运费税 |
ShippingDiscount | 运费折扣 |
ShippingDiscountTax | 运费折扣税 |
baseValue | 基值 |
FBAStorageFee | FBA仓储费 |
MarketplaceFacilitatorTax-Principal | 市场促进者税务负责人 |
ShippingChargeback | 运费退款 |
MarketplaceFacilitatorTax-Shipping | 市场促进者税收运输 |
ReserveCredit | 储备信用 |
CouponRedemptionFee | 优惠券兑换费用 |
FBALongTermStorageFee | FBA长期仓储费 |
FBADisposalFee | FBA处理费 |
WAREHOUSE_LOST | 仓库丢失 |
WAREHOUSE_DAMAGE | 仓库损坏 |
CostOfPointsGranted | 授予积分费用 |
PaymentMethodFee | 付款方式费用 |
CODChargeback | 货到付款退款 |
GiftWrap | 礼品包装 |
GiftWrapTax | 礼品包装税 |
GiftwrapChargeback | 礼品包装退款 |
MarketplaceFacilitatorVAT-Shipping | MarketplaceFacilitator增值税运输 |
REVERSAL_REIMBURSEMENT | 冲销_报销 |
ReserveDebit | 储备借记 |
RefundCommission | 退款佣金 |
CostOfPointsReturned | 返还积分成本 |
PointsAdjusted | 积分调整 |
RestockingFee | 补货费 |
Goodwill | 善意 |
FBARemovalFee | FBA清仓费 |
RecoveryAmount | 回收金额 |
COMPENSATED_CLAWBACK | 补偿_CLAWBACK |
feeAmount | 收费多少 |
FBAInboundTransportationFee | FBA入库运输费 |
INCORRECT_FEES_NON_ITEMIZED | INCORRECT_FEES_NON_ITEMIZED |
NonSubscriptionFeeAdj | 非订阅费用调整 |
MarketplaceFacilitatorTax-Other | 市场促进者税-其他 |
ShippingHB | 航运HB |
FBAInboundDefectFee | FBA入库缺陷费 |
taxValue | 税值 |
BaseTax | 基础税 |
VineFee | 藤费 |
VariableClosingFee | 可变成交费 |
LowValueGoodsTax-Shipping | 低价值货物税收运输 |
LowValueGoodsTax-Principal | 低值商品税-本金 |
MISSING_FROM_INBOUND | MISSING_FROM_INBOUND |
FREE_REPLACEMENT_REFUND_ITEMS | FREE_REPLACMENT_REFUND_ITEMS 商品 |
FailedDisbursement | 付款失败 |
FBATransportationFee | FBA运输费 |
FBACustomerReturnPerUnitFee | FBA客户每单位退货费用 |
WAREHOUSE_LOST_MANUAL | WAREHOUSE_LOST_MANUAL |
FBAOverageFee | FBA超额费 |
MarketplaceFacilitatorTax-RestockingFee | 市场促进者税收补货费 |
FeeAmount | 收费多少 |
Revenue | 收入 |
TaxAmount | 税额 |
TaxWithheld | 预扣税 |
WAREHOUSE_DAMAGE_EXCEPTION | WAREHOUSE_DAMAGE_EXCEPTION |
DisbursementCorrection | 支出更正 |
RevenueAdjustment | 收入调整 |
FixedClosingFee | 固定成交费 |
CommissionCorrection | 委员会更正 |
REMOVAL_ORDER_LOST | REMOVAL_ORDER_LOST |
FBAInboundTransportationProgramFee | FBA入库运输计划费用 |
MISSING_FROM_INBOUND_CLAWBACK | MISSING_FROM_INBOUND_CLAWBACK |
MULTICHANNEL_ORDER_LOST | MULTICHANNEL_ORDER_LOST |
MiscAdjustment | 杂项调整 |
ReturnPostageBilling_Postage | ReturnPostageBilling_Postage |
ReturnPostageBilling_FuelSurcharge | ReturnPostageBilling_FuelSurcharge |
PREPFEE_REFUND | PREPFEE_REFUND |
LabelingFee | 标签费 |
CS_ERROR_ITEMS | CS_ERROR_ITEMS |
MULTICHANNEL_ORDER_DAMAGED | MULTICHANNEL_ORDER_DAMAGED |
TaxAmountAdjustment | 税额调整 |
TaxWithheldAdjustment | 预扣税调整 |
SalesTaxCollectionFee | 销售税征收费 |
RE_EVALUATION | 重新评估 |
LiquidationsBrokerageFee | 清算经纪费 |
CouponRedemptionFeeAdjustment | 优惠券兑换费用调整 |
INCORRECT_FEES_ITEMS | INCORRECT_FEES_ITEMS |
LowValueGoodsTax-Other | 低值商品税-其他 |
BuyerRecharge | 买家充值 |
CSBAFee | CSBA费用 |
FeeAdjustment | 费用调整 |
PostageBilling_Postage | PostageBilling_Postage |
ReturnShipping | 退货运费 |
REMOVAL_ORDER_DAMAGED | REMOVAL_ORDER_DAMAGED |
Other | 其他 |
CRETURN_WRONG_ITEM | CRETURN_WRONG_ITEM |
FBAMultitierPerUnitFee | FBA多层每件费用 |
SalesCommission | 销售佣金 |
TransactionAmount | 交易金额 |
VatAmazonTechnologyFee | 增值税亚马逊技术费 |
VatPartnerFee | 增值税合作伙伴费 |
后台结算(Settlement )报告比较费用类型
API返回的Type 对应结算报告的account description,大部分是吻合的。
FeeType
核对分享
废话不多说上硬菜!!!
核对思路仅供参考:
1.先从第三方ERP(如领星ERP,赛狐ERP)下载大单结算明细数据。
2.通过FinanceAPI下载对应结算单数据。
3.比较总金额是否对得上
4.比较各费用类型记录数和金额是否对得上,核对不上的请自行核对明细数据和代码逻辑是否写错了
5.最后比较总金额是否一致
67w的结算金额对不上
按照以上思路重新调整后,下载一个结算单耗时1小时40多分钟
FinanceAPI Settlement Data
令我困惑的是,结算单总金额是对得上的
FinanceAPI Settlement Data
Refund的总记录数和领星的对不上,但是总金额是对得上,经过一番比较,发现领星会多一些订单ID。
OrderID
然后我拿这部分订单ID去结算报告里找
Finance
领星 lingxing
Settlement
所以我猜是领星配合结算报告closed之后拉下来会补充进去,鉴定完毕。
@Data
public class AmazonSettlementOpen implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long id;
private String groupId;
private String settlementId;
private Date postedDate;
private String amazonOrderId;
private String orderItemId;
private String storeName;
private String countryCode;
private String accountType;
private String fulfillment;
private String eventType;
private String sellerId;
private String sellerSku;
private String type;
private String currencyCode;
private BigDecimal currencyAmount;
private Integer quantity;
private Date createTime;
}
返回的数据结构一览:
添加图片注释,不超过 140 字(可选)
数据呈现
添加图片注释,不超过 140 字(可选)
领星的截图
添加图片注释,不超过 140 字(可选)
Date Range Report(日期范围报告)
日期范围报告(GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA)官方明确通过SP-API创建不了,转而从FinanceAPI获取吧
然,当我从list Financial Event Groups获取open数据的某个orderId比较Date Range的时候,他俩费用是一致的,费用类型有点差异。
FinanceAPI open VS Date Range
多抓了几个订单比较结果:
Date Range
Finance
目前领星,积加,赛狐等ERP厂商的财务模块已经很成熟了,可冲~~~
Amazon
01:29
2023/08/08
Greetings from Amazon,
My name is Amalia, from the Selling Partner API Developer Support team.
I understand you are having an issue with requesting report GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA, but an "invalidInput" error is returned.
I reviewed the information provided and I can confirm the GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA report is not available via SP API API. I reviewed internally these reports and all requests for this particular report are made via Seller Central.
Additionally, I see this report was available in MWS, but was deprecated for SP API in favor of the Finances API.
https://developer-docs.amazon.com/sp-api/docs/finances-api-reference
At the moment, this API is experiencing some issues, but we expect to have it resolved soon. You can review the Selling Partner API Health Dashboard for updates:
https://sellercentral.amazon.com/sp-api-status?mons_redirect=stck_reroute
My apologies for the misunderstanding. I have made a request for the documentation to be updated to remove the GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA report from the roles documentation to avoid future issues. If we were to implement this report in the future, we would be announcing it via our communication channels:
SP-API Release Notes
https://developer-docs.amazon.com/sp-api/docs/sp-api-release-notes
VX:Best-Superman-666