@waffo/pancake-ts 0.3.0 → 0.3.1
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/CHANGELOG.md +10 -4
- package/dist/index.cjs +23 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -9
- package/dist/index.d.ts +23 -9
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/docs/api-reference.md +33 -6
- package/package.json +1 -1
package/docs/api-reference.md
CHANGED
|
@@ -5,7 +5,7 @@ Complete reference for all `@waffo/pancake-ts` resources, parameters, and return
|
|
|
5
5
|
> **Conventions**:
|
|
6
6
|
> - All amounts are in the **smallest currency unit** (e.g. 999 = $9.99 USD, 4500 = ¥4500 JPY)
|
|
7
7
|
> - All timestamps are **ISO 8601 UTC** strings
|
|
8
|
-
> - Product updates follow **immutable versioning** — each update creates a new version, skipped if content is unchanged
|
|
8
|
+
> - Product updates follow **immutable versioning** — only provided fields are updated (omitted fields are preserved), each update creates a new version, skipped if content is unchanged
|
|
9
9
|
> - The **publish** flow promotes a test version to production
|
|
10
10
|
|
|
11
11
|
---
|
|
@@ -278,10 +278,18 @@ const { product } = await client.onetimeProducts.create({
|
|
|
278
278
|
|
|
279
279
|
Update a one-time product. Creates a new immutable version; skips if content is unchanged.
|
|
280
280
|
|
|
281
|
+
> Only `id` is required. Omitted fields keep their current values.
|
|
282
|
+
|
|
281
283
|
```typescript
|
|
284
|
+
// Update only the name
|
|
282
285
|
const { product } = await client.onetimeProducts.update({
|
|
283
286
|
id: "PROD_xxx",
|
|
284
287
|
name: "E-Book: TypeScript Handbook v2",
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
// Update only the prices
|
|
291
|
+
const { product: p2 } = await client.onetimeProducts.update({
|
|
292
|
+
id: "PROD_xxx",
|
|
285
293
|
prices: { USD: { amount: "39.00", taxCategory: "digital_goods" } },
|
|
286
294
|
});
|
|
287
295
|
```
|
|
@@ -291,8 +299,8 @@ const { product } = await client.onetimeProducts.update({
|
|
|
291
299
|
| Field | Type | Required | Description |
|
|
292
300
|
|-------|------|----------|-------------|
|
|
293
301
|
| `id` | `string` | Yes | Product ID |
|
|
294
|
-
| `name` | `string` |
|
|
295
|
-
| `prices` | `Prices` |
|
|
302
|
+
| `name` | `string` | No | Product name |
|
|
303
|
+
| `prices` | `Prices` | No | Multi-currency prices |
|
|
296
304
|
| `description` | `string` | No | Product description |
|
|
297
305
|
| `media` | `MediaItem[]` | No | Media assets |
|
|
298
306
|
| `successUrl` | `string` | No | Redirect URL after successful payment |
|
|
@@ -377,16 +385,35 @@ const { product } = await client.subscriptionProducts.create({
|
|
|
377
385
|
|
|
378
386
|
Update a subscription product. Creates a new immutable version; skips if unchanged.
|
|
379
387
|
|
|
388
|
+
> Only `id` is required. Omitted fields keep their current values.
|
|
389
|
+
|
|
380
390
|
```typescript
|
|
391
|
+
// Update only the name
|
|
381
392
|
const { product } = await client.subscriptionProducts.update({
|
|
382
393
|
id: "PROD_xxx",
|
|
383
394
|
name: "Pro Plan v2",
|
|
384
|
-
|
|
385
|
-
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
// Update billing period and prices
|
|
398
|
+
const { product: p2 } = await client.subscriptionProducts.update({
|
|
399
|
+
id: "PROD_xxx",
|
|
400
|
+
billingPeriod: BillingPeriod.Yearly,
|
|
401
|
+
prices: { USD: { amount: "99.00", taxCategory: "saas" } },
|
|
386
402
|
});
|
|
387
403
|
```
|
|
388
404
|
|
|
389
|
-
**Parameters `UpdateSubscriptionProductParams`**:
|
|
405
|
+
**Parameters `UpdateSubscriptionProductParams`**:
|
|
406
|
+
|
|
407
|
+
| Field | Type | Required | Description |
|
|
408
|
+
|-------|------|----------|-------------|
|
|
409
|
+
| `id` | `string` | Yes | Product ID |
|
|
410
|
+
| `name` | `string` | No | Product name |
|
|
411
|
+
| `billingPeriod` | `BillingPeriod` | No | Billing period |
|
|
412
|
+
| `prices` | `Prices` | No | Multi-currency prices |
|
|
413
|
+
| `description` | `string` | No | Product description |
|
|
414
|
+
| `media` | `MediaItem[]` | No | Media assets |
|
|
415
|
+
| `successUrl` | `string` | No | Redirect URL after successful payment |
|
|
416
|
+
| `metadata` | `Record<string, unknown>` | No | Custom metadata |
|
|
390
417
|
|
|
391
418
|
**Returns `{ product: SubscriptionProductDetail }`**
|
|
392
419
|
|