inventos/amazon-mws
Composer 安装命令:
composer require inventos/amazon-mws
包简介
Library to interface with Amazon MWS
README 文档
README
Interaction with the Amazon Api for vendors called MWS
Installation:
$ composer require inventos/amazon-mws
Initiate the client
require_once 'vendor/autoload.php'; $client = new MCS\MWSClient([ 'Marketplace_Id' => '', 'Seller_Id' => '', 'Access_Key_ID' => '', 'Secret_Access_Key' => '', 'MWSAuthToken' => '' // Optional. Only use this key if you are a third party user/developer ]); // Optionally check if the supplied credentials are valid if ($client->validateCredentials()) { // Credentials are valid } else { // Credentials are not valid }
Get orders
$fromDate = new DateTime('2016-01-01'); $orders = $client->ListOrders($fromDate); foreach ($orders as $order) { $items = $client->ListOrderItems($order['AmazonOrderId']); print_r($order); print_r($items['ListOrderItems']); }
Update order delivery status
$client->SetDeliveryStatus([ $AmazonOrderId => [ "carrierCode" => "UPS", "carrierName" => "Carrier Name", "trackingCode" => "34JD943T6", // optional "shippingMethod" => "1 Day", // required ] ]);
One of the two between "carrierCode" or "carrierName" is required, as well as "shippingMethod".
Update order status
$client->OrderAcknowledgement([ $AmazonOrderId => [ "statusCode" => "Unshipped|PartiallyShipped|Shipped" // required ]);
Get product attributes
$searchField = 'ASIN'; // Can be GCID, SellerSKU, UPC, EAN, ISBN, or JAN $result = $client->GetMatchingProductForId([ '<ASIN1>', '<ASIN2>', '<ASIN3>' ], $searchField); print_r($result);
Create or update a product
$product = new MCS\MWSProduct(); $product->sku = 'TESTNOTFORSALE'; $product->price = '1000.00'; $product->product_id = 'B0031S9***'; $product->product_id_type = 'ASIN'; $product->condition_type = 'New'; $product->quantity = 10; if ($product->validate()) { // You can also submit an array of MWSProduct objects $result = $client->PostProduct($product); } else { $errors = $product->getValidationErrors(); }
Update product stock
$result = $client->UpdateStock([ 'sku1' => 20, 'sku2' => 9, ]); print_r($result); $info = $client->GetFeedSubmissionResult($result['FeedSubmissionId']); print_r($info);
Update product stock with fulfillment latency specified
$result = $client->UpdateStockWithFulfillmentLatency([ ['sku' => 'sku1', 'quantity' => 20, 'latency' => 1], ['sku' => 'sku2', 'quantity' => 20, 'latency' => 1], ]); print_r($result); $info = $client->GetFeedSubmissionResult($result['FeedSubmissionId']); print_r($info);
Update product pricing
$result = $client->UpdatePrice([ 'sku1' => '20.99', 'sku2' => '100.00', ]); print_r($result); $info = $client->GetFeedSubmissionResult($result['FeedSubmissionId']); print_r($info);
Reports
For all report types, visit: http://docs.developer.amazonservices.com
$reportId = $client->RequestReport('_GET_MERCHANT_LISTINGS_DATA_'); // Wait a couple of minutes and get it's content $report_content = $client->GetReport($reportId); print_r($report_content);
Available methods
View source for detailed argument description. All methods starting with an uppercase character are also documented in the Amazon MWS documentation
// Returns the current competitive price of a product, based on ASIN. $client->GetCompetitivePricingForASIN($asin_array = []); // Returns the feed processing report and the Content-MD5 header. $client->GetFeedSubmissionResult($FeedSubmissionId); // Returns pricing information for the lowest-price active offer listings for up to 20 products, based on ASIN. $client->GetLowestOfferListingsForASIN($asin_array = [], $ItemCondition = null); // Returns lowest priced offers for a single product, based on ASIN. $client->GetLowestPricedOffersForASIN($asin, $ItemCondition = 'New'); // Returns a list of products and their attributes, based on a list of ASIN, GCID, SellerSKU, UPC, EAN, ISBN, and JAN values. $client->GetMatchingProductForId($asin_array, $type = 'ASIN'); // Returns a list of products and their attributes, based on an open text based query $client->ListMatchingProducts($query, $query_context_id = null); // Returns pricing information for your own offer listings, based on ASIN. $client->GetMyPriceForASIN($asin_array = [], $ItemCondition = null); // Returns pricing information for your own offer listings, based on SKU. $client->GetMyPriceForSKU($sku_array = [], $ItemCondition = null); // Returns an order based on the AmazonOrderId values that you specify. $client->GetOrder($AmazonOrderId); // Update the information about shipping of an order. $client->SetDeliveryStatus(array $data); // Update the information about status of an order. $client->OrderAcknowledgement(array $data); // Get eligible shipping services $client->GetEligibleShippingServices($shipmentRequestDetails = []); // create shipment $client->CreateShipment($shipmentRequestDetails = []); // Returns the parent product categories that a product belongs to, based on ASIN. $client->GetProductCategoriesForASIN($ASIN); // Returns the parent product categories that a product belongs to, based on SellerSKU. $client->GetProductCategoriesForSKU($SellerSKU); // Delete product(s) based on SKU $client->DeleteProductBySKU(array $SKU); // Get a report's content $client->GetReport($ReportId); // Returns a list of reports that were created in the previous 90 days. $client->GetReportList($ReportTypeList = []); // Returns a list of order report requests that are scheduled to be submitted to Amazon MWS for processing. $client->GetReportScheduleList($ReportTypeList = []); // Get a report's processing status $client->GetReportRequestStatus($ReportId); // Get a list's inventory for Amazon's fulfillment $client->ListInventorySupply($sku_array = []); // Returns a list of marketplaces that the seller submitting the request can sell in, and a list of participations that include seller-specific information in that marketplace $client->ListMarketplaceParticipations(); // Returns orders created or updated during a time frame that you specify. $client->ListOrders($from, $allMarketplaces = false, $states = ['Unshipped', 'PartiallyShipped'], $FulfillmentChannel = 'MFN', $tillDate = null, $fromUpdated = false); // Returns orders created or updated during a time frame that you specify, surfing along all the next tokens. $client->ListOrdersWithAllNextTokens($from, $allMarketplaces = false, $states = ['Unshipped', 'PartiallyShipped'], $FulfillmentChannel = 'MFN', $tillDate = null, $fromUpdated = false); // Returns orders created or updated, by the next token. $client->ListOrdersByNextToken($nextToken); // Returns order items based on the AmazonOrderId that you specify. $client->ListOrderItems($AmazonOrderId); // Returns order items based on the AmazonOrderId that you specify, surfing along all the next tokens. $client->ListOrderItemsWithAllNextTokens($AmazonOrderId); // Returns order items, by the next token. $client->ListOrderItemsByNextToken($NextToken); // Returns your active recommendations for a specific category or for all categories for a specific marketplace. $client->ListRecommendations($RecommendationCategory = null); // Creates a report request and submits the request to Amazon MWS. $client->RequestReport($report, $StartDate = null, $EndDate = null); // Uploads a feed for processing by Amazon MWS. $client->SubmitFeed($FeedType, $feedContent, $debug = false); // Returns a list of all feed submissions submitted in the previous 90 days. $client->GetFeedSubmissionList(); // Call this method to get the raw feed instead of sending it $client->debugNextFeed(); // Post to create or update a product (_POST_FLAT_FILE_LISTINGS_DATA_) $client->PostProduct($MWSProduct); // Update a product's price $client->UpdatePrice($array); // Update a product(s) stock quantity $client->UpdateStock($array); // A method to quickly check if the supplied credentials are valid $client->validateCredentials(); // List of Financial Events $client->ListFinancialEvents($fromDate); // List of Financial Events, surfing along all the next tokens. $client->ListFinancialEventsWithAllNextTokens($fromDate); // List of Financial Events by Next token $client->ListFinancialEventsByNextToken($token);
inventos/amazon-mws 适用场景与选型建议
inventos/amazon-mws 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.04k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 03 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「amazon」 「mws」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 inventos/amazon-mws 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 inventos/amazon-mws 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 inventos/amazon-mws 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
Use Amazon's MWS web services with Laravel 5.x. Based on creacoon/amazon-mws-laravel package and modified to make it compatible with latest Laravel releases (+ bugfixes).
A simple Laravel 5/6/7/8 service provider for including the AWS SDK for PHP.
NinjaImg PHP SDK.
marketplaces-data-export is a library for generic data export from marketplaces
统计信息
- 总下载量: 1.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-28