Giter VIP home page Giter VIP logo

etsy-php-sdk's Introduction

Etsy PHP SDK

A PHP SDK for the Etsy API v3.

This package is still in development.

Requirements

PHP 7.1 or greater.

Install

Install the package using composer.

composer require rhysnhall/etsy-php-sdk

Include the OAuth client and Etsy class.

use Etsy\Etsy;
use Etsy\OAuth\Client;

Usage

Authorizing your app

The Etsy API uses OAuth 2.0 authentication. You can read more about authenticating with Etsy on their documentation.

The first step in OAuth2 is to request an OAuth token. You will need an existing App API key which you can obtained by registering an app here.

$client = new Etsy\OAuth\Client($api_key);

Generate a URL to redirect the user to authorize access to your app.

$url = $client->getAuthorizationUrl(
  $redirect_uri,
  $scopes,
  $code_challenge,
  $nonce
);
Redirect URI

You must set an authorized callback URL. Check out the Etsy documentation for further information.

Scope

Depending on your apps requirements, you will need to specify the permission scopes you want to authorize access for.

$scopes = ["listings_d", "listings_r", "listings_w", "profile_r"];

You can get all scopes, but it is generally recommended to only get what you need.

$scopes = \Etsy\Utils\PermissionScopes::ALL_SCOPES;
Code challenge

You'll need to generate a PKCE code challenge and save this along with the verifier used to generate the challenge. You are welcome to generate your own, or let the SDK do this for you.

[$verifier, $code_challenge] = $client->generateChallengeCode();
Nonce

The nonce is a single use token used for CSRF protection. You can use any token you like but it is recommended to let the SDK generate one for you each time you authorize a user. Save this for verifying the response later on.

$nonce = $client->createNonce();

The URL will redirect your user to the Etsy authorization page. If the user grants access, Etsy will send back a request with an authorization code and the nonce (state).

https://www.example.com/some/location?
      code=bftcubu-wownsvftz5kowdmxnqtsuoikwqkha7_4na3igu1uy-ztu1bsken68xnw4spzum8larqbry6zsxnea4or9etuicpra5zi
      &state=superstate

It is up to you to validate the nonce. If they do not match you should discard the response.

For more information on Etsy's response, check out the documentation here.

The final step is to get the access token for the user. To do this you will need to make a request using the code that was just returned by Etsy. You will also need to pass in the same callback URL as the first request and the verifier used to generate the PKCE code challenge.

[$access_token, $refresh_token] = $client->requestAccessToken(
  $redirect_uri,
  $code,
  $verifier
);

You'll be provided with both an access token and a refresh token. The access token has a valid duration of 3600 seconds (1 hour). Save both of these for late ruse.

Refreshing your token

You can refresh your authorization token using the refresh token that was previously provided. This will provide you with a new valid access token and another refresh token.

[$access_token, $refresh_token] = $client->refreshAccessToken($refresh_token);

The Etsy documentation states that refreshed access tokens have a duration of 86400 seconds (24 hours) but on testing they appear to only remain valid for up 3600 seconds (1 hour).

Exchanging legacy OAuth 1.0 token for OAuth 2.0 token

If you previously used v2 of the Etsy API and still have valid authorization tokens for your users, you may swap these over for valid OAuth2 tokens.

[$access_token, $refresh_token] = $client->exchangeLegacyToken($legacy_token);

This will provide you with a brand new set of OAuth2 access and refresh tokens.

Basic use

Create a new instance of the Etsy class using your App API key and a user's access token.

$etsy = new Etsy\Etsy($api_key, $access_token);

// Get user.
$user = $etsy->getUser();

// Get shop.
$shop = $user->getShop();

// Update shop.
$shop->update([
  'title' => 'My exciting shop!'
]);
Collections

When there is more than one result a collection will be returned.

$reviews = $shop->getReviews();

// Get first review.
$first = $reviews->first();

// Get 100 results using pagination.
foreach($reviews->paginate(100) as $review) {
  ...
}

Full documentation will be available soon. Email [email protected] for any assistance.

Contributing

Help improve this SDK by contributing.

Before opening a pull request, please first discuss the proposed changes via Github issue or email.

License

This project is licensed under the MIT License - see the LICENSE file for details

etsy-php-sdk's People

