michabbb / sdk-ebay-rest-negotiation Goto Github PK
View Code? Open in Web Editor NEWA PHP SDK for the eBay Negotiation REST API
Home Page: https://developer.ebay.com/api-docs/sell/negotiation/overview.html
A PHP SDK for the eBay Negotiation REST API
Home Page: https://developer.ebay.com/api-docs/sell/negotiation/overview.html
Hi mate , working on it recently , whatever I try this requests wont be successful , Response is not JSON data most commonly
whenever I use $res = $apiInstance->sendOfferToInterestedBuyers($this->ebayId,$offerRequest,$contentType); or $res = $apiInstance->sendOfferToInterestedBuyers($this->ebayId,$jsonString,$contentType); where $jsonString = json_encode($offerRequest);
What I missing , generated json file match ebay requirements perfectly and all required fields are there . Any hint would be much appreciated. Emil
public function send_Ebay_Offers($params){
$contentType = 'Content-type:application/json';
//$offer_duration = ['unit'=>DAY,'value'=>2];
//$offered_price = ['currency'=>'GBP','value'=>$params['offerPrice']];
$offered_price = ['value' => $params['offerPrice']];
foreach ($params['listing_IDs'] as $listingID) {
$offeredItems = [['listingID' => $listingID, 'price' => ['value' => $params['offerPrice']], 'quantity' => 1]];
$offerRequest = new \macropage\SDKs\ebay\rest\negotiation\Model\CreateOffersRequest();
$offerRequest->setAllowCounterOffer($params['allowCounterOffer']);
$offerRequest->setMessage($params['message']);
$offerRequest->setOfferedItems($offeredItems);
// var_dump($offerRequest);die();
//$jsonString = json_encode($offerRequest);
$apiInstance = $this->apiInstance;
try {
$res = $apiInstance->sendOfferToInterestedBuyers($this->ebayId,$offerRequest,$contentType);
print_r($res);
} catch (\macropage\SDKs\ebay\rest\negotiation\ApiException $e) {
// Capture and decode the error response
$errorResponse = $e->getResponseBody(); // Get the raw response body
$errorDetails = json_decode($errorResponse, true); // Decode JSON response to an associative array
echo "EMIL Error: " . $errorDetails['errors'][0]['message'] ?? 'Unknown error';
} catch (\Exception $e) {
// Handle other exceptions (if any)
echo "EMIL Exception: " . $e->getMessage();
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.