@checkoutpage/sdk 0.1.14 → 0.1.21
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 +48 -0
- package/dist/index.d.mts +15240 -731
- package/dist/index.d.ts +15240 -731
- package/dist/index.js +749 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +749 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -199,6 +199,54 @@ const pageBookings = await checkoutpage.bookings.list({
|
|
|
199
199
|
});
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
+
### Products
|
|
203
|
+
|
|
204
|
+
#### Get a product
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
const product = await checkoutpage.products.get('product_id');
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
#### Update a product
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
const updated = await checkoutpage.products.update('product_id', {
|
|
214
|
+
title: 'Updated Product Title',
|
|
215
|
+
description: 'Updated description',
|
|
216
|
+
price: 5900, // $59.00 in cents
|
|
217
|
+
stock: 100,
|
|
218
|
+
hasUnlimitedStock: false,
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Files
|
|
223
|
+
|
|
224
|
+
#### Upload an image
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
const imageFile = new File([blob], 'product-image.jpg', { type: 'image/jpeg' });
|
|
228
|
+
|
|
229
|
+
const result = await checkoutpage.files.upload({
|
|
230
|
+
file: imageFile,
|
|
231
|
+
purpose: 'image',
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
console.log('Image uploaded:', result.data.id, result.data.location);
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
#### Upload a file
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
const pdfFile = new File([blob], 'ebook.pdf', { type: 'application/pdf' });
|
|
241
|
+
|
|
242
|
+
const result = await checkoutpage.files.upload({
|
|
243
|
+
file: pdfFile,
|
|
244
|
+
purpose: 'file',
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
console.log('File uploaded:', result.data.id);
|
|
248
|
+
```
|
|
249
|
+
|
|
202
250
|
## Error Handling
|
|
203
251
|
|
|
204
252
|
The SDK provides typed error classes for different error scenarios:
|