Contributors

emergingdzns avatar rhysnhall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

etsy-php-sdk's Issues

class not found issue

Class 'Etsy\Utils\PermissionScopes' not found when call getAuthorizationUrl() function from OAuth/client.php. plaese given me any sugeestion

Receipt.php Indirect modification of overloaded property Etsy\Resources\Receipt::$shipments has no effect

Received this exception whilst adding a shipment to a receipt.

  ErrorException  : Indirect modification of overloaded property Etsy\Resources\Receipt::$shipments has no effect

  at /vendor/rhysnhall/etsy-php-sdk/src/Resources/Receipt.php:37
    33|       "Shipment",
    34|       $data
    35|     );
    36|     // Add the shipment to the associated property.
  > 37|     $this->shipments[] = $shipment;
    38|     return $shipment;
    39|   }
    40|
    41|   /**

  Exception trace:

  1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError()
      /vendor/rhysnhall/etsy-php-sdk/src/Resources/Receipt.php:37

  2   Etsy\Resources\Receipt::createShipment()
      /app/Integrations/Etsy/EtsyClient.php:213

Found fix for issue here: https://stackoverflow.com/questions/10454779/php-indirect-modification-of-overloaded-property

Modifying src/Resource.php line 52 to public function &__get($property) { stopped the error occurring.

How do I Verify oAuth?

Hello,

Here is my code;
`
session_start();

use Etsy\Etsy;

require_once('vendor/autoload.php');

$consumer_key = 'xxxx';
$consumer_secret = 'xxxx';

Etsy::setConfig([
'consumer_key' => $consumer_key,
'consumer_secret' => $consumer_secret,
'scope' => ['listings_r', 'transactions_r', 'listings_w'],
'callback_uri' => 'http://localhost/etsy/callback.php'
]);
$etsy = new Etsy;

if (!isset($_SESSION['temp_credentials'])) {
$temp_credentials = $etsy->getTemporaryCredentials();

$_SESSION['temp_credentials']['identifier'] = $etsy->getTemporaryCredentials()->getIdentifier();
$_SESSION['temp_credentials']['secret'] = $etsy->getTemporaryCredentials()->getSecret();

header('Location: ' . $etsy->getAuthorizationUrl());
die();

}

$temp_credentials = $etsy->createTemporaryCredentials($_SESSION['temp_credentials']['identifier'], $_SESSION['temp_credentials']['secret']);

try {
$token_credentials = $etsy->getTokenCredentials($etsy->getTemporaryCredentials(), $_SESSION['oauth_token'], $_SESSION['oauth_verifier']);
print_r($token_credentials);
} catch (\Exception $e) {
die($e->getMessage());
}
`

And my callback file;
`session_start();

$_SESSION['oauth_token'] = $_GET['oauth_token'];
$_SESSION['oauth_verifier'] = $_GET['oauth_verifier'];

header('Location: index.php');`

But I cannot verify? Where is the problem?

Invalid Token on getInventory()

Hello,

Thank you for this great library.

I am trying to get the Inventory details for a listing

My code is as follows:

$listing_id = '9999';
$api_key = 'xxx';
$access_token = 'yyy';


$etsy = new Etsy($api_key, $access_token);
$test = $etsy->getListing($listing->id); 
//dd($test); //this works when showing the results from getListing

dd($test->getInventory()) //this does not work

when trying to do $test->getInventory() I get the following error. But the token works in the prior $etsy->getListing() request.

Wondering if I am doing something wrong or if the getInventory method is not setting the access token properly.

Thanks.

  Received HTTP status code [401] with error "invalid_token".

  at D:\myfiles\laragon\www\alloy\vendor\rhysnhall\etsy-php-sdk\src\OAuth\Client.php:109
    105▕         $response->error = "{$body->error}";
    106▕         $response->code = $status_code;
    107▕         return $response;
    108▕       }
  ➜ 109▕       throw new RequestException(
    110▕         "Received HTTP status code [$status_code] with error \"{$body->error}\"."
    111▕       );
    112▕     }
    113▕   }

  1   D:\myfiles\laragon\www\alloy\vendor\rhysnhall\etsy-php-sdk\src\Resource.php:185
      Etsy\OAuth\Client::__call("get")

"Resource not found" ShippingUpgrade update and delete

forward-slash (/) missing after /upgrades creating this issue, adding forward-slash form correct URL and working

<?php

namespace Etsy\Resources;

use Etsy\Resource;

/**
 * Shipping Upgrade class.
 *
 * @link https://developers.etsy.com/documentation/reference#operation/createShopShippingProfileUpgrade
 * @author Rhys Hall [email protected]
 */
class ShippingUpgrade extends Resource {

  /**
   * Updates the shipping profile.
   *
   * @link https://developers.etsy.com/documentation/reference#operation/updateShopShippingProfileUpgrade
   * @param array $data
   * @return Etsy\Resources\ShippingUpgrade
   */
  public function update(array $data) {
    return $this->updateRequest(
      "/application/shops/{$this->shop_id}/shipping-profiles/{$this->shipping_profile_id}/upgrades{$this->upgrade_id}",
      $data
    );
  }

  /**
   * Delete the shipping profile.
   *
   * @link https://developers.etsy.com/documentation/reference#operation/deleteShopShippingProfileUpgrade
   * @return boolean
   */
  public function delete() {
    return $this->deleteRequest(
      "/application/shops/{$this->shop_id}/shipping-profiles/{$this->shipping_profile_id}/upgrades{$this->upgrade_id}",
    );
  }
}

Issue with returned values from requestAccessToken

First of all, thanks for putting this together. I primarily wanted it for the Oauth2 functions because that code challenge stuff didn't make any sense to me, and seeing as it took me 2 months just for Etsy to grant me API access, I didn't feel like wasting more time trying to figure out how to just get a damn access token from their friggin API!

Everything worked until the access/refresh token name/values were passed back.
So I had to change this:
return [
'access_token' => $response->access_token,
'refresh_token' => $response->refresh_token
];

to this:
return [
$response->access_token,
$response->refresh_token
];

Otherwise this doesn't work:
[$access_token, $refresh_token] = $client-&gt;requestAccessToken($....

Just returning the values without the names worked as expected.

updateVariationImages 404 error - "Resource Not Found"

I Found an issue while updating variation images using updateVariationImages
After printing the actual response I got a "Resource Not Found" Error and it is due to request method

  /**
   * Updates variation images for the listing. You MUST pass data for ALL variation images, including the ones you are not updating, as this method will override all existing variation images.
   *
   * @link https://developers.etsy.com/documentation/reference#operation/updateVariationImages
   * @param array $data
   * @return Etsy\Collection[Etsy\Resources\ListingVariationImage]
   */
  public function updateVariationImages(array $data) {
    return $this->request(
      "PUT",
      "/application/shops/{$this->shop_id}/listings/{$this->listing_id}/variation-images",
      "ListingVariationImage",
      $data
    );
  }
  
  As Per doc it should be of POST type instead of PUT 
  
  https://developer.etsy.com/documentation/reference/#operation/updateVariationImages
  
    public function updateVariationImages(array $data) {
    return $this->request(
      "POST",
      "/application/shops/{$this->shop_id}/listings/{$this->listing_id}/variation-images",
      "ListingVariationImage",
      $data
    );
  }

Listing->delete() has no effect

Hello!
I've been loving this SDK, it's been a breeze to upgrade my etsy app from the v2 version to v3.

Recently I was testing out listing functionality and wanted to delete a listing.

$listing = $etsy->getListing($listing_id);
$listing->delete();

I know I successfully grabbed the listing and have appropriate scopes, but the listing->delete() call did not work (the listing was still on etsy after the call) and the call did not throw any exceptions. Other functions that I've tested so far like listing->getFiles() works.

Any ideas?

ListingProperty->update() has no effect

This API is awesome, I'm using it to implement all v3 stuff. Everything works so far except updating listing properties.

Since $listing->getListingProperty() is not working yet I'm using $listing->getListingProperties() to return all properties and for one specific I do this:

$prop->update(array(
  "value_ids" => array(743),
  "values" => array('Sewing'),
  "scale_id" => 10 // meters
));

Thats returns the old data and also has no effect on the properties. Any ideas?

how to use PUT method

updateInventory api return error: Received HTTP status code [400] with error "Missing input parameter: [products]".
My data:
$data = array();
$data['products'] = array();
$data['products']['sku'] = 'NAPK-EN87454_SHINYSATIN';
$data['products']['property_values'] = array();
$data['products']['property_values']['property_id'] = 513;
$data['products']['property_values']['value_ids'] = array(1108719665740);
$data['products']['property_values']['values'] = array('Shiny Satin');
$data['products']['offerings'] = array();
$data['products']['offerings']['price'] = 1099;
$data['products']['offerings']['quantity'] = 200;
$data['products']['offerings']['is_enabled'] = true;

Fatal error: Uncaught Error: Class 'Etsy\Resources\*****Resource Using*******' not found in

Probably due to base name basename()

On Windows, both slash (/) and backslash () are used as the directory separator characters. In other environments, it is the forward-slash (/).

/**
   * Performs a request and updates the current resource with the return properties. Will perform a PUT request by default.
   *
   * @param string $url
   * @param array $data
   * @param string $method
   * @return Resource
   */
  protected function updateRequest(string $url, array $data, $method = "PUT") {
    $result = $this->request(
        $method,
        $url,
        basename(get_class($this)),
        $data
      );
    // Update the existing properties.
    $properties = get_object_vars($result)['_properties'];
    foreach($properties as $property => $value) {
      if(isset($this->_properties->{$property})) {
        $this->_properties->{$property} = $value;
      }
    }
    return $this;
  }
  

This function passes the resources name to request function which was actually class name and that was creating issues while updating entities

Here basename return the same class as input provided to it LIKE "Etsy\Resources\ShippingProfile" and same passed as a resource to request function so while creating a resource in createResource function it becomes "Etsy\Resources\Etsy\Resources\ShippingProfile" and create an issue,

Replacing "basename(get_class($this))," with "basename(str_replace("\\", "/", get_class($this)))," solves the problem

getReceipts() throwing 'HTTP status code [403] with error "No user was provided as part of the bearer token.".'

Using an up to date version of your SDK I am wrapping it and ran into that exception:

Etsy\Exception\RequestException 

  Received HTTP status code [403] with error "No user was provided as part of the bearer token.".

  at vendor/rhysnhall/etsy-php-sdk/src/OAuth/Client.php:133
    129▕         $response->error = "{$body->error}";
    130▕         $response->code = $status_code;
    131▕         return $response;
    132▕       }
  ➜ 133▕       throw new RequestException(
    134▕         "Received HTTP status code [$status_code] with error \"{$body->error}\"."
    135▕       );
    136▕     }
    137▕   }

The function I am trying to create looks like this:

    public function getOrders() {
        $etsy = new Etsy($this->api_key, $this->access_token);

        /** @var Shop $shop */
        $shop = $etsy->getShop($this->shop_id);

        //All works I can dd($shop) with results :)


        //This is what is throwing it
        return $shop->getReceipts(['limit'=>10, 'was_paid'=>true]);
    }

Seems to be that 'getReceipts' call.

Thank you for this SDK so far I like where it is heading, just a small snag for now maybe I am doing something wrong?

'getShop()' works correctly and returns valid correct JSON so I think it is just that other call.

Fatal error: Uncaught Error: Class 'Etsy\Etsy\OAuth\Client' not found

Hi there,

for some reason, my script fails at
$client = new Etsy\OAuth\Client($api_key);

with the following error:
Fatal error: Uncaught Error: Class 'Etsy\Etsy\OAuth\Client' not found

what could be the problem? I am using the code from the readme file.
The Errors states "Etsy\Etsy", which might be the cause, but how do I change that?

I added the following, because I thought it might be missing, but that didn't help:
require_once DIR . '/vendor/autoload.php';

Anyone got a clue what I might be doing wrong?
Thanks in advance!

Minor documentation update

Hi, first, thanks for setting this up! I'm just starting to use it and I'm sure it will save me (and everyone else) a ton of time!

In a quick test to get started, using the code in the Usage section, I was getting fatal errors:

use Etsy\Etsy;
use Etsy\OAuth\Client;
$client = new Etsy\OAuth\Client( "asdf" );

PHP Fatal error: Uncaught Error: Class 'Etsy\Etsy\OAuth\Client' not found in /......./path/...../test.php:4

I had to change it to this:

require_once( __DIR__ . '/vendor/autoload.php' );
use Etsy\Etsy;
use Etsy\OAuth\Client;
$client = new \Etsy\OAuth\Client( "asdf" );

Autoload was needed, and it seems that the first use statement was causing Etsy to become Etsy\Etsy which made the path come up wrong, so adding the slash fixed it.

Undefined property: stdClass::$error_description

`/**
   * Handles OAuth errors.
   *
   * @param Exception $e
   * @return void
   * @throws Etsy\Exception\OAuthException
   */
  private function handleAcessTokenError(\Exception $e) {
    $response = $e->getResponse();
    $body = json_decode($response->getBody(), false);
    $status_code = $response->getStatusCode();
    throw new OAuthException(
      "Received HTTP status code [$status_code] with error \"{$body->error}\" and message \"{$body->error_description}\" when requesting access token."
    );
  }`

Here when i print body i got below response
object(stdClass)#164 (1) { ["error"]=> string(37) "Missing x-api-key header or client_id" }

So we need to update that function and first check if error_description is set or not

`/**
  * Handles OAuth errors.
  *
  * @param Exception $e
  * @return void
  * @throws Etsy\Exception\OAuthException
  */
 private function handleAcessTokenError(\Exception $e) {
   $response = $e->getResponse();
   $body = json_decode($response->getBody(), false);
   $status_code = $response->getStatusCode();
   if (isset($body->error_description)) {
        throw new OAuthException(
            "Received HTTP status code [$status_code] with error \"{$body->error}\" and message \"{$body->error_description}\"   when requesting access token."
   );
   } else  {
         throw new OAuthException(
              "Received HTTP status code [$status_code] with error \"{$body->error}\" when requesting access token."
         );
  }
   
 }`

How to send shipping back to Etsy?

Hi #rhysnhall
Can you show me how to update the shipping on the Receipt?

I get Receipts
`
$etsy = new Etsy\Etsy($api_key, $oauthtoken);

$etsy->getShopReceipts(...)
`

composer error

I am on Ubuntu 20.04.6 LTS
I am running Apache2 and php 8.2

composer require rhysnhall/etsy-php-sdk
PHP Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Console/Helper/HelperSet.php on line 104

Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Console/Helper/HelperSet.php on line 104
Deprecation Notice: Optional parameter $schema declared before required parameter $path is implicitly treated as a required parameter in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php:62
Deprecation Notice: Optional parameter $schema declared before required parameter $path is implicitly treated as a required parameter in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php:108
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/share/php/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:206
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:206
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:206
Deprecation Notice: Return type of Symfony\Component\Process\Process::getIterator($flags = 0) should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Process/Process.php:606
Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:130
Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:130
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Deprecation Notice: Return type of Composer\Repository\CompositeRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/CompositeRepository.php:139
Deprecation Notice: Return type of Composer\DependencyResolver\Pool::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Pool.php:166
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/

Using version ^0.4.0 for rhysnhall/etsy-php-sdk
./composer.json has been updated
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/share/php/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:130
Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:130
Deprecation Notice: Return type of Symfony\Component\Finder\Finder::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Finder.php:620
Deprecation Notice: Return type of Symfony\Component\Finder\Finder::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Finder.php:691
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\FileTypeFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php:42
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::getChildren() should either be compatible with RecursiveDirectoryIterator::getChildren(): RecursiveDirectoryIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php:81
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::rewind() should either be compatible with FilesystemIterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php:109
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::current() should either be compatible with FilesystemIterator::current(): SplFileInfo|FilesystemIterator|string, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php:61
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php:55
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::hasChildren() should either be compatible with RecursiveIterator::hasChildren(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php:71
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::getChildren() should either be compatible with RecursiveIterator::getChildren(): ?RecursiveIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php:76
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\DateRangeFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php:41
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\PathFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Symfony/Component/Finder/Iterator/PathFilterIterator.php:27
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/Repository/ArrayRepository.php:206
Loading composer repositories with package information
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Updating dependencies (including require-dev)
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSet.php:114
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSet.php:99
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:155
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:165
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:160
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:170
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:150
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/Decisions.php:145
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:36
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:46
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:41
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:89
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Composer/DependencyResolver/RuleSetIterator.php:70
PHP Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php:84
Stack trace:
#0 [internal function]: array_merge()
#1 /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array()
#2 /usr/share/php/Composer/DependencyResolver/Solver.php(387): Composer\DependencyResolver\DefaultPolicy->selectPreferredPackages()
#3 /usr/share/php/Composer/DependencyResolver/Solver.php(816): Composer\DependencyResolver\Solver->selectAndInstall()
#4 /usr/share/php/Composer/DependencyResolver/Solver.php(231): Composer\DependencyResolver\Solver->runSat()
#5 /usr/share/php/Composer/Installer.php(489): Composer\DependencyResolver\Solver->solve()
#6 /usr/share/php/Composer/Installer.php(232): Composer\Installer->doInstall()
#7 /usr/share/php/Composer/Command/RequireCommand.php(248): Composer\Installer->run()
#8 /usr/share/php/Composer/Command/RequireCommand.php(205): Composer\Command\RequireCommand->doUpdate()
#9 /usr/share/php/Symfony/Component/Console/Command/Command.php(255): Composer\Command\RequireCommand->execute()
#10 /usr/share/php/Symfony/Component/Console/Application.php(934): Symfony\Component\Console\Command\Command->run()
#11 /usr/share/php/Symfony/Component/Console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#12 /usr/share/php/Composer/Console/Application.php(281): Symfony\Component\Console\Application->doRun()
#13 /usr/share/php/Symfony/Component/Console/Application.php(149): Composer\Console\Application->doRun()
#14 /usr/share/php/Composer/Console/Application.php(113): Symfony\Component\Console\Application->run()
#15 /usr/bin/composer(62): Composer\Console\Application->run()
#16 {main}
thrown in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php on line 84

Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php:84
Stack trace:
#0 [internal function]: array_merge()
#1 /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array()
#2 /usr/share/php/Composer/DependencyResolver/Solver.php(387): Composer\DependencyResolver\DefaultPolicy->selectPreferredPackages()
#3 /usr/share/php/Composer/DependencyResolver/Solver.php(816): Composer\DependencyResolver\Solver->selectAndInstall()
#4 /usr/share/php/Composer/DependencyResolver/Solver.php(231): Composer\DependencyResolver\Solver->runSat()
#5 /usr/share/php/Composer/Installer.php(489): Composer\DependencyResolver\Solver->solve()
#6 /usr/share/php/Composer/Installer.php(232): Composer\Installer->doInstall()
#7 /usr/share/php/Composer/Command/RequireCommand.php(248): Composer\Installer->run()
#8 /usr/share/php/Composer/Command/RequireCommand.php(205): Composer\Command\RequireCommand->doUpdate()
#9 /usr/share/php/Symfony/Component/Console/Command/Command.php(255): Composer\Command\RequireCommand->execute()
#10 /usr/share/php/Symfony/Component/Console/Application.php(934): Symfony\Component\Console\Command\Command->run()
#11 /usr/share/php/Symfony/Component/Console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#12 /usr/share/php/Composer/Console/Application.php(281): Symfony\Component\Console\Application->doRun()
#13 /usr/share/php/Symfony/Component/Console/Application.php(149): Composer\Console\Application->doRun()
#14 /usr/share/php/Composer/Console/Application.php(113): Symfony\Component\Console\Application->run()
#15 /usr/bin/composer(62): Composer\Console\Application->run()
#16 {main}
thrown in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php on line 84

Insufficient scope for getUser()

I have authorized my app and I can get access tokens. Refreshing is also working.

As soon as I do $etsy->getUser() I get an "insufficient_scope" error, and I cannot do a $user->getShop() as written in the readme.

Using Postman with the bearer token and the x-api-key header parameter I get the same "insufficient_scope" error if I try https://api.etsy.com/v3/application/users/xxxxxxxxx with xxxxxxxx = user_id or https://api.etsy.com/v3/application/users/me .

I can although do https://api.etsy.com/v3/application/users/xxxxxxxxx/shops in Postman and see the shop_id.

I can than do a https://api.etsy.com/v3/application/shops/yyyyyyyy with yyyyyyyy = the shop_id what is basically
what $user->getShop() is doing?

Is there a problem with my old API account which I already used for API v2?

In the end I want to create and update listings to sync my Etsy shop with my normal online shop.

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.