@spree/sdk 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,72 +20,84 @@ import { createSpreeClient } from '@spree/sdk';
20
20
  // Initialize the client
21
21
  const client = createSpreeClient({
22
22
  baseUrl: 'https://api.mystore.com',
23
- apiKey: 'your-publishable-api-key',
23
+ publishableKey: 'spree_pk_xxx', // Store API
24
+ secretKey: 'spree_sk_xxx', // Admin API (optional)
24
25
  });
25
26
 
26
- // Browse products
27
- const products = await client.products.list({
27
+ // Browse products (Store API)
28
+ const products = await client.store.products.list({
28
29
  per_page: 10,
29
30
  includes: 'variants,images',
30
31
  });
31
32
 
32
33
  // Get a single product
33
- const product = await client.products.get('ruby-on-rails-tote');
34
+ const product = await client.store.products.get('ruby-on-rails-tote');
34
35
 
35
36
  // Authentication
36
- const { token, user } = await client.auth.login({
37
+ const { token, user } = await client.store.auth.login({
37
38
  email: 'customer@example.com',
38
39
  password: 'password123',
39
40
  });
40
41
 
41
42
  // Create a cart and add items
42
- const cart = await client.cart.create();
43
- await client.orders.lineItems.create(cart.id, {
43
+ const cart = await client.store.cart.create();
44
+ await client.store.orders.lineItems.create(cart.id, {
44
45
  variant_id: 'var_abc123',
45
46
  quantity: 2,
46
47
  }, { orderToken: cart.token });
47
48
 
48
49
  // Checkout flow
49
- await client.orders.next(cart.id, { orderToken: cart.token });
50
- await client.orders.complete(cart.id, { orderToken: cart.token });
50
+ await client.store.orders.next(cart.id, { orderToken: cart.token });
51
+ await client.store.orders.complete(cart.id, { orderToken: cart.token });
51
52
  ```
52
53
 
54
+ ## Client Architecture
55
+
56
+ The SDK exposes two API namespaces:
57
+
58
+ ```typescript
59
+ client.store // Store API — customer-facing (products, cart, checkout, account)
60
+ client.admin // Admin API — administrative (coming soon)
61
+ ```
62
+
63
+ All Store API endpoints live under `client.store.*`. The Admin API namespace is ready for future endpoints.
64
+
53
65
  ## Authentication
54
66
 
55
67
  The SDK supports multiple authentication modes:
56
68
 
57
- ### 1. API Key Only (Guest/Public Access)
69
+ ### 1. Publishable Key Only (Guest/Public Access)
58
70
 
59
71
  ```typescript
60
72
  const client = createSpreeClient({
61
73
  baseUrl: 'https://api.mystore.com',
62
- apiKey: 'pk_your-publishable-key',
74
+ publishableKey: 'spree_pk_xxx',
63
75
  });
64
76
 
65
77
  // Public endpoints work without user authentication
66
- const products = await client.products.list();
78
+ const products = await client.store.products.list();
67
79
  ```
68
80
 
69
- ### 2. API Key + JWT (Authenticated Customer)
81
+ ### 2. Publishable Key + JWT (Authenticated Customer)
70
82
 
71
83
  ```typescript
72
84
  // Login to get tokens
73
- const { token, user } = await client.auth.login({
85
+ const { token, user } = await client.store.auth.login({
74
86
  email: 'customer@example.com',
75
87
  password: 'password123',
76
88
  });
77
89
 
78
90
  // Use token for authenticated requests
79
- const orders = await client.orders.list({}, { token });
91
+ const orders = await client.store.orders.list({}, { token });
80
92
 
81
93
  // Refresh token when needed
82
- const newTokens = await client.auth.refresh({ token });
94
+ const newTokens = await client.store.auth.refresh({ token });
83
95
  ```
84
96
 
85
97
  ### 3. Register New Customer
86
98
 
87
99
  ```typescript
88
- const { token, user } = await client.auth.register({
100
+ const { token, user } = await client.store.auth.register({
89
101
  email: 'new@example.com',
90
102
  password: 'password123',
91
103
  password_confirmation: 'password123',
@@ -100,24 +112,24 @@ For guest checkout, use the `token` (or `order_token`) returned when creating a
100
112
 
101
113
  ```typescript
102
114
  // Create a cart (guest)
103
- const cart = await client.cart.create();
115
+ const cart = await client.store.cart.create();
104
116
 
105
117
  // Use orderToken for all cart operations
106
118
  const options = { orderToken: cart.token };
107
119
 
108
120
  // Add items
109
- await client.orders.lineItems.create(cart.id, {
121
+ await client.store.orders.lineItems.create(cart.id, {
110
122
  variant_id: 'var_abc123',
111
123
  quantity: 1,
112
124
  }, options);
113
125
 
114
126
  // Update order with email
115
- await client.orders.update(cart.id, {
127
+ await client.store.orders.update(cart.id, {
116
128
  email: 'guest@example.com',
117
129
  }, options);
118
130
 
119
131
  // Complete checkout
120
- await client.orders.complete(cart.id, options);
132
+ await client.store.orders.complete(cart.id, options);
121
133
  ```
122
134
 
123
135
  ## API Reference
@@ -126,14 +138,14 @@ await client.orders.complete(cart.id, options);
126
138
 
127
139
  ```typescript
128
140
  // Get current store information
129
- const store = await client.store.get();
141
+ const store = await client.store.store.get();
130
142
  ```
131
143
 
132
144
  ### Products
133
145
 
134
146
  ```typescript
135
147
  // List products with filtering
136
- const products = await client.products.list({
148
+ const products = await client.store.products.list({
137
149
  page: 1,
138
150
  per_page: 25,
139
151
  'q[name_cont]': 'shirt',
@@ -141,12 +153,12 @@ const products = await client.products.list({
141
153
  });
142
154
 
143
155
  // Get single product by ID or slug
144
- const product = await client.products.get('ruby-on-rails-tote', {
156
+ const product = await client.store.products.get('ruby-on-rails-tote', {
145
157
  includes: 'variants,images',
146
158
  });
147
159
 
148
160
  // Get available filters (price range, availability, options, taxons)
149
- const filters = await client.products.filters({
161
+ const filters = await client.store.products.filters({
150
162
  taxon_id: 'txn_abc123', // Optional: scope filters to a taxon
151
163
  });
152
164
  ```
@@ -155,28 +167,28 @@ const filters = await client.products.filters({
155
167
 
156
168
  ```typescript
157
169
  // List taxonomies
158
- const taxonomies = await client.taxonomies.list({
170
+ const taxonomies = await client.store.taxonomies.list({
159
171
  includes: 'taxons',
160
172
  });
161
173
 
162
174
  // Get taxonomy with taxons
163
- const categories = await client.taxonomies.get('tax_123', {
175
+ const categories = await client.store.taxonomies.get('tax_123', {
164
176
  includes: 'root,taxons',
165
177
  });
166
178
 
167
179
  // List taxons with filtering
168
- const taxons = await client.taxons.list({
180
+ const taxons = await client.store.taxons.list({
169
181
  'q[depth_eq]': 1, // Top-level categories only
170
182
  'q[taxonomy_id_eq]': '123', // Filter by taxonomy
171
183
  });
172
184
 
173
185
  // Get single taxon by ID or permalink
174
- const taxon = await client.taxons.get('categories/clothing', {
186
+ const taxon = await client.store.taxons.get('categories/clothing', {
175
187
  includes: 'ancestors,children', // For breadcrumbs and subcategories
176
188
  });
177
189
 
178
190
  // List products in a category
179
- const categoryProducts = await client.taxons.products.list('categories/clothing', {
191
+ const categoryProducts = await client.store.taxons.products.list('categories/clothing', {
180
192
  page: 1,
181
193
  per_page: 12,
182
194
  includes: 'images,default_variant',
@@ -187,14 +199,14 @@ const categoryProducts = await client.taxons.products.list('categories/clothing'
187
199
 
188
200
  ```typescript
189
201
  // Get current cart
190
- const cart = await client.cart.get({ orderToken: 'xxx' });
202
+ const cart = await client.store.cart.get({ orderToken: 'xxx' });
191
203
 
192
204
  // Create a new cart
193
- const newCart = await client.cart.create();
205
+ const newCart = await client.store.cart.create();
194
206
 
195
207
  // Associate guest cart with authenticated user
196
208
  // (after user logs in, merge their guest cart with their account)
197
- await client.cart.associate({
209
+ await client.store.cart.associate({
198
210
  token: jwtToken, // User's JWT token
199
211
  orderToken: cart.token, // Guest cart token
200
212
  });
@@ -204,19 +216,19 @@ await client.cart.associate({
204
216
 
205
217
  ```typescript
206
218
  // List orders for authenticated customer
207
- const orders = await client.orders.list({}, { token });
219
+ const orders = await client.store.orders.list({}, { token });
208
220
 
209
221
  // Create a new order (cart)
210
- const cart = await client.orders.create();
222
+ const cart = await client.store.orders.create();
211
223
  const options = { orderToken: cart.order_token };
212
224
 
213
225
  // Get order by ID or number
214
- const order = await client.orders.get('R123456789', {
226
+ const order = await client.store.orders.get('R123456789', {
215
227
  includes: 'line_items,shipments',
216
228
  }, options);
217
229
 
218
230
  // Update order (email, addresses)
219
- await client.orders.update(cart.id, {
231
+ await client.store.orders.update(cart.id, {
220
232
  email: 'customer@example.com',
221
233
  ship_address: {
222
234
  firstname: 'John',
@@ -232,9 +244,9 @@ await client.orders.update(cart.id, {
232
244
  }, options);
233
245
 
234
246
  // Checkout flow
235
- await client.orders.next(cart.id, options); // Move to next step
236
- await client.orders.advance(cart.id, options); // Advance through all steps
237
- await client.orders.complete(cart.id, options); // Complete the order
247
+ await client.store.orders.next(cart.id, options); // Move to next step
248
+ await client.store.orders.advance(cart.id, options); // Advance through all steps
249
+ await client.store.orders.complete(cart.id, options); // Complete the order
238
250
  ```
239
251
 
240
252
  ### Line Items
@@ -243,18 +255,18 @@ await client.orders.complete(cart.id, options); // Complete the order
243
255
  const options = { orderToken: cart.token };
244
256
 
245
257
  // Add item
246
- await client.orders.lineItems.create(cart.id, {
258
+ await client.store.orders.lineItems.create(cart.id, {
247
259
  variant_id: 'var_123',
248
260
  quantity: 2,
249
261
  }, options);
250
262
 
251
263
  // Update item quantity
252
- await client.orders.lineItems.update(cart.id, lineItemId, {
264
+ await client.store.orders.lineItems.update(cart.id, lineItemId, {
253
265
  quantity: 3,
254
266
  }, options);
255
267
 
256
268
  // Remove item
257
- await client.orders.lineItems.delete(cart.id, lineItemId, options);
269
+ await client.store.orders.lineItems.delete(cart.id, lineItemId, options);
258
270
  ```
259
271
 
260
272
  ### Coupon Codes
@@ -263,10 +275,10 @@ await client.orders.lineItems.delete(cart.id, lineItemId, options);
263
275
  const options = { orderToken: cart.token };
264
276
 
265
277
  // Apply a coupon code
266
- await client.orders.couponCodes.apply(cart.id, 'SAVE20', options);
278
+ await client.store.orders.couponCodes.apply(cart.id, 'SAVE20', options);
267
279
 
268
280
  // Remove a coupon code
269
- await client.orders.couponCodes.remove(cart.id, 'promo_xxx', options);
281
+ await client.store.orders.couponCodes.remove(cart.id, 'promo_xxx', options);
270
282
  ```
271
283
 
272
284
  ### Store Credits
@@ -275,13 +287,13 @@ await client.orders.couponCodes.remove(cart.id, 'promo_xxx', options);
275
287
  const options = { orderToken: cart.token };
276
288
 
277
289
  // Apply store credit to order (applies maximum available by default)
278
- await client.orders.addStoreCredit(cart.id, undefined, options);
290
+ await client.store.orders.addStoreCredit(cart.id, undefined, options);
279
291
 
280
292
  // Apply specific amount of store credit
281
- await client.orders.addStoreCredit(cart.id, 25.00, options);
293
+ await client.store.orders.addStoreCredit(cart.id, 25.00, options);
282
294
 
283
295
  // Remove store credit from order
284
- await client.orders.removeStoreCredit(cart.id, options);
296
+ await client.store.orders.removeStoreCredit(cart.id, options);
285
297
  ```
286
298
 
287
299
  ### Shipments
@@ -290,10 +302,10 @@ await client.orders.removeStoreCredit(cart.id, options);
290
302
  const options = { orderToken: cart.token };
291
303
 
292
304
  // List shipments for an order
293
- const shipments = await client.orders.shipments.list(cart.id, options);
305
+ const shipments = await client.store.orders.shipments.list(cart.id, options);
294
306
 
295
307
  // Select a shipping rate
296
- await client.orders.shipments.update(cart.id, shipmentId, {
308
+ await client.store.orders.shipments.update(cart.id, shipmentId, {
297
309
  selected_shipping_rate_id: 'rate_xxx',
298
310
  }, options);
299
311
  ```
@@ -304,23 +316,23 @@ await client.orders.shipments.update(cart.id, shipmentId, {
304
316
  const options = { orderToken: cart.token };
305
317
 
306
318
  // Get available payment methods for an order
307
- const methods = await client.orders.paymentMethods.list(cart.id, options);
319
+ const methods = await client.store.orders.paymentMethods.list(cart.id, options);
308
320
 
309
321
  // List payments on an order
310
- const payments = await client.orders.payments.list(cart.id, options);
322
+ const payments = await client.store.orders.payments.list(cart.id, options);
311
323
 
312
324
  // Get a specific payment
313
- const payment = await client.orders.payments.get(cart.id, paymentId, options);
325
+ const payment = await client.store.orders.payments.get(cart.id, paymentId, options);
314
326
  ```
315
327
 
316
328
  ### Geography
317
329
 
318
330
  ```typescript
319
331
  // List countries available for checkout
320
- const { data: countries } = await client.countries.list();
332
+ const { data: countries } = await client.store.countries.list();
321
333
 
322
334
  // Get country by ISO code (includes states)
323
- const usa = await client.countries.get('US');
335
+ const usa = await client.store.countries.get('US');
324
336
  console.log(usa.states); // Array of states
325
337
  ```
326
338
 
@@ -330,10 +342,10 @@ console.log(usa.states); // Array of states
330
342
  const options = { token: jwtToken };
331
343
 
332
344
  // Get profile
333
- const profile = await client.customer.get(options);
345
+ const profile = await client.store.customer.get(options);
334
346
 
335
347
  // Update profile
336
- await client.customer.update({
348
+ await client.store.customer.update({
337
349
  first_name: 'John',
338
350
  last_name: 'Doe',
339
351
  }, options);
@@ -345,13 +357,13 @@ await client.customer.update({
345
357
  const options = { token: jwtToken };
346
358
 
347
359
  // List addresses
348
- const { data: addresses } = await client.customer.addresses.list({}, options);
360
+ const { data: addresses } = await client.store.customer.addresses.list({}, options);
349
361
 
350
362
  // Get address by ID
351
- const address = await client.customer.addresses.get('addr_xxx', options);
363
+ const address = await client.store.customer.addresses.get('addr_xxx', options);
352
364
 
353
365
  // Create address
354
- await client.customer.addresses.create({
366
+ await client.store.customer.addresses.create({
355
367
  firstname: 'John',
356
368
  lastname: 'Doe',
357
369
  address1: '123 Main St',
@@ -362,10 +374,14 @@ await client.customer.addresses.create({
362
374
  }, options);
363
375
 
364
376
  // Update address
365
- await client.customer.addresses.update('addr_xxx', { city: 'Brooklyn' }, options);
377
+ await client.store.customer.addresses.update('addr_xxx', { city: 'Brooklyn' }, options);
366
378
 
367
379
  // Delete address
368
- await client.customer.addresses.delete('addr_xxx', options);
380
+ await client.store.customer.addresses.delete('addr_xxx', options);
381
+
382
+ // Mark as default billing or shipping address
383
+ await client.store.customer.addresses.markAsDefault('addr_xxx', 'billing', options);
384
+ await client.store.customer.addresses.markAsDefault('addr_xxx', 'shipping', options);
369
385
  ```
370
386
 
371
387
  ### Customer Credit Cards
@@ -374,13 +390,13 @@ await client.customer.addresses.delete('addr_xxx', options);
374
390
  const options = { token: jwtToken };
375
391
 
376
392
  // List saved credit cards
377
- const { data: cards } = await client.customer.creditCards.list({}, options);
393
+ const { data: cards } = await client.store.customer.creditCards.list({}, options);
378
394
 
379
395
  // Get credit card by ID
380
- const card = await client.customer.creditCards.get('cc_xxx', options);
396
+ const card = await client.store.customer.creditCards.get('cc_xxx', options);
381
397
 
382
398
  // Delete credit card
383
- await client.customer.creditCards.delete('cc_xxx', options);
399
+ await client.store.customer.creditCards.delete('cc_xxx', options);
384
400
  ```
385
401
 
386
402
  ### Wishlists
@@ -389,26 +405,26 @@ await client.customer.creditCards.delete('cc_xxx', options);
389
405
  const options = { token: jwtToken };
390
406
 
391
407
  // List wishlists
392
- const { data: wishlists } = await client.wishlists.list({}, options);
408
+ const { data: wishlists } = await client.store.wishlists.list({}, options);
393
409
 
394
410
  // Get wishlist by ID
395
- const wishlist = await client.wishlists.get('wl_xxx', {
411
+ const wishlist = await client.store.wishlists.get('wl_xxx', {
396
412
  includes: 'wished_items',
397
413
  }, options);
398
414
 
399
415
  // Create wishlist
400
- const newWishlist = await client.wishlists.create({
416
+ const newWishlist = await client.store.wishlists.create({
401
417
  name: 'Birthday Ideas',
402
418
  is_private: true,
403
419
  }, options);
404
420
 
405
421
  // Update wishlist
406
- await client.wishlists.update('wl_xxx', {
422
+ await client.store.wishlists.update('wl_xxx', {
407
423
  name: 'Updated Name',
408
424
  }, options);
409
425
 
410
426
  // Delete wishlist
411
- await client.wishlists.delete('wl_xxx', options);
427
+ await client.store.wishlists.delete('wl_xxx', options);
412
428
  ```
413
429
 
414
430
  ### Wishlist Items
@@ -417,18 +433,18 @@ await client.wishlists.delete('wl_xxx', options);
417
433
  const options = { token: jwtToken };
418
434
 
419
435
  // Add item to wishlist
420
- await client.wishlists.items.create('wl_xxx', {
436
+ await client.store.wishlists.items.create('wl_xxx', {
421
437
  variant_id: 'var_123',
422
438
  quantity: 1,
423
439
  }, options);
424
440
 
425
441
  // Update item quantity
426
- await client.wishlists.items.update('wl_xxx', 'wi_xxx', {
442
+ await client.store.wishlists.items.update('wl_xxx', 'wi_xxx', {
427
443
  quantity: 2,
428
444
  }, options);
429
445
 
430
446
  // Remove item from wishlist
431
- await client.wishlists.items.delete('wl_xxx', 'wi_xxx', options);
447
+ await client.store.wishlists.items.delete('wl_xxx', 'wi_xxx', options);
432
448
  ```
433
449
 
434
450
  ## Nested Resources
@@ -437,25 +453,26 @@ The SDK uses a resource builder pattern for nested resources:
437
453
 
438
454
  | Parent Resource | Nested Resource | Available Methods |
439
455
  |-----------------|-----------------|-------------------|
440
- | `orders` | `lineItems` | `create`, `update`, `delete` |
441
- | `orders` | `payments` | `list`, `get` |
442
- | `orders` | `paymentMethods` | `list` |
443
- | `orders` | `shipments` | `list`, `update` |
444
- | `orders` | `couponCodes` | `apply`, `remove` |
445
- | `customer` | `addresses` | `list`, `get`, `create`, `update`, `delete` |
446
- | `customer` | `creditCards` | `list`, `get`, `delete` |
447
- | `taxons` | `products` | `list` |
448
- | `wishlists` | `items` | `create`, `update`, `delete` |
456
+ | `store.orders` | `lineItems` | `create`, `update`, `delete` |
457
+ | `store.orders` | `payments` | `list`, `get` |
458
+ | `store.orders` | `paymentMethods` | `list` |
459
+ | `store.orders` | `shipments` | `list`, `update` |
460
+ | `store.orders` | `couponCodes` | `apply`, `remove` |
461
+ | `store.customer` | `addresses` | `list`, `get`, `create`, `update`, `delete`, `markAsDefault` |
462
+ | `store.customer` | `creditCards` | `list`, `get`, `delete` |
463
+ | `store.customer` | `giftCards` | `list`, `get` |
464
+ | `store.taxons` | `products` | `list` |
465
+ | `store.wishlists` | `items` | `create`, `update`, `delete` |
449
466
 
450
467
  Example:
451
468
  ```typescript
452
- // Nested resources follow the pattern: client.parent.nested.method(parentId, ...)
453
- await client.orders.lineItems.create(orderId, params, options);
454
- await client.orders.payments.list(orderId, options);
455
- await client.orders.shipments.update(orderId, shipmentId, params, options);
456
- await client.customer.addresses.list({}, options);
457
- await client.taxons.products.list(taxonId, params, options);
458
- await client.wishlists.items.create(wishlistId, params, options);
469
+ // Nested resources follow the pattern: client.store.parent.nested.method(parentId, ...)
470
+ await client.store.orders.lineItems.create(orderId, params, options);
471
+ await client.store.orders.payments.list(orderId, options);
472
+ await client.store.orders.shipments.update(orderId, shipmentId, params, options);
473
+ await client.store.customer.addresses.list({}, options);
474
+ await client.store.taxons.products.list(taxonId, params, options);
475
+ await client.store.wishlists.items.create(wishlistId, params, options);
459
476
  ```
460
477
 
461
478
  ## Localization & Currency
@@ -464,13 +481,13 @@ Pass locale and currency headers with any request:
464
481
 
465
482
  ```typescript
466
483
  // Set locale and currency per request
467
- const products = await client.products.list({}, {
484
+ const products = await client.store.products.list({}, {
468
485
  locale: 'fr',
469
486
  currency: 'EUR',
470
487
  });
471
488
 
472
489
  // Works with all endpoints
473
- const taxon = await client.taxons.get('categories/clothing', {
490
+ const taxon = await client.store.taxons.get('categories/clothing', {
474
491
  includes: 'ancestors',
475
492
  }, {
476
493
  locale: 'de',
@@ -484,7 +501,7 @@ const taxon = await client.taxons.get('categories/clothing', {
484
501
  import { SpreeError } from '@spree/sdk';
485
502
 
486
503
  try {
487
- await client.products.get('non-existent');
504
+ await client.store.products.get('non-existent');
488
505
  } catch (error) {
489
506
  if (error instanceof SpreeError) {
490
507
  console.log(error.code); // 'record_not_found'
@@ -513,8 +530,8 @@ import type {
513
530
  } from '@spree/sdk';
514
531
 
515
532
  // All responses are fully typed
516
- const products: PaginatedResponse<StoreProduct> = await client.products.list();
517
- const taxon: StoreTaxon = await client.taxons.get('clothing');
533
+ const products: PaginatedResponse<StoreProduct> = await client.store.products.list();
534
+ const taxon: StoreTaxon = await client.store.taxons.get('clothing');
518
535
  ```
519
536
 
520
537
  ## Available Types
@@ -541,6 +558,7 @@ The SDK exports all Store API types:
541
558
  - `StoreShippingRate` - Shipping rate option
542
559
  - `StoreShippingMethod` - Shipping method
543
560
  - `StoreCreditCard` - Saved credit card
561
+ - `StoreGiftCard` - Gift card
544
562
 
545
563
  ### Product Types
546
564
  - `StoreImage` - Product image
@@ -553,6 +571,14 @@ The SDK exports all Store API types:
553
571
  - `StoreWishlist` - Wishlist
554
572
  - `StoreWishedItem` - Wishlist item
555
573
 
574
+ ### Client Types
575
+ - `SpreeClient` - Main client class
576
+ - `StoreClient` - Store API client
577
+ - `AdminClient` - Admin API client
578
+ - `SpreeClientConfig` - Client configuration
579
+ - `RequestOptions` - Per-request options
580
+ - `RetryConfig` - Retry behavior configuration
581
+
556
582
  ### Utility Types
557
583
  - `PaginatedResponse<T>` - Paginated API response
558
584
  - `AuthTokens` - JWT tokens from login
@@ -568,7 +594,7 @@ import { createSpreeClient } from '@spree/sdk';
568
594
 
569
595
  const client = createSpreeClient({
570
596
  baseUrl: 'https://api.mystore.com',
571
- apiKey: 'your-api-key',
597
+ publishableKey: 'spree_pk_xxx',
572
598
  fetch: customFetchImplementation,
573
599
  });
574
600
  ```