Giter Club home page Giter Club logo

sdk-ebay-rest-negotiation's Introduction

sdk-ebay-rest-negotiation

The Negotiations API gives sellers the ability to proactively send discount offers to buyers who have shown an "interest" in their listings.

By sending buyers discount offers on listings where they have shown an interest, sellers can increase the velocity of their sales.

There are various ways for a buyer to show interest in a listing. For example, if a buyer adds the listing to their Watch list, or if they add the listing to their shopping cart and later abandon the cart, they are deemed to have shown an interest in the listing.

In the offers that sellers send, they can discount their listings by either a percentage off the listing price, or they can set a new discounted price that is lower than the original listing price.

For details about how seller offers work, see <a href="/api-docs/sell/static/marketing/offers-to-buyers.html" title="Selling Integration Guide">Sending offers to buyers.

Created via

docker run --rm -v ${PWD}:/app -w /app openapitools/openapi-generator-cli:v6.6.0 generate -i /app/sell_negotiation_v1_oas3.yaml -g php -o /app --config /app/openapi-config.php.ebay.negotiation.json

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/macropage/sdk-ebay-rest-negotiation.git"
    }
  ],
  "require": {
    "macropage/sdk-ebay-rest-negotiation": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/sdk-ebay-rest-negotiation/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure OAuth2 access token for authorization: api_auth
$config = macropage\SDKs\ebay\rest\negotiation\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new macropage\SDKs\ebay\rest\negotiation\Api\OfferApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$xEBAYCMARKETPLACEID = 'xEBAYCMARKETPLACEID_example'; // string | The eBay marketplace on which you want to search for eligible listings. <br><br>For a complete list of supported marketplaces, see <a href=\"/api-docs/sell/negotiation/overview.html#requirements\" title=\"Negotiation API Overview\">Negotiation API requirements and restrictions</a>.
$limit = 'limit_example'; // string | This query parameter specifies the maximum number of items to return from the result set on a page in the paginated response. <p><b>Minimum:</b> 1 &nbsp; &nbsp;<b>Maximum:</b> 200 <br><b>Default: </b>10</p>
$offset = 'offset_example'; // string | This query parameter specifies the number of results to skip in the result set before returning the first result in the paginated response.  <br><br>Combine <b>offset</b> with the <b>limit</b> query parameter to control the items returned in the response. For example, if you supply an <b>offset</b> of <code>0</code> and a <b>limit</b> of <code>10</code>, the first page of the response contains the first 10 results from the complete list of items retrieved by the call. If <b>offset</b> is <code>10</code> and <b>limit</b> is <code>20</code>, the first page of the response contains items 11-30 from the complete result set. <br><br><b>Default:</b> 0

try {
    $result = $apiInstance->findEligibleItems($xEBAYCMARKETPLACEID, $limit, $offset);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling OfferApi->findEligibleItems: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://api.ebay.com/sell/negotiation/v1

Class Method HTTP request Description
OfferApi findEligibleItems GET /find_eligible_items
OfferApi sendOfferToInterestedBuyers POST /send_offer_to_interested_buyers

Models

Authorization

Authentication schemes defined for the API:

api_auth

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: v1.1.0
    • Package version: 1.9.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

sdk-ebay-rest-negotiation's People

Contributors

michabbb avatar

Watchers

 avatar

sdk-ebay-rest-negotiation's Issues

sendOfferToInterestedBuyers Response is not JSON data error

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();
        }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.