You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-13Lines changed: 27 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,10 @@ use Walmart\Configuration;
84
84
85
85
$clientId = '<YOURCLIENTID>';
86
86
$clientSecret = '<YOURCLIENTSECRET>';
87
-
$config = new Walmart\Configuration($clientId, $clientSecret);
87
+
$config = new Configuration([
88
+
'clientId' => $clientId,
89
+
'clientSecret' => $clientSecret,
90
+
]);
88
91
```
89
92
90
93
If you are a Marketplace Seller selling in the US (which is likely true of most people using this API), that's all the configuration you need to do to start making calls to the Marketplace API. If you want to call the Drop Ship Vendor, Content Provider, or Warehouse Supplier APIs, or if you sell goods outside the US and need to make calls to the Marketplace API for, you'll need to provide additional configuration parameters, which are detailed in the [Configuration](#configuration) section below.
@@ -97,7 +100,10 @@ Once you've created an instance of the `Configuration` class, you can start maki
97
100
use Walmart\Configuration;
98
101
use Walmart\Walmart;
99
102
100
-
$config = new Walmart\Configuration($clientId, $clientSecret);
103
+
$config = new Configuration([
104
+
'clientId' => $clientId,
105
+
'clientSecret' => $clientSecret,
106
+
]);
101
107
$authApi = Walmart::marketplace($config)->auth();
102
108
103
109
// $authApi is an instance of Walmart\Apis\MP\US\AuthenticationApi
@@ -113,14 +119,13 @@ Similarly, the other API categories can be accessed via the `Walmart::dropShipVe
113
119
114
120
### Configuration
115
121
116
-
The `Configuration` class is used to configure the client library. It takes three arguments:
117
-
-`$clientId`: Your Walmart Client ID
118
-
-`$clientSecret`: Your Walmart Client Secret
119
-
-`$options`: An optional associative array of additional configuration parameters. Valid options are:
120
-
-`country`: The country you are selling in. One of `Country::US`, `Country::CA`, or `Country::MX`. Defaults to `US`.
121
-
-`consumerId`: Your Walmart Consumer ID. Required if you are making requests to endpoints that use signature-based auth (see the [Authorization](#authorization) section)
122
-
-`privateKey`: Your Walmart private key. Ditto the requirements for the `consumerId` option.
123
-
-`accessToken`: An instance of `Walmart\AccessToken`, containing an access token and its expiration time. If provided, this will be used instead of the client ID and secret to authenticate API calls, until the token expires. This is useful if you want to reuse an access token that you've already retrieved from Walmart. More details on access token auth [below](#access-token-auth).
122
+
The `Configuration` class is used to configure the client library. It takes a single options array as its only argument, which can contain the following keys:
123
+
-`clientId`: Your Walmart Client ID
124
+
-`clientSecret`: Your Walmart Client Secret
125
+
-`country`: The country you are selling in. One of `Country::US`, `Country::CA`, or `Country::MX`. Defaults to `Country::US`.
126
+
-`consumerId`: Your Walmart Consumer ID. Required if you are making requests to endpoints that use signature-based auth (see the [Authorization](#authorization) section)
127
+
-`privateKey`: Your Walmart private key. Ditto the requirements for the `consumerId` option.
128
+
-`accessToken`: An instance of `Walmart\AccessToken`, containing an access token and its expiration time. If provided, this will be used instead of the client ID and secret to authenticate API calls, until the token expires. This is useful if you want to reuse an access token that you've already retrieved from Walmart. More details on access token auth [below](#access-token-auth).
124
129
125
130
If you try to instantiate an instance of an API class that is not supported in the country you've specified, an exception will be thrown.
126
131
@@ -139,7 +144,10 @@ Some endpoints have a LOT of parameters. If you're using PHP 8 or later, you can
139
144
use Walmart\Configuration;
140
145
use Walmart\Walmart;
141
146
142
-
$config = new Configuration($clientId, $clientSecret);
0 commit comments