@waffo/pancake-ts 0.3.1 → 0.3.2
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 +6 -0
- package/README.md +66 -69
- package/dist/index.cjs +36 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -64
- package/dist/index.js.map +1 -1
- package/docs/api-reference.md +290 -289
- package/docs/graphql-guide.md +12 -12
- package/docs/webhook-guide.md +79 -82
- package/package.json +15 -2
package/docs/api-reference.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Complete reference for all `@waffo/pancake-ts` resources, parameters, and return types.
|
|
4
4
|
|
|
5
5
|
> **Conventions**:
|
|
6
|
+
>
|
|
6
7
|
> - All amounts are in the **smallest currency unit** (e.g. 999 = $9.99 USD, 4500 = ¥4500 JPY)
|
|
7
8
|
> - All timestamps are **ISO 8601 UTC** strings
|
|
8
9
|
> - 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
|
|
@@ -32,17 +33,17 @@ const { token, expiresAt } = await client.auth.issueSessionToken({
|
|
|
32
33
|
|
|
33
34
|
**Parameters `IssueSessionTokenParams`**:
|
|
34
35
|
|
|
35
|
-
| Field
|
|
36
|
-
|
|
37
|
-
| `storeId`
|
|
38
|
-
| `productId`
|
|
39
|
-
| `buyerIdentity` | `string` | Yes
|
|
36
|
+
| Field | Type | Required | Description |
|
|
37
|
+
| --------------- | -------- | -------- | ------------------------------------------------------------------------------------------------ |
|
|
38
|
+
| `storeId` | `string` | No | Store ID (at least one of `storeId` / `productId` required) |
|
|
39
|
+
| `productId` | `string` | No | Product ID (at least one of `storeId` / `productId` required; server derives store from product) |
|
|
40
|
+
| `buyerIdentity` | `string` | Yes | Buyer identity (email or merchant-defined identifier) |
|
|
40
41
|
|
|
41
42
|
**Returns `SessionToken`**:
|
|
42
43
|
|
|
43
|
-
| Field
|
|
44
|
-
|
|
45
|
-
| `token`
|
|
44
|
+
| Field | Type | Description |
|
|
45
|
+
| ----------- | -------- | --------------------- |
|
|
46
|
+
| `token` | `string` | JWT token string |
|
|
46
47
|
| `expiresAt` | `string` | Token expiration time |
|
|
47
48
|
|
|
48
49
|
---
|
|
@@ -59,9 +60,9 @@ const { store } = await client.stores.create({ name: "My Store" });
|
|
|
59
60
|
|
|
60
61
|
**Parameters `CreateStoreParams`**:
|
|
61
62
|
|
|
62
|
-
| Field
|
|
63
|
-
|
|
64
|
-
| `name` | `string` | Yes
|
|
63
|
+
| Field | Type | Required | Description |
|
|
64
|
+
| ------ | -------- | -------- | --------------------------------------------------- |
|
|
65
|
+
| `name` | `string` | Yes | Store name (1–48 characters, trimmed automatically) |
|
|
65
66
|
|
|
66
67
|
**Returns `{ store: Store }`**
|
|
67
68
|
|
|
@@ -113,17 +114,17 @@ const { store } = await client.stores.update({
|
|
|
113
114
|
|
|
114
115
|
**Parameters `UpdateStoreParams`**:
|
|
115
116
|
|
|
116
|
-
| Field
|
|
117
|
-
|
|
118
|
-
| `id`
|
|
119
|
-
| `name`
|
|
120
|
-
| `status`
|
|
121
|
-
| `logo`
|
|
122
|
-
| `supportEmail`
|
|
123
|
-
| `website`
|
|
124
|
-
| `webhookSettings`
|
|
125
|
-
| `notificationSettings` | `NotificationSettings \| null` | No
|
|
126
|
-
| `checkoutSettings`
|
|
117
|
+
| Field | Type | Required | Description |
|
|
118
|
+
| ---------------------- | ------------------------------ | -------- | -------------------------------------------------------------------------- |
|
|
119
|
+
| `id` | `string` | Yes | Store ID |
|
|
120
|
+
| `name` | `string` | No | Store name (1–100 characters) |
|
|
121
|
+
| `status` | `EntityStatus` | No | Store status |
|
|
122
|
+
| `logo` | `string \| null` | No | Logo (Base64 encoded image) |
|
|
123
|
+
| `supportEmail` | `string \| null` | No | Support email address |
|
|
124
|
+
| `website` | `string \| null` | No | Store website URL |
|
|
125
|
+
| `webhookSettings` | `WebhookSettings \| null` | No | Webhook endpoint configuration (test/prod URLs and subscribed event types) |
|
|
126
|
+
| `notificationSettings` | `NotificationSettings \| null` | No | Email notification preferences |
|
|
127
|
+
| `checkoutSettings` | `CheckoutSettings \| null` | No | Checkout page theme (light/dark) |
|
|
127
128
|
|
|
128
129
|
**Returns `{ store: Store }`**
|
|
129
130
|
|
|
@@ -137,9 +138,9 @@ const { store } = await client.stores.delete({ id: "STO_xxx" });
|
|
|
137
138
|
|
|
138
139
|
**Parameters `DeleteStoreParams`**:
|
|
139
140
|
|
|
140
|
-
| Field | Type
|
|
141
|
-
|
|
142
|
-
| `id`
|
|
141
|
+
| Field | Type | Required | Description |
|
|
142
|
+
| ----- | -------- | -------- | ----------- |
|
|
143
|
+
| `id` | `string` | Yes | Store ID |
|
|
143
144
|
|
|
144
145
|
**Returns `{ store: Store }`**
|
|
145
146
|
|
|
@@ -163,22 +164,22 @@ const result = await client.storeMerchants.add({
|
|
|
163
164
|
|
|
164
165
|
**Parameters `AddMerchantParams`**:
|
|
165
166
|
|
|
166
|
-
| Field
|
|
167
|
-
|
|
168
|
-
| `storeId` | `string`
|
|
169
|
-
| `email`
|
|
170
|
-
| `role`
|
|
167
|
+
| Field | Type | Required | Description |
|
|
168
|
+
| --------- | --------------------- | -------- | -------------- |
|
|
169
|
+
| `storeId` | `string` | Yes | Store ID |
|
|
170
|
+
| `email` | `string` | Yes | Merchant email |
|
|
171
|
+
| `role` | `"admin" \| "member"` | Yes | Role to assign |
|
|
171
172
|
|
|
172
173
|
**Returns `AddMerchantResult`**:
|
|
173
174
|
|
|
174
|
-
| Field
|
|
175
|
-
|
|
176
|
-
| `storeId`
|
|
177
|
-
| `merchantId` | `string` | Merchant ID
|
|
178
|
-
| `email`
|
|
179
|
-
| `role`
|
|
180
|
-
| `status`
|
|
181
|
-
| `addedAt`
|
|
175
|
+
| Field | Type | Description |
|
|
176
|
+
| ------------ | -------- | -------------------- |
|
|
177
|
+
| `storeId` | `string` | Store ID |
|
|
178
|
+
| `merchantId` | `string` | Merchant ID |
|
|
179
|
+
| `email` | `string` | Merchant email |
|
|
180
|
+
| `role` | `string` | Assigned role |
|
|
181
|
+
| `status` | `string` | Membership status |
|
|
182
|
+
| `addedAt` | `string` | Timestamp when added |
|
|
182
183
|
|
|
183
184
|
### `client.storeMerchants.remove(params)`
|
|
184
185
|
|
|
@@ -193,16 +194,16 @@ const result = await client.storeMerchants.remove({
|
|
|
193
194
|
|
|
194
195
|
**Parameters `RemoveMerchantParams`**:
|
|
195
196
|
|
|
196
|
-
| Field
|
|
197
|
-
|
|
198
|
-
| `storeId`
|
|
199
|
-
| `merchantId` | `string` | Yes
|
|
197
|
+
| Field | Type | Required | Description |
|
|
198
|
+
| ------------ | -------- | -------- | ----------- |
|
|
199
|
+
| `storeId` | `string` | Yes | Store ID |
|
|
200
|
+
| `merchantId` | `string` | Yes | Merchant ID |
|
|
200
201
|
|
|
201
202
|
**Returns `RemoveMerchantResult`**:
|
|
202
203
|
|
|
203
|
-
| Field
|
|
204
|
-
|
|
205
|
-
| `message`
|
|
204
|
+
| Field | Type | Description |
|
|
205
|
+
| ----------- | -------- | ---------------------- |
|
|
206
|
+
| `message` | `string` | Operation message |
|
|
206
207
|
| `removedAt` | `string` | Timestamp when removed |
|
|
207
208
|
|
|
208
209
|
### `client.storeMerchants.updateRole(params)`
|
|
@@ -219,20 +220,20 @@ const result = await client.storeMerchants.updateRole({
|
|
|
219
220
|
|
|
220
221
|
**Parameters `UpdateRoleParams`**:
|
|
221
222
|
|
|
222
|
-
| Field
|
|
223
|
-
|
|
224
|
-
| `storeId`
|
|
225
|
-
| `merchantId` | `string`
|
|
226
|
-
| `role`
|
|
223
|
+
| Field | Type | Required | Description |
|
|
224
|
+
| ------------ | --------------------- | -------- | ----------- |
|
|
225
|
+
| `storeId` | `string` | Yes | Store ID |
|
|
226
|
+
| `merchantId` | `string` | Yes | Merchant ID |
|
|
227
|
+
| `role` | `"admin" \| "member"` | Yes | New role |
|
|
227
228
|
|
|
228
229
|
**Returns `UpdateRoleResult`**:
|
|
229
230
|
|
|
230
|
-
| Field
|
|
231
|
-
|
|
232
|
-
| `storeId`
|
|
233
|
-
| `merchantId` | `string` | Merchant ID
|
|
234
|
-
| `role`
|
|
235
|
-
| `updatedAt`
|
|
231
|
+
| Field | Type | Description |
|
|
232
|
+
| ------------ | -------- | ---------------------- |
|
|
233
|
+
| `storeId` | `string` | Store ID |
|
|
234
|
+
| `merchantId` | `string` | Merchant ID |
|
|
235
|
+
| `role` | `string` | Updated role |
|
|
236
|
+
| `updatedAt` | `string` | Timestamp when updated |
|
|
236
237
|
|
|
237
238
|
---
|
|
238
239
|
|
|
@@ -262,15 +263,15 @@ const { product } = await client.onetimeProducts.create({
|
|
|
262
263
|
|
|
263
264
|
**Parameters `CreateOnetimeProductParams`**:
|
|
264
265
|
|
|
265
|
-
| Field
|
|
266
|
-
|
|
267
|
-
| `storeId`
|
|
268
|
-
| `name`
|
|
269
|
-
| `prices`
|
|
270
|
-
| `description` | `string`
|
|
271
|
-
| `media`
|
|
272
|
-
| `successUrl`
|
|
273
|
-
| `metadata`
|
|
266
|
+
| Field | Type | Required | Description |
|
|
267
|
+
| ------------- | ------------------------- | -------- | --------------------------------------------------- |
|
|
268
|
+
| `storeId` | `string` | Yes | Store ID |
|
|
269
|
+
| `name` | `string` | Yes | Product name |
|
|
270
|
+
| `prices` | `Prices` | Yes | Multi-currency prices (`Record<string, PriceInfo>`) |
|
|
271
|
+
| `description` | `string` | No | Product description |
|
|
272
|
+
| `media` | `MediaItem[]` | No | Media assets (images, videos) |
|
|
273
|
+
| `successUrl` | `string` | No | Redirect URL after successful payment |
|
|
274
|
+
| `metadata` | `Record<string, unknown>` | No | Custom metadata |
|
|
274
275
|
|
|
275
276
|
**Returns `{ product: OnetimeProductDetail }`**
|
|
276
277
|
|
|
@@ -296,15 +297,15 @@ const { product: p2 } = await client.onetimeProducts.update({
|
|
|
296
297
|
|
|
297
298
|
**Parameters `UpdateOnetimeProductParams`**:
|
|
298
299
|
|
|
299
|
-
| Field
|
|
300
|
-
|
|
301
|
-
| `id`
|
|
302
|
-
| `name`
|
|
303
|
-
| `prices`
|
|
304
|
-
| `description` | `string`
|
|
305
|
-
| `media`
|
|
306
|
-
| `successUrl`
|
|
307
|
-
| `metadata`
|
|
300
|
+
| Field | Type | Required | Description |
|
|
301
|
+
| ------------- | ------------------------- | -------- | ------------------------------------- |
|
|
302
|
+
| `id` | `string` | Yes | Product ID |
|
|
303
|
+
| `name` | `string` | No | Product name |
|
|
304
|
+
| `prices` | `Prices` | No | Multi-currency prices |
|
|
305
|
+
| `description` | `string` | No | Product description |
|
|
306
|
+
| `media` | `MediaItem[]` | No | Media assets |
|
|
307
|
+
| `successUrl` | `string` | No | Redirect URL after successful payment |
|
|
308
|
+
| `metadata` | `Record<string, unknown>` | No | Custom metadata |
|
|
308
309
|
|
|
309
310
|
**Returns `{ product: OnetimeProductDetail }`**
|
|
310
311
|
|
|
@@ -318,9 +319,9 @@ const { product } = await client.onetimeProducts.publish({ id: "PROD_xxx" });
|
|
|
318
319
|
|
|
319
320
|
**Parameters `PublishOnetimeProductParams`**:
|
|
320
321
|
|
|
321
|
-
| Field | Type
|
|
322
|
-
|
|
323
|
-
| `id`
|
|
322
|
+
| Field | Type | Required | Description |
|
|
323
|
+
| ----- | -------- | -------- | ----------- |
|
|
324
|
+
| `id` | `string` | Yes | Product ID |
|
|
324
325
|
|
|
325
326
|
**Returns `{ product: OnetimeProductDetail }`**
|
|
326
327
|
|
|
@@ -339,10 +340,10 @@ const { product } = await client.onetimeProducts.updateStatus({
|
|
|
339
340
|
|
|
340
341
|
**Parameters `UpdateOnetimeStatusParams`**:
|
|
341
342
|
|
|
342
|
-
| Field
|
|
343
|
-
|
|
344
|
-
| `id`
|
|
345
|
-
| `status` | `ProductVersionStatus` | Yes
|
|
343
|
+
| Field | Type | Required | Description |
|
|
344
|
+
| -------- | ---------------------- | -------- | ---------------------- |
|
|
345
|
+
| `id` | `string` | Yes | Product ID |
|
|
346
|
+
| `status` | `ProductVersionStatus` | Yes | `Active` or `Inactive` |
|
|
346
347
|
|
|
347
348
|
**Returns `{ product: OnetimeProductDetail }`**
|
|
348
349
|
|
|
@@ -368,16 +369,16 @@ const { product } = await client.subscriptionProducts.create({
|
|
|
368
369
|
|
|
369
370
|
**Parameters `CreateSubscriptionProductParams`**:
|
|
370
371
|
|
|
371
|
-
| Field
|
|
372
|
-
|
|
373
|
-
| `storeId`
|
|
374
|
-
| `name`
|
|
375
|
-
| `billingPeriod` | `BillingPeriod`
|
|
376
|
-
| `prices`
|
|
377
|
-
| `description`
|
|
378
|
-
| `media`
|
|
379
|
-
| `successUrl`
|
|
380
|
-
| `metadata`
|
|
372
|
+
| Field | Type | Required | Description |
|
|
373
|
+
| --------------- | ------------------------- | -------- | -------------------------------------------------------------- |
|
|
374
|
+
| `storeId` | `string` | Yes | Store ID |
|
|
375
|
+
| `name` | `string` | Yes | Product name |
|
|
376
|
+
| `billingPeriod` | `BillingPeriod` | Yes | Billing period (`Weekly` / `Monthly` / `Quarterly` / `Yearly`) |
|
|
377
|
+
| `prices` | `Prices` | Yes | Multi-currency prices |
|
|
378
|
+
| `description` | `string` | No | Product description |
|
|
379
|
+
| `media` | `MediaItem[]` | No | Media assets |
|
|
380
|
+
| `successUrl` | `string` | No | Redirect URL after successful payment |
|
|
381
|
+
| `metadata` | `Record<string, unknown>` | No | Custom metadata |
|
|
381
382
|
|
|
382
383
|
**Returns `{ product: SubscriptionProductDetail }`**
|
|
383
384
|
|
|
@@ -404,16 +405,16 @@ const { product: p2 } = await client.subscriptionProducts.update({
|
|
|
404
405
|
|
|
405
406
|
**Parameters `UpdateSubscriptionProductParams`**:
|
|
406
407
|
|
|
407
|
-
| Field
|
|
408
|
-
|
|
409
|
-
| `id`
|
|
410
|
-
| `name`
|
|
411
|
-
| `billingPeriod` | `BillingPeriod`
|
|
412
|
-
| `prices`
|
|
413
|
-
| `description`
|
|
414
|
-
| `media`
|
|
415
|
-
| `successUrl`
|
|
416
|
-
| `metadata`
|
|
408
|
+
| Field | Type | Required | Description |
|
|
409
|
+
| --------------- | ------------------------- | -------- | ------------------------------------- |
|
|
410
|
+
| `id` | `string` | Yes | Product ID |
|
|
411
|
+
| `name` | `string` | No | Product name |
|
|
412
|
+
| `billingPeriod` | `BillingPeriod` | No | Billing period |
|
|
413
|
+
| `prices` | `Prices` | No | Multi-currency prices |
|
|
414
|
+
| `description` | `string` | No | Product description |
|
|
415
|
+
| `media` | `MediaItem[]` | No | Media assets |
|
|
416
|
+
| `successUrl` | `string` | No | Redirect URL after successful payment |
|
|
417
|
+
| `metadata` | `Record<string, unknown>` | No | Custom metadata |
|
|
417
418
|
|
|
418
419
|
**Returns `{ product: SubscriptionProductDetail }`**
|
|
419
420
|
|
|
@@ -462,13 +463,13 @@ const { group } = await client.subscriptionProductGroups.create({
|
|
|
462
463
|
|
|
463
464
|
**Parameters `CreateSubscriptionProductGroupParams`**:
|
|
464
465
|
|
|
465
|
-
| Field
|
|
466
|
-
|
|
467
|
-
| `storeId`
|
|
468
|
-
| `name`
|
|
469
|
-
| `description` | `string`
|
|
470
|
-
| `rules`
|
|
471
|
-
| `productIds`
|
|
466
|
+
| Field | Type | Required | Description |
|
|
467
|
+
| ------------- | ------------ | -------- | ------------------------------------------ |
|
|
468
|
+
| `storeId` | `string` | Yes | Store ID |
|
|
469
|
+
| `name` | `string` | Yes | Group name |
|
|
470
|
+
| `description` | `string` | No | Group description |
|
|
471
|
+
| `rules` | `GroupRules` | No | Group rules (e.g. `{ sharedTrial: true }`) |
|
|
472
|
+
| `productIds` | `string[]` | No | Subscription product IDs to include |
|
|
472
473
|
|
|
473
474
|
**Returns `{ group: SubscriptionProductGroup }`**
|
|
474
475
|
|
|
@@ -513,9 +514,9 @@ const { group } = await client.subscriptionProductGroups.publish({ id: "spg_xxx"
|
|
|
513
514
|
|
|
514
515
|
Cancel a subscription order. The resulting status depends on the current order state:
|
|
515
516
|
|
|
516
|
-
| Current Status
|
|
517
|
-
|
|
518
|
-
| `pending`
|
|
517
|
+
| Current Status | Result | Behavior |
|
|
518
|
+
| --------------------- | ----------- | -------------------------------------------------------- |
|
|
519
|
+
| `pending` | `canceled` | Immediate cancellation |
|
|
519
520
|
| `active` / `trialing` | `canceling` | PSP cancellation initiated; webhook updates status later |
|
|
520
521
|
|
|
521
522
|
```typescript
|
|
@@ -527,16 +528,16 @@ const { orderId, status } = await client.orders.cancelSubscription({
|
|
|
527
528
|
|
|
528
529
|
**Parameters `CancelSubscriptionParams`**:
|
|
529
530
|
|
|
530
|
-
| Field
|
|
531
|
-
|
|
532
|
-
| `orderId` | `string` | Yes
|
|
531
|
+
| Field | Type | Required | Description |
|
|
532
|
+
| --------- | -------- | -------- | ----------- |
|
|
533
|
+
| `orderId` | `string` | Yes | Order ID |
|
|
533
534
|
|
|
534
535
|
**Returns `CancelSubscriptionResult`**:
|
|
535
536
|
|
|
536
|
-
| Field
|
|
537
|
-
|
|
538
|
-
| `orderId` | `string` | Order ID
|
|
539
|
-
| `status`
|
|
537
|
+
| Field | Type | Description |
|
|
538
|
+
| --------- | -------- | ------------------------------------------------ |
|
|
539
|
+
| `orderId` | `string` | Order ID |
|
|
540
|
+
| `status` | `string` | Resulting status (`"canceled"` or `"canceling"`) |
|
|
540
541
|
|
|
541
542
|
---
|
|
542
543
|
|
|
@@ -558,54 +559,54 @@ const buyer = client.buyer(token);
|
|
|
558
559
|
|
|
559
560
|
### `buyer.cancelSubscription(params)`
|
|
560
561
|
|
|
561
|
-
| Field
|
|
562
|
-
|
|
563
|
-
| `orderId` | `string` | Yes
|
|
562
|
+
| Field | Type | Required | Description |
|
|
563
|
+
| --------- | -------- | -------- | --------------------- |
|
|
564
|
+
| `orderId` | `string` | Yes | Subscription order ID |
|
|
564
565
|
|
|
565
566
|
**Returns `CancelSubscriptionResult`**: `{ orderId, status }` — status is `"canceling"` (active) or `"canceled"` (pending)
|
|
566
567
|
|
|
567
568
|
### `buyer.cancelOnetimeOrder(params)`
|
|
568
569
|
|
|
569
|
-
| Field
|
|
570
|
-
|
|
571
|
-
| `orderId` | `string` | Yes
|
|
570
|
+
| Field | Type | Required | Description |
|
|
571
|
+
| --------- | -------- | -------- | ----------------- |
|
|
572
|
+
| `orderId` | `string` | Yes | One-time order ID |
|
|
572
573
|
|
|
573
574
|
**Returns `CancelOnetimeOrderResult`**: `{ orderId, status }` — status is `"canceled"`
|
|
574
575
|
|
|
575
576
|
### `buyer.reactivateSubscription(params)`
|
|
576
577
|
|
|
577
|
-
| Field
|
|
578
|
-
|
|
579
|
-
| `orderId` | `string` | Yes
|
|
578
|
+
| Field | Type | Required | Description |
|
|
579
|
+
| --------- | -------- | -------- | ----------------------------------------------------- |
|
|
580
|
+
| `orderId` | `string` | Yes | Subscription order ID (must be in `canceling` status) |
|
|
580
581
|
|
|
581
582
|
**Returns `ReactivateSubscriptionResult`**: `{ orderId, status }` — status is `"active"`
|
|
582
583
|
|
|
583
584
|
### `buyer.createRefundTicket(params)`
|
|
584
585
|
|
|
585
|
-
| Field
|
|
586
|
-
|
|
587
|
-
| `paymentId`
|
|
588
|
-
| `reason`
|
|
589
|
-
| `requestedAmount` | `RequestedAmount`
|
|
590
|
-
| `metadata`
|
|
586
|
+
| Field | Type | Required | Description |
|
|
587
|
+
| ----------------- | ------------------------- | -------- | -------------------------------------- |
|
|
588
|
+
| `paymentId` | `string` | Yes | Payment ID to refund |
|
|
589
|
+
| `reason` | `string` | Yes | Reason for the refund request |
|
|
590
|
+
| `requestedAmount` | `RequestedAmount` | Yes | Refund amount (`{ amount, currency }`) |
|
|
591
|
+
| `metadata` | `Record<string, unknown>` | No | Custom metadata |
|
|
591
592
|
|
|
592
593
|
**`RequestedAmount`**:
|
|
593
594
|
|
|
594
|
-
| Field
|
|
595
|
-
|
|
596
|
-
| `amount`
|
|
597
|
-
| `currency` | `string` | Currency code (ISO 4217)
|
|
595
|
+
| Field | Type | Description |
|
|
596
|
+
| ---------- | -------- | ------------------------------------------ |
|
|
597
|
+
| `amount` | `string` | Amount in display format (e.g., `"29.00"`) |
|
|
598
|
+
| `currency` | `string` | Currency code (ISO 4217) |
|
|
598
599
|
|
|
599
600
|
**Returns `{ ticket: RefundTicket }`**
|
|
600
601
|
|
|
601
602
|
### `buyer.resubmitRefundTicket(params)`
|
|
602
603
|
|
|
603
|
-
| Field
|
|
604
|
-
|
|
605
|
-
| `ticketId`
|
|
606
|
-
| `paymentId`
|
|
607
|
-
| `reason`
|
|
608
|
-
| `requestedAmount` | `RequestedAmount` | Yes
|
|
604
|
+
| Field | Type | Required | Description |
|
|
605
|
+
| ----------------- | ----------------- | -------- | --------------------- |
|
|
606
|
+
| `ticketId` | `string` | Yes | Existing ticket ID |
|
|
607
|
+
| `paymentId` | `string` | Yes | Payment ID |
|
|
608
|
+
| `reason` | `string` | Yes | Updated reason |
|
|
609
|
+
| `requestedAmount` | `RequestedAmount` | Yes | Updated refund amount |
|
|
609
610
|
|
|
610
611
|
**Returns `{ ticket: RefundTicket }`**
|
|
611
612
|
|
|
@@ -613,10 +614,10 @@ const buyer = client.buyer(token);
|
|
|
613
614
|
|
|
614
615
|
Same parameters as `client.graphql.query<T>()` but scoped to the buyer's own data via session token.
|
|
615
616
|
|
|
616
|
-
| Field
|
|
617
|
-
|
|
618
|
-
| `query`
|
|
619
|
-
| `variables` | `Record<string, unknown>` | No
|
|
617
|
+
| Field | Type | Required | Description |
|
|
618
|
+
| ----------- | ------------------------- | -------- | -------------------- |
|
|
619
|
+
| `query` | `string` | Yes | GraphQL query string |
|
|
620
|
+
| `variables` | `Record<string, unknown>` | No | Query variables |
|
|
620
621
|
|
|
621
622
|
**Returns `GraphQLResponse<T>`**: `{ data, errors? }`
|
|
622
623
|
|
|
@@ -661,29 +662,29 @@ const subResult = await client.checkout.authenticated.create({
|
|
|
661
662
|
|
|
662
663
|
**Parameters `AuthenticatedCheckoutParams`**:
|
|
663
664
|
|
|
664
|
-
| Field
|
|
665
|
-
|
|
666
|
-
| `productId`
|
|
667
|
-
| `currency`
|
|
668
|
-
| `buyerIdentity`
|
|
669
|
-
| `buyerEmail`
|
|
670
|
-
| `billingDetail`
|
|
671
|
-
| `priceSnapshot`
|
|
672
|
-
| `withTrial`
|
|
673
|
-
| `successUrl`
|
|
674
|
-
| `expiresInSeconds` | `number`
|
|
675
|
-
| `darkMode`
|
|
676
|
-
| `metadata`
|
|
665
|
+
| Field | Type | Required | Description |
|
|
666
|
+
| ------------------ | ------------------------ | -------- | --------------------------------------------------------------- |
|
|
667
|
+
| `productId` | `string` | Yes | Product ID (product type is auto-detected server-side) |
|
|
668
|
+
| `currency` | `string` | Yes | Currency code (ISO 4217) |
|
|
669
|
+
| `buyerIdentity` | `string` | Yes | Buyer identity (email or merchant-defined identifier) |
|
|
670
|
+
| `buyerEmail` | `string` | No | Pre-filled buyer email (defaults to `buyerIdentity`) |
|
|
671
|
+
| `billingDetail` | `BillingDetail` | No | Pre-filled billing details (country, tax ID, etc.) |
|
|
672
|
+
| `priceSnapshot` | `PriceInfo` | No | Price snapshot override (reads from DB if omitted) |
|
|
673
|
+
| `withTrial` | `boolean` | No | Enable trial period (subscription only) |
|
|
674
|
+
| `successUrl` | `string` | No | Redirect URL after successful payment |
|
|
675
|
+
| `expiresInSeconds` | `number` | No | Session expiry in seconds (default: 45 minutes) |
|
|
676
|
+
| `darkMode` | `boolean` | No | Dark mode override (true=dark, false=light, omit=store default) |
|
|
677
|
+
| `metadata` | `Record<string, string>` | No | Custom metadata |
|
|
677
678
|
|
|
678
679
|
**Returns `AuthenticatedCheckoutResult`**:
|
|
679
680
|
|
|
680
|
-
| Field
|
|
681
|
-
|
|
682
|
-
| `sessionId`
|
|
683
|
-
| `checkoutUrl`
|
|
684
|
-
| `expiresAt`
|
|
685
|
-
| `token`
|
|
686
|
-
| `tokenExpiresAt` | `string` | Token expiration time
|
|
681
|
+
| Field | Type | Description |
|
|
682
|
+
| ---------------- | -------- | --------------------------------------- |
|
|
683
|
+
| `sessionId` | `string` | Session ID |
|
|
684
|
+
| `checkoutUrl` | `string` | Checkout URL with `#token=...` appended |
|
|
685
|
+
| `expiresAt` | `string` | Session expiration time |
|
|
686
|
+
| `token` | `string` | Issued JWT token |
|
|
687
|
+
| `tokenExpiresAt` | `string` | Token expiration time |
|
|
687
688
|
|
|
688
689
|
### `client.checkout.anonymous.create(params)`
|
|
689
690
|
|
|
@@ -708,24 +709,24 @@ const snapshotResult = await client.checkout.anonymous.create({
|
|
|
708
709
|
|
|
709
710
|
**Parameters `AnonymousCheckoutParams`**:
|
|
710
711
|
|
|
711
|
-
| Field
|
|
712
|
-
|
|
713
|
-
| `productId`
|
|
714
|
-
| `currency`
|
|
715
|
-
| `priceSnapshot`
|
|
716
|
-
| `withTrial`
|
|
717
|
-
| `successUrl`
|
|
718
|
-
| `expiresInSeconds` | `number`
|
|
719
|
-
| `darkMode`
|
|
720
|
-
| `metadata`
|
|
712
|
+
| Field | Type | Required | Description |
|
|
713
|
+
| ------------------ | ------------------------ | -------- | --------------------------------------------------------------- |
|
|
714
|
+
| `productId` | `string` | Yes | Product ID (product type is auto-detected server-side) |
|
|
715
|
+
| `currency` | `string` | Yes | Currency code (ISO 4217) |
|
|
716
|
+
| `priceSnapshot` | `PriceInfo` | No | Price snapshot override (reads from DB if omitted) |
|
|
717
|
+
| `withTrial` | `boolean` | No | Enable trial period (subscription only) |
|
|
718
|
+
| `successUrl` | `string` | No | Redirect URL after successful payment |
|
|
719
|
+
| `expiresInSeconds` | `number` | No | Session expiry in seconds (default: 45 minutes) |
|
|
720
|
+
| `darkMode` | `boolean` | No | Dark mode override (true=dark, false=light, omit=store default) |
|
|
721
|
+
| `metadata` | `Record<string, string>` | No | Custom metadata |
|
|
721
722
|
|
|
722
723
|
**Returns `CheckoutSessionResult`**:
|
|
723
724
|
|
|
724
|
-
| Field
|
|
725
|
-
|
|
726
|
-
| `sessionId`
|
|
725
|
+
| Field | Type | Description |
|
|
726
|
+
| ------------- | -------- | ------------------------ |
|
|
727
|
+
| `sessionId` | `string` | Session ID |
|
|
727
728
|
| `checkoutUrl` | `string` | Hosted checkout page URL |
|
|
728
|
-
| `expiresAt`
|
|
729
|
+
| `expiresAt` | `string` | Session expiration time |
|
|
729
730
|
|
|
730
731
|
### `client.checkout.createSession(params)` (low-level)
|
|
731
732
|
|
|
@@ -741,37 +742,37 @@ const session = await client.checkout.createSession({
|
|
|
741
742
|
|
|
742
743
|
**Parameters `CreateCheckoutSessionParams`**:
|
|
743
744
|
|
|
744
|
-
| Field
|
|
745
|
-
|
|
746
|
-
| `productId`
|
|
747
|
-
| `currency`
|
|
748
|
-
| `priceSnapshot`
|
|
749
|
-
| `withTrial`
|
|
750
|
-
| `buyerEmail`
|
|
751
|
-
| `billingDetail`
|
|
752
|
-
| `successUrl`
|
|
753
|
-
| `expiresInSeconds` | `number`
|
|
754
|
-
| `darkMode`
|
|
755
|
-
| `metadata`
|
|
745
|
+
| Field | Type | Required | Description |
|
|
746
|
+
| ------------------ | ------------------------ | -------- | ------------------------------------------------------ |
|
|
747
|
+
| `productId` | `string` | Yes | Product ID (product type is auto-detected server-side) |
|
|
748
|
+
| `currency` | `string` | Yes | Currency code (ISO 4217) |
|
|
749
|
+
| `priceSnapshot` | `PriceInfo` | No | Price snapshot override (reads from DB if omitted) |
|
|
750
|
+
| `withTrial` | `boolean` | No | Enable trial period (subscription only) |
|
|
751
|
+
| `buyerEmail` | `string` | No | Pre-filled buyer email |
|
|
752
|
+
| `billingDetail` | `BillingDetail` | No | Pre-filled billing details (country, tax ID, etc.) |
|
|
753
|
+
| `successUrl` | `string` | No | Redirect URL after successful payment |
|
|
754
|
+
| `expiresInSeconds` | `number` | No | Session expiry in seconds (default: 45 minutes) |
|
|
755
|
+
| `darkMode` | `boolean` | No | Dark mode override |
|
|
756
|
+
| `metadata` | `Record<string, string>` | No | Custom metadata |
|
|
756
757
|
|
|
757
758
|
**`BillingDetail` fields**:
|
|
758
759
|
|
|
759
|
-
| Field
|
|
760
|
-
|
|
761
|
-
| `country`
|
|
762
|
-
| `isBusiness`
|
|
763
|
-
| `postcode`
|
|
764
|
-
| `state`
|
|
765
|
-
| `businessName` | `string`
|
|
766
|
-
| `taxId`
|
|
760
|
+
| Field | Type | Required | Description |
|
|
761
|
+
| -------------- | --------- | ----------- | ------------------------------------------------------------------------------------------------------- |
|
|
762
|
+
| `country` | `string` | Yes | Country code (ISO 3166-1 alpha-2) |
|
|
763
|
+
| `isBusiness` | `boolean` | Yes | Whether this is a business purchase |
|
|
764
|
+
| `postcode` | `string` | No | Postal / ZIP code |
|
|
765
|
+
| `state` | `string` | Conditional | State / province code (required when `country` is `US` or `CA`) |
|
|
766
|
+
| `businessName` | `string` | Conditional | Business name (required when `isBusiness` is `true`) |
|
|
767
|
+
| `taxId` | `string` | Conditional | Tax ID / VAT number (required for EU countries when `isBusiness` is `true`; triggers reverse charge 0%) |
|
|
767
768
|
|
|
768
769
|
**Returns `CheckoutSessionResult`**:
|
|
769
770
|
|
|
770
|
-
| Field
|
|
771
|
-
|
|
772
|
-
| `sessionId`
|
|
771
|
+
| Field | Type | Description |
|
|
772
|
+
| ------------- | -------- | ------------------------ |
|
|
773
|
+
| `sessionId` | `string` | Session ID |
|
|
773
774
|
| `checkoutUrl` | `string` | Hosted checkout page URL |
|
|
774
|
-
| `expiresAt`
|
|
775
|
+
| `expiresAt` | `string` | Session expiration time |
|
|
775
776
|
|
|
776
777
|
---
|
|
777
778
|
|
|
@@ -799,16 +800,16 @@ const productResult = await client.graphql.query({
|
|
|
799
800
|
|
|
800
801
|
**Parameters `GraphQLParams`**:
|
|
801
802
|
|
|
802
|
-
| Field
|
|
803
|
-
|
|
804
|
-
| `query`
|
|
805
|
-
| `variables` | `Record<string, unknown>` | No
|
|
803
|
+
| Field | Type | Required | Description |
|
|
804
|
+
| ----------- | ------------------------- | -------- | -------------------- |
|
|
805
|
+
| `query` | `string` | Yes | GraphQL query string |
|
|
806
|
+
| `variables` | `Record<string, unknown>` | No | Query variables |
|
|
806
807
|
|
|
807
808
|
**Returns `GraphQLResponse<T>`**:
|
|
808
809
|
|
|
809
|
-
| Field
|
|
810
|
-
|
|
811
|
-
| `data`
|
|
810
|
+
| Field | Type | Description |
|
|
811
|
+
| -------- | --------------------------------------- | ----------------------- |
|
|
812
|
+
| `data` | `T \| null` | Query result |
|
|
812
813
|
| `errors` | `Array<{ message, locations?, path? }>` | GraphQL errors (if any) |
|
|
813
814
|
|
|
814
815
|
See [GraphQL Guide](graphql-guide.md) for introspection, filters, pagination, and practical examples.
|
|
@@ -819,80 +820,80 @@ See [GraphQL Guide](graphql-guide.md) for introspection, filters, pagination, an
|
|
|
819
820
|
|
|
820
821
|
All exported type interfaces:
|
|
821
822
|
|
|
822
|
-
| Export
|
|
823
|
-
|
|
824
|
-
| **Config**
|
|
825
|
-
| `WaffoPancakeConfig`
|
|
826
|
-
| **Response Envelope**
|
|
827
|
-
| `ApiError`
|
|
828
|
-
| `ApiErrorResponse`
|
|
829
|
-
| `ApiResponse<T>`
|
|
830
|
-
| `ApiSuccessResponse<T>`
|
|
831
|
-
| **Auth**
|
|
832
|
-
| `IssueSessionTokenParams`
|
|
833
|
-
| `SessionToken`
|
|
834
|
-
| **Store**
|
|
835
|
-
| `Store`
|
|
836
|
-
| `CreateStoreParams`
|
|
837
|
-
| `UpdateStoreParams`
|
|
838
|
-
| `DeleteStoreParams`
|
|
839
|
-
| `WebhookSettings`
|
|
840
|
-
| `NotificationSettings`
|
|
841
|
-
| `CheckoutSettings`
|
|
842
|
-
| `CheckoutThemeSettings`
|
|
843
|
-
| **Store Merchant**
|
|
844
|
-
| `AddMerchantParams`
|
|
845
|
-
| `AddMerchantResult`
|
|
846
|
-
| `RemoveMerchantParams`
|
|
847
|
-
| `RemoveMerchantResult`
|
|
848
|
-
| `UpdateRoleParams`
|
|
849
|
-
| `UpdateRoleResult`
|
|
850
|
-
| **Product (shared)**
|
|
851
|
-
| `PriceInfo`
|
|
852
|
-
| `Prices`
|
|
853
|
-
| `MediaItem`
|
|
854
|
-
| **Onetime Product**
|
|
855
|
-
| `OnetimeProductDetail`
|
|
856
|
-
| `CreateOnetimeProductParams`
|
|
857
|
-
| `UpdateOnetimeProductParams`
|
|
858
|
-
| `PublishOnetimeProductParams`
|
|
859
|
-
| `UpdateOnetimeStatusParams`
|
|
860
|
-
| **Subscription Product**
|
|
861
|
-
| `SubscriptionProductDetail`
|
|
862
|
-
| `CreateSubscriptionProductParams`
|
|
863
|
-
| `UpdateSubscriptionProductParams`
|
|
864
|
-
| `PublishSubscriptionProductParams`
|
|
865
|
-
| `UpdateSubscriptionStatusParams`
|
|
866
|
-
| **Subscription Product Group**
|
|
867
|
-
| `SubscriptionProductGroup`
|
|
868
|
-
| `GroupRules`
|
|
869
|
-
| `CreateSubscriptionProductGroupParams`
|
|
870
|
-
| `UpdateSubscriptionProductGroupParams`
|
|
871
|
-
| `DeleteSubscriptionProductGroupParams`
|
|
872
|
-
| `PublishSubscriptionProductGroupParams` | Publish test → prod
|
|
873
|
-
| **Order**
|
|
874
|
-
| `CancelSubscriptionParams`
|
|
875
|
-
| `CancelSubscriptionResult`
|
|
876
|
-
| `BillingDetail`
|
|
877
|
-
| **Buyer Self-Service**
|
|
878
|
-
| `CancelOnetimeOrderParams`
|
|
879
|
-
| `CancelOnetimeOrderResult`
|
|
880
|
-
| `ReactivateSubscriptionParams`
|
|
881
|
-
| `ReactivateSubscriptionResult`
|
|
882
|
-
| `CreateRefundTicketParams`
|
|
883
|
-
| `ResubmitRefundTicketParams`
|
|
884
|
-
| `RefundTicket`
|
|
885
|
-
| `RequestedAmount`
|
|
886
|
-
| **Checkout**
|
|
887
|
-
| `AuthenticatedCheckoutParams`
|
|
888
|
-
| `AuthenticatedCheckoutResult`
|
|
889
|
-
| `AnonymousCheckoutParams`
|
|
890
|
-
| `CreateCheckoutSessionParams`
|
|
891
|
-
| `CheckoutSessionResult`
|
|
892
|
-
| **GraphQL**
|
|
893
|
-
| `GraphQLParams`
|
|
894
|
-
| `GraphQLResponse<T>`
|
|
895
|
-
| **Webhook**
|
|
896
|
-
| `WebhookEvent<T>`
|
|
897
|
-
| `WebhookEventData`
|
|
898
|
-
| `VerifyWebhookOptions`
|
|
823
|
+
| Export | Description |
|
|
824
|
+
| --------------------------------------- | --------------------------------------------------------- |
|
|
825
|
+
| **Config** | |
|
|
826
|
+
| `WaffoPancakeConfig` | Client configuration |
|
|
827
|
+
| **Response Envelope** | |
|
|
828
|
+
| `ApiError` | Error object (`{ message, layer }`) |
|
|
829
|
+
| `ApiErrorResponse` | Error response (`{ data: null, errors }`) |
|
|
830
|
+
| `ApiResponse<T>` | Union of success and error responses |
|
|
831
|
+
| `ApiSuccessResponse<T>` | Success response (`{ data: T }`) |
|
|
832
|
+
| **Auth** | |
|
|
833
|
+
| `IssueSessionTokenParams` | Issue token request |
|
|
834
|
+
| `SessionToken` | Token response |
|
|
835
|
+
| **Store** | |
|
|
836
|
+
| `Store` | Store entity |
|
|
837
|
+
| `CreateStoreParams` | Create store request |
|
|
838
|
+
| `UpdateStoreParams` | Update store request |
|
|
839
|
+
| `DeleteStoreParams` | Delete store request |
|
|
840
|
+
| `WebhookSettings` | Webhook endpoint configuration (test/prod) |
|
|
841
|
+
| `NotificationSettings` | Email notification preferences |
|
|
842
|
+
| `CheckoutSettings` | Checkout page theme (light/dark) |
|
|
843
|
+
| `CheckoutThemeSettings` | Single-theme checkout styling |
|
|
844
|
+
| **Store Merchant** | |
|
|
845
|
+
| `AddMerchantParams` | Add merchant request |
|
|
846
|
+
| `AddMerchantResult` | Add merchant response |
|
|
847
|
+
| `RemoveMerchantParams` | Remove merchant request |
|
|
848
|
+
| `RemoveMerchantResult` | Remove merchant response |
|
|
849
|
+
| `UpdateRoleParams` | Update role request |
|
|
850
|
+
| `UpdateRoleResult` | Update role response |
|
|
851
|
+
| **Product (shared)** | |
|
|
852
|
+
| `PriceInfo` | Single-currency price (amount in smallest unit) |
|
|
853
|
+
| `Prices` | Multi-currency prices (`Record<currencyCode, PriceInfo>`) |
|
|
854
|
+
| `MediaItem` | Media asset (image or video) |
|
|
855
|
+
| **Onetime Product** | |
|
|
856
|
+
| `OnetimeProductDetail` | One-time product entity |
|
|
857
|
+
| `CreateOnetimeProductParams` | Create request |
|
|
858
|
+
| `UpdateOnetimeProductParams` | Update request (creates new version) |
|
|
859
|
+
| `PublishOnetimeProductParams` | Publish test → prod |
|
|
860
|
+
| `UpdateOnetimeStatusParams` | Activate / deactivate |
|
|
861
|
+
| **Subscription Product** | |
|
|
862
|
+
| `SubscriptionProductDetail` | Subscription product entity |
|
|
863
|
+
| `CreateSubscriptionProductParams` | Create request |
|
|
864
|
+
| `UpdateSubscriptionProductParams` | Update request (creates new version) |
|
|
865
|
+
| `PublishSubscriptionProductParams` | Publish test → prod |
|
|
866
|
+
| `UpdateSubscriptionStatusParams` | Activate / deactivate |
|
|
867
|
+
| **Subscription Product Group** | |
|
|
868
|
+
| `SubscriptionProductGroup` | Product group entity |
|
|
869
|
+
| `GroupRules` | Group rules (shared trial, etc.) |
|
|
870
|
+
| `CreateSubscriptionProductGroupParams` | Create request |
|
|
871
|
+
| `UpdateSubscriptionProductGroupParams` | Update request (`productIds` = full replacement) |
|
|
872
|
+
| `DeleteSubscriptionProductGroupParams` | Delete request |
|
|
873
|
+
| `PublishSubscriptionProductGroupParams` | Publish test → prod |
|
|
874
|
+
| **Order** | |
|
|
875
|
+
| `CancelSubscriptionParams` | Cancel subscription request |
|
|
876
|
+
| `CancelSubscriptionResult` | Cancel subscription response |
|
|
877
|
+
| `BillingDetail` | Buyer billing details (country, tax ID, etc.) |
|
|
878
|
+
| **Buyer Self-Service** | |
|
|
879
|
+
| `CancelOnetimeOrderParams` | Cancel one-time order request |
|
|
880
|
+
| `CancelOnetimeOrderResult` | Cancel one-time order response |
|
|
881
|
+
| `ReactivateSubscriptionParams` | Reactivate subscription request |
|
|
882
|
+
| `ReactivateSubscriptionResult` | Reactivate subscription response |
|
|
883
|
+
| `CreateRefundTicketParams` | Create refund ticket request |
|
|
884
|
+
| `ResubmitRefundTicketParams` | Resubmit refund ticket request |
|
|
885
|
+
| `RefundTicket` | Refund ticket entity |
|
|
886
|
+
| `RequestedAmount` | Refund amount (`{ amount, currency }`) |
|
|
887
|
+
| **Checkout** | |
|
|
888
|
+
| `AuthenticatedCheckoutParams` | Authenticated checkout request (with buyer identity) |
|
|
889
|
+
| `AuthenticatedCheckoutResult` | Authenticated checkout response (URL with token + expiry) |
|
|
890
|
+
| `AnonymousCheckoutParams` | Anonymous checkout request (no identity) |
|
|
891
|
+
| `CreateCheckoutSessionParams` | Low-level checkout session request |
|
|
892
|
+
| `CheckoutSessionResult` | Checkout session response (URL + expiry) |
|
|
893
|
+
| **GraphQL** | |
|
|
894
|
+
| `GraphQLParams` | GraphQL query parameters |
|
|
895
|
+
| `GraphQLResponse<T>` | GraphQL response envelope |
|
|
896
|
+
| **Webhook** | |
|
|
897
|
+
| `WebhookEvent<T>` | Webhook event payload |
|
|
898
|
+
| `WebhookEventData` | Common event data fields |
|
|
899
|
+
| `VerifyWebhookOptions` | Verification options (environment, tolerance) |
|