@checkoutpage/sdk 0.1.12 → 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 +73 -0
- package/dist/index.d.mts +15228 -706
- package/dist/index.d.ts +15228 -706
- package/dist/index.js +770 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +770 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -174,6 +174,79 @@ const previousPage = await checkoutpage.payments.list({
|
|
|
174
174
|
});
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
### Bookings
|
|
178
|
+
|
|
179
|
+
#### List bookings
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
const results = await checkoutpage.bookings.list();
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
#### Filter by status
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
const paidBookings = await checkoutpage.bookings.list({
|
|
189
|
+
status: 'paid',
|
|
190
|
+
limit: 25,
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Filter by page
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
const pageBookings = await checkoutpage.bookings.list({
|
|
198
|
+
pageId: '67fcbdac6a91c25ef2d3534a',
|
|
199
|
+
});
|
|
200
|
+
```
|
|
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
|
+
|
|
177
250
|
## Error Handling
|
|
178
251
|
|
|
179
252
|
The SDK provides typed error classes for different error scenarios:
|