eBay API CompleteSale call for multiple items

2019-07-20 06:24发布

Currently I have a system which retrieves a list of orders from eBay (using the GetOrders API call) to do some processing. System will display the list of orders for users to check to update status to Shipped (using CompleteSale API call).

The problem I am having now is that the process of updating the status using the API is kind of slow because the CompleteSale is being called for each order (possible that user check 1000 records to update status to Shipped at one time). Is it possible to send multiple items in one CompleteSale call or is there other API calls that is able to ?

Thanks

标签: php xml ebay-api
1条回答
Fickle 薄情
2楼-- · 2019-07-20 07:13

You simply add several ItemIDs and TransactionIDs to one request like this (for php)

$item_id_1 = 1234567890;
$item_id_2 = 0987654321;
$feedback = 'Thanks for a smooth transaction!';

$transaction_id_1 = 771234567819;
$transaction_id_2 = 770987654319;

$requestXmlBody = '<?xml version="1.0" encoding="utf-8" ?>';
$requestXmlBody .= '<CompleteSaleRequest xmlns="urn:ebay:apis:eBLBaseComponents">';

$requestXmlBody .= "<ItemID>$item_id_1</ItemID>";
$requestXmlBody .= "<ItemID>$item_id_2</ItemID>";

$requestXmlBody .= "<FeedbackInfo>";
$requestXmlBody .= "<CommentText>$feedback_text</CommentText>";
$requestXmlBody .= "<CommentType>Positive</CommentType>";
$requestXmlBody .= "</FeedbackInfo>";

$requestXmlBody .= "<Shipped>true</Shipped>";
$requestXmlBody .= "<TransactionID>$transaction_id_1</TransactionID>";
$requestXmlBody .= "<TransactionID>$transaction_id_2</TransactionID>";

$requestXmlBody .= "<RequesterCredentials><eBayAuthToken>$userToken</eBayAuthToken></RequesterCredentials>";
$requestXmlBody .= '</CompleteSaleRequest>';

I think it should also work if you use orderIDs instead! Please be aware that you cannot use multiple buyerUserIDs (for the recipient). Use only itemID/transactionID pairs.

This is based off the eBay PHP sample code provided here:

https://ebay.custhelp.com/app/answers/detail/a_id/1876/~/getorders-php-code-sample

Just change the call to what you need!

Hope this helps!

查看更多
登录 后发表回答