@waffo/pancake-ts 0.1.7 → 0.1.9
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 +31 -2
- package/README.md +202 -370
- package/dist/index.cjs +121 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +266 -52
- package/dist/index.d.ts +266 -52
- package/dist/index.js +121 -33
- package/dist/index.js.map +1 -1
- package/docs/api-reference.md +786 -0
- package/docs/graphql-guide.md +664 -0
- package/docs/webhook-guide.md +456 -0
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
interface WaffoPancakeConfig {
|
|
2
|
-
/** Merchant ID (X-Merchant-Id header) */
|
|
2
|
+
/** Merchant ID in `MER_{base62}` format (sent as X-Merchant-Id header) */
|
|
3
3
|
merchantId: string;
|
|
4
4
|
/** RSA private key in PEM format for request signing */
|
|
5
5
|
privateKey: string;
|
|
6
|
-
/** Base URL override (default: https://waffo
|
|
6
|
+
/** Base URL override (default: https://api.waffo.ai) */
|
|
7
7
|
baseUrl?: string;
|
|
8
8
|
/** Custom fetch implementation (default: global fetch) */
|
|
9
9
|
fetch?: typeof fetch;
|
|
@@ -115,10 +115,11 @@ declare enum OnetimeOrderStatus {
|
|
|
115
115
|
* Subscription order status.
|
|
116
116
|
*
|
|
117
117
|
* State machine:
|
|
118
|
-
* - pending -> active, canceled
|
|
118
|
+
* - pending -> active, canceled, closed (PSP CLOSE from never-activated)
|
|
119
119
|
* - active -> canceling, past_due, canceled, expired
|
|
120
120
|
* - canceling -> active, canceled
|
|
121
121
|
* - past_due -> active, canceled
|
|
122
|
+
* - closed -> terminal (never-activated subscription closed by PSP)
|
|
122
123
|
* - canceled -> terminal
|
|
123
124
|
* - expired -> terminal
|
|
124
125
|
*
|
|
@@ -128,8 +129,9 @@ declare enum SubscriptionOrderStatus {
|
|
|
128
129
|
Pending = "pending",
|
|
129
130
|
Active = "active",
|
|
130
131
|
Canceling = "canceling",
|
|
131
|
-
Canceled = "canceled",
|
|
132
132
|
PastDue = "past_due",
|
|
133
|
+
Closed = "closed",
|
|
134
|
+
Canceled = "canceled",
|
|
133
135
|
Expired = "expired"
|
|
134
136
|
}
|
|
135
137
|
/**
|
|
@@ -185,8 +187,10 @@ declare enum ErrorLayer {
|
|
|
185
187
|
Store = "store",
|
|
186
188
|
Product = "product",
|
|
187
189
|
Order = "order",
|
|
190
|
+
Ticket = "ticket",
|
|
188
191
|
GraphQL = "graphql",
|
|
189
192
|
Resource = "resource",
|
|
193
|
+
/** SDK-specific layer for email delivery errors (not part of the service-side error layers). */
|
|
190
194
|
Email = "email"
|
|
191
195
|
}
|
|
192
196
|
/**
|
|
@@ -289,11 +293,21 @@ interface CreateStoreParams {
|
|
|
289
293
|
interface UpdateStoreParams {
|
|
290
294
|
/** Store ID */
|
|
291
295
|
id: string;
|
|
296
|
+
/** Store display name */
|
|
292
297
|
name?: string;
|
|
298
|
+
/** Store status */
|
|
293
299
|
status?: EntityStatus;
|
|
300
|
+
/** Store logo URL (set to `null` to remove) */
|
|
294
301
|
logo?: string | null;
|
|
302
|
+
/** Support email address (set to `null` to remove) */
|
|
303
|
+
supportEmail?: string | null;
|
|
304
|
+
/** Store website URL (set to `null` to remove) */
|
|
305
|
+
website?: string | null;
|
|
306
|
+
/** Webhook configuration for test and production environments (set to `null` to remove) */
|
|
295
307
|
webhookSettings?: WebhookSettings | null;
|
|
308
|
+
/** Notification preferences (set to `null` to remove) */
|
|
296
309
|
notificationSettings?: NotificationSettings | null;
|
|
310
|
+
/** Checkout page theme configuration (set to `null` to remove) */
|
|
297
311
|
checkoutSettings?: CheckoutSettings | null;
|
|
298
312
|
}
|
|
299
313
|
/** Parameters for deleting (soft-delete) a store. */
|
|
@@ -342,22 +356,22 @@ interface UpdateRoleResult {
|
|
|
342
356
|
/**
|
|
343
357
|
* Price for a single currency.
|
|
344
358
|
*
|
|
345
|
-
* Amounts are
|
|
346
|
-
* to
|
|
359
|
+
* Amounts are represented as display strings (e.g., "9.99" for USD, "1000" for JPY).
|
|
360
|
+
* The server handles conversion to/from smallest currency units internally.
|
|
347
361
|
*
|
|
348
362
|
* @see waffo-pancake-product-service/app/lib/resources/types.ts
|
|
349
363
|
*
|
|
350
364
|
* @example
|
|
351
365
|
* // USD $9.99
|
|
352
|
-
* { amount:
|
|
366
|
+
* { amount: "9.99", taxCategory: "saas" }
|
|
353
367
|
*
|
|
354
368
|
* @example
|
|
355
369
|
* // JPY ¥1000
|
|
356
370
|
* { amount: 1000, taxCategory: "software" }
|
|
357
371
|
*/
|
|
358
372
|
interface PriceInfo {
|
|
359
|
-
/** Price amount
|
|
360
|
-
amount:
|
|
373
|
+
/** Price amount as display string (e.g., "9.99" for USD, "1000" for JPY) */
|
|
374
|
+
amount: string;
|
|
361
375
|
/** Tax category */
|
|
362
376
|
taxCategory: TaxCategory;
|
|
363
377
|
}
|
|
@@ -368,7 +382,7 @@ interface PriceInfo {
|
|
|
368
382
|
*
|
|
369
383
|
* @example
|
|
370
384
|
* {
|
|
371
|
-
* "USD": { amount:
|
|
385
|
+
* "USD": { amount: "9.99", taxCategory: "saas" },
|
|
372
386
|
* "EUR": { amount: 899, taxCategory: "saas" }
|
|
373
387
|
* }
|
|
374
388
|
*/
|
|
@@ -628,6 +642,104 @@ interface CheckoutSessionResult {
|
|
|
628
642
|
/** Session expiration time (ISO 8601 UTC) */
|
|
629
643
|
expiresAt: string;
|
|
630
644
|
}
|
|
645
|
+
/**
|
|
646
|
+
* Parameters for anonymous checkout (visitor → shopper).
|
|
647
|
+
*
|
|
648
|
+
* The buyer enters the checkout page without a session token and fills in
|
|
649
|
+
* billing details manually. No identity is provided upfront.
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* const result = await client.checkout.anonymous.create({
|
|
653
|
+
* storeId: "STO_xxx",
|
|
654
|
+
* productId: "PROD_xxx",
|
|
655
|
+
* productType: "onetime",
|
|
656
|
+
* currency: "USD",
|
|
657
|
+
* });
|
|
658
|
+
* // Redirect to result.checkoutUrl
|
|
659
|
+
*/
|
|
660
|
+
interface AnonymousCheckoutParams {
|
|
661
|
+
/** Store ID */
|
|
662
|
+
storeId: string;
|
|
663
|
+
/** Product ID */
|
|
664
|
+
productId: string;
|
|
665
|
+
/** Product type */
|
|
666
|
+
productType: `${CheckoutSessionProductType}`;
|
|
667
|
+
/** Currency code (ISO 4217) */
|
|
668
|
+
currency: string;
|
|
669
|
+
/** Optional price snapshot override (reads from DB if omitted) */
|
|
670
|
+
priceSnapshot?: PriceInfo;
|
|
671
|
+
/** Trial toggle override (subscription only) */
|
|
672
|
+
withTrial?: boolean;
|
|
673
|
+
/** Redirect URL after successful payment */
|
|
674
|
+
successUrl?: string;
|
|
675
|
+
/** Session expiration in seconds (default: 45 minutes) */
|
|
676
|
+
expiresInSeconds?: number;
|
|
677
|
+
/** Dark mode override (true=dark, false=light, omit=use store default) */
|
|
678
|
+
darkMode?: boolean;
|
|
679
|
+
/** Custom metadata */
|
|
680
|
+
metadata?: Record<string, string>;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Parameters for authenticated checkout (customer).
|
|
684
|
+
*
|
|
685
|
+
* The merchant provides a buyer identity; the SDK issues a session token
|
|
686
|
+
* and appends it to the checkout URL as a URL fragment.
|
|
687
|
+
*
|
|
688
|
+
* @example
|
|
689
|
+
* const result = await client.checkout.authenticated.create({
|
|
690
|
+
* storeId: "STO_xxx",
|
|
691
|
+
* productId: "PROD_xxx",
|
|
692
|
+
* productType: "onetime",
|
|
693
|
+
* currency: "USD",
|
|
694
|
+
* buyerIdentity: "customer@example.com",
|
|
695
|
+
* });
|
|
696
|
+
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
697
|
+
*/
|
|
698
|
+
interface AuthenticatedCheckoutParams {
|
|
699
|
+
/** Store ID */
|
|
700
|
+
storeId: string;
|
|
701
|
+
/** Product ID */
|
|
702
|
+
productId: string;
|
|
703
|
+
/** Product type */
|
|
704
|
+
productType: `${CheckoutSessionProductType}`;
|
|
705
|
+
/** Currency code (ISO 4217) */
|
|
706
|
+
currency: string;
|
|
707
|
+
/** Buyer identity (email or merchant-provided identifier) */
|
|
708
|
+
buyerIdentity: string;
|
|
709
|
+
/** Pre-filled buyer email (defaults to `buyerIdentity` when omitted) */
|
|
710
|
+
buyerEmail?: string;
|
|
711
|
+
/** Pre-filled billing details */
|
|
712
|
+
billingDetail?: BillingDetail;
|
|
713
|
+
/** Optional price snapshot override (reads from DB if omitted) */
|
|
714
|
+
priceSnapshot?: PriceInfo;
|
|
715
|
+
/** Trial toggle override (subscription only) */
|
|
716
|
+
withTrial?: boolean;
|
|
717
|
+
/** Redirect URL after successful payment */
|
|
718
|
+
successUrl?: string;
|
|
719
|
+
/** Session expiration in seconds (default: 45 minutes) */
|
|
720
|
+
expiresInSeconds?: number;
|
|
721
|
+
/** Dark mode override (true=dark, false=light, omit=use store default) */
|
|
722
|
+
darkMode?: boolean;
|
|
723
|
+
/** Custom metadata */
|
|
724
|
+
metadata?: Record<string, string>;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Result of an authenticated checkout creation.
|
|
728
|
+
*
|
|
729
|
+
* Extends the base session result with the issued token details.
|
|
730
|
+
*/
|
|
731
|
+
interface AuthenticatedCheckoutResult {
|
|
732
|
+
/** Session ID */
|
|
733
|
+
sessionId: string;
|
|
734
|
+
/** Checkout URL with session token appended as URL fragment (`#token=...`) */
|
|
735
|
+
checkoutUrl: string;
|
|
736
|
+
/** Session expiration time (ISO 8601 UTC) */
|
|
737
|
+
expiresAt: string;
|
|
738
|
+
/** Issued JWT token */
|
|
739
|
+
token: string;
|
|
740
|
+
/** Token expiration time (ISO 8601 UTC) */
|
|
741
|
+
tokenExpiresAt: string;
|
|
742
|
+
}
|
|
631
743
|
/** Parameters for a GraphQL query. */
|
|
632
744
|
interface GraphQLParams {
|
|
633
745
|
/** GraphQL query string */
|
|
@@ -681,10 +793,10 @@ interface WebhookEventData {
|
|
|
681
793
|
orderId: string;
|
|
682
794
|
buyerEmail: string;
|
|
683
795
|
currency: string;
|
|
684
|
-
/** Amount
|
|
685
|
-
amount:
|
|
686
|
-
/** Tax amount
|
|
687
|
-
taxAmount:
|
|
796
|
+
/** Amount as display string (e.g., "9.99" for USD, "1000" for JPY) */
|
|
797
|
+
amount: string;
|
|
798
|
+
/** Tax amount as display string (e.g., "0.91" for USD) */
|
|
799
|
+
taxAmount: string;
|
|
688
800
|
productName: string;
|
|
689
801
|
}
|
|
690
802
|
/**
|
|
@@ -697,8 +809,8 @@ interface WebhookEventData {
|
|
|
697
809
|
* id: "550e8400-...",
|
|
698
810
|
* timestamp: "2026-03-10T08:30:00.000Z",
|
|
699
811
|
* eventType: "order.completed",
|
|
700
|
-
* eventId: "
|
|
701
|
-
* storeId: "
|
|
812
|
+
* eventId: "PAY_5xK9mRtYvWnPqLsJ3hBfDe",
|
|
813
|
+
* storeId: "STO_2aUyqjCzEIiEcYMKj7TZtw",
|
|
702
814
|
* mode: "prod",
|
|
703
815
|
* data: { orderId: "...", buyerEmail: "...", currency: "USD", amount: 2900, taxAmount: 290, productName: "Pro Plan" }
|
|
704
816
|
* }
|
|
@@ -766,6 +878,9 @@ interface VerifyWebhookOptions {
|
|
|
766
878
|
/**
|
|
767
879
|
* Internal HTTP client that auto-signs requests and attaches idempotency keys.
|
|
768
880
|
*
|
|
881
|
+
* The `X-Merchant-Id` header is sent in `MER_{base62}` format as provided by the user.
|
|
882
|
+
* The gateway decodes it to a raw UUID before forwarding to downstream services.
|
|
883
|
+
*
|
|
769
884
|
* Not exported publicly — used by resource classes via {@link WaffoPancake}.
|
|
770
885
|
*/
|
|
771
886
|
declare class HttpClient {
|
|
@@ -802,27 +917,124 @@ declare class AuthResource {
|
|
|
802
917
|
*
|
|
803
918
|
* @example
|
|
804
919
|
* const { token, expiresAt } = await client.auth.issueSessionToken({
|
|
805
|
-
* storeId: "
|
|
920
|
+
* storeId: "STO_xxx",
|
|
806
921
|
* buyerIdentity: "customer@example.com",
|
|
807
922
|
* });
|
|
808
923
|
*/
|
|
809
924
|
issueSessionToken(params: IssueSessionTokenParams): Promise<SessionToken>;
|
|
810
925
|
}
|
|
811
926
|
|
|
812
|
-
/**
|
|
927
|
+
/**
|
|
928
|
+
* Anonymous checkout — visitor enters without a session token.
|
|
929
|
+
*
|
|
930
|
+
* The buyer fills in billing details manually on the checkout page.
|
|
931
|
+
* Internally creates a checkout session and returns the redirect URL.
|
|
932
|
+
*/
|
|
933
|
+
declare class CheckoutAnonymousResource {
|
|
934
|
+
private readonly http;
|
|
935
|
+
constructor(http: HttpClient);
|
|
936
|
+
/**
|
|
937
|
+
* Create an anonymous checkout session.
|
|
938
|
+
*
|
|
939
|
+
* @param params - Checkout parameters (no buyer identity required)
|
|
940
|
+
* @returns Session ID, checkout URL, and expiration
|
|
941
|
+
*
|
|
942
|
+
* @example
|
|
943
|
+
* const result = await client.checkout.anonymous.create({
|
|
944
|
+
* storeId: "STO_xxx",
|
|
945
|
+
* productId: "PROD_xxx",
|
|
946
|
+
* productType: "onetime",
|
|
947
|
+
* currency: "USD",
|
|
948
|
+
* });
|
|
949
|
+
* // Redirect to result.checkoutUrl
|
|
950
|
+
*/
|
|
951
|
+
create(params: AnonymousCheckoutParams): Promise<CheckoutSessionResult>;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Authenticated checkout — merchant provides buyer identity.
|
|
956
|
+
*
|
|
957
|
+
* Issues a session token, creates a checkout session, and returns a
|
|
958
|
+
* checkout URL with the token appended as a URL fragment (`#token=...`).
|
|
959
|
+
* The checkout page reads the fragment to pre-fill buyer information.
|
|
960
|
+
*/
|
|
961
|
+
declare class CheckoutAuthenticatedResource {
|
|
962
|
+
private readonly http;
|
|
963
|
+
constructor(http: HttpClient);
|
|
964
|
+
/**
|
|
965
|
+
* Create an authenticated checkout session.
|
|
966
|
+
*
|
|
967
|
+
* Behavior:
|
|
968
|
+
* - Issues a session token via `issue-session-token`
|
|
969
|
+
* - Creates a checkout session via `create-session`
|
|
970
|
+
* - Appends the token to the checkout URL as a URL fragment
|
|
971
|
+
* - Defaults `buyerEmail` to `buyerIdentity` when omitted
|
|
972
|
+
*
|
|
973
|
+
* @param params - Checkout parameters including buyer identity
|
|
974
|
+
* @returns Session details with token-appended checkout URL
|
|
975
|
+
*
|
|
976
|
+
* @example
|
|
977
|
+
* const result = await client.checkout.authenticated.create({
|
|
978
|
+
* storeId: "STO_xxx",
|
|
979
|
+
* productId: "PROD_xxx",
|
|
980
|
+
* productType: "onetime",
|
|
981
|
+
* currency: "USD",
|
|
982
|
+
* buyerIdentity: "customer@example.com",
|
|
983
|
+
* });
|
|
984
|
+
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
985
|
+
*/
|
|
986
|
+
create(params: AuthenticatedCheckoutParams): Promise<AuthenticatedCheckoutResult>;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Checkout resource — create checkout sessions for payments.
|
|
991
|
+
*
|
|
992
|
+
* Provides two convenience sub-resources for the common checkout flows:
|
|
993
|
+
* - `anonymous` — visitor enters without identity (empty form)
|
|
994
|
+
* - `authenticated` — merchant provides buyer identity (pre-filled form + token)
|
|
995
|
+
*
|
|
996
|
+
* The low-level `createSession()` method is still available for full control.
|
|
997
|
+
*
|
|
998
|
+
* @example
|
|
999
|
+
* // Anonymous checkout (visitor → shopper)
|
|
1000
|
+
* const result = await client.checkout.anonymous.create({
|
|
1001
|
+
* storeId: "STO_xxx",
|
|
1002
|
+
* productId: "PROD_xxx",
|
|
1003
|
+
* productType: "onetime",
|
|
1004
|
+
* currency: "USD",
|
|
1005
|
+
* });
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* // Authenticated checkout (customer)
|
|
1009
|
+
* const result = await client.checkout.authenticated.create({
|
|
1010
|
+
* storeId: "STO_xxx",
|
|
1011
|
+
* productId: "PROD_xxx",
|
|
1012
|
+
* productType: "onetime",
|
|
1013
|
+
* currency: "USD",
|
|
1014
|
+
* buyerIdentity: "customer@example.com",
|
|
1015
|
+
* });
|
|
1016
|
+
* // result.checkoutUrl includes #token=...
|
|
1017
|
+
*/
|
|
813
1018
|
declare class CheckoutResource {
|
|
814
1019
|
private readonly http;
|
|
1020
|
+
/** Anonymous checkout — visitor enters without a session token. */
|
|
1021
|
+
readonly anonymous: CheckoutAnonymousResource;
|
|
1022
|
+
/** Authenticated checkout — merchant provides buyer identity. */
|
|
1023
|
+
readonly authenticated: CheckoutAuthenticatedResource;
|
|
815
1024
|
constructor(http: HttpClient);
|
|
816
1025
|
/**
|
|
817
|
-
* Create a checkout session. Returns a URL to redirect the customer to.
|
|
1026
|
+
* Create a checkout session (low-level). Returns a URL to redirect the customer to.
|
|
1027
|
+
*
|
|
1028
|
+
* For most use cases, prefer `checkout.anonymous.create()` or
|
|
1029
|
+
* `checkout.authenticated.create()` which handle the full flow automatically.
|
|
818
1030
|
*
|
|
819
1031
|
* @param params - Checkout session parameters
|
|
820
1032
|
* @returns Session ID, checkout URL, and expiration
|
|
821
1033
|
*
|
|
822
1034
|
* @example
|
|
823
1035
|
* const session = await client.checkout.createSession({
|
|
824
|
-
* storeId: "
|
|
825
|
-
* productId: "
|
|
1036
|
+
* storeId: "STO_xxx",
|
|
1037
|
+
* productId: "PROD_xxx",
|
|
826
1038
|
* productType: "onetime",
|
|
827
1039
|
* currency: "USD",
|
|
828
1040
|
* buyerEmail: "customer@example.com",
|
|
@@ -851,7 +1063,7 @@ declare class GraphQLResource {
|
|
|
851
1063
|
* @example
|
|
852
1064
|
* const result = await client.graphql.query({
|
|
853
1065
|
* query: `query ($id: ID!) { onetimeProduct(id: $id) { id name prices } }`,
|
|
854
|
-
* variables: { id: "
|
|
1066
|
+
* variables: { id: "PROD_xxx" },
|
|
855
1067
|
* });
|
|
856
1068
|
*/
|
|
857
1069
|
query<T = Record<string, unknown>>(params: GraphQLParams): Promise<GraphQLResponse<T>>;
|
|
@@ -869,9 +1081,9 @@ declare class OnetimeProductsResource {
|
|
|
869
1081
|
*
|
|
870
1082
|
* @example
|
|
871
1083
|
* const { product } = await client.onetimeProducts.create({
|
|
872
|
-
* storeId: "
|
|
1084
|
+
* storeId: "STO_xxx",
|
|
873
1085
|
* name: "E-Book",
|
|
874
|
-
* prices: { USD: { amount:
|
|
1086
|
+
* prices: { USD: { amount: "29.00", taxCategory: "digital_goods" } },
|
|
875
1087
|
* });
|
|
876
1088
|
*/
|
|
877
1089
|
create(params: CreateOnetimeProductParams): Promise<{
|
|
@@ -885,9 +1097,9 @@ declare class OnetimeProductsResource {
|
|
|
885
1097
|
*
|
|
886
1098
|
* @example
|
|
887
1099
|
* const { product } = await client.onetimeProducts.update({
|
|
888
|
-
* id: "
|
|
1100
|
+
* id: "PROD_xxx",
|
|
889
1101
|
* name: "E-Book v2",
|
|
890
|
-
* prices: { USD: { amount:
|
|
1102
|
+
* prices: { USD: { amount: "39.00", taxCategory: "digital_goods" } },
|
|
891
1103
|
* });
|
|
892
1104
|
*/
|
|
893
1105
|
update(params: UpdateOnetimeProductParams): Promise<{
|
|
@@ -900,7 +1112,7 @@ declare class OnetimeProductsResource {
|
|
|
900
1112
|
* @returns Published product detail
|
|
901
1113
|
*
|
|
902
1114
|
* @example
|
|
903
|
-
* const { product } = await client.onetimeProducts.publish({ id: "
|
|
1115
|
+
* const { product } = await client.onetimeProducts.publish({ id: "PROD_xxx" });
|
|
904
1116
|
*/
|
|
905
1117
|
publish(params: PublishOnetimeProductParams): Promise<{
|
|
906
1118
|
product: OnetimeProductDetail;
|
|
@@ -913,7 +1125,7 @@ declare class OnetimeProductsResource {
|
|
|
913
1125
|
*
|
|
914
1126
|
* @example
|
|
915
1127
|
* const { product } = await client.onetimeProducts.updateStatus({
|
|
916
|
-
* id: "
|
|
1128
|
+
* id: "PROD_xxx",
|
|
917
1129
|
* status: ProductVersionStatus.Inactive,
|
|
918
1130
|
* });
|
|
919
1131
|
*/
|
|
@@ -937,7 +1149,7 @@ declare class OrdersResource {
|
|
|
937
1149
|
*
|
|
938
1150
|
* @example
|
|
939
1151
|
* const { orderId, status } = await client.orders.cancelSubscription({
|
|
940
|
-
* orderId: "
|
|
1152
|
+
* orderId: "ORD_xxx",
|
|
941
1153
|
* });
|
|
942
1154
|
* // status: "canceled" or "canceling"
|
|
943
1155
|
*/
|
|
@@ -956,7 +1168,7 @@ declare class StoreMerchantsResource {
|
|
|
956
1168
|
*
|
|
957
1169
|
* @example
|
|
958
1170
|
* const result = await client.storeMerchants.add({
|
|
959
|
-
* storeId: "
|
|
1171
|
+
* storeId: "STO_xxx",
|
|
960
1172
|
* email: "member@example.com",
|
|
961
1173
|
* role: "admin",
|
|
962
1174
|
* });
|
|
@@ -970,8 +1182,8 @@ declare class StoreMerchantsResource {
|
|
|
970
1182
|
*
|
|
971
1183
|
* @example
|
|
972
1184
|
* const result = await client.storeMerchants.remove({
|
|
973
|
-
* storeId: "
|
|
974
|
-
* merchantId: "
|
|
1185
|
+
* storeId: "STO_xxx",
|
|
1186
|
+
* merchantId: "MER_xxx",
|
|
975
1187
|
* });
|
|
976
1188
|
*/
|
|
977
1189
|
remove(params: RemoveMerchantParams): Promise<RemoveMerchantResult>;
|
|
@@ -983,8 +1195,8 @@ declare class StoreMerchantsResource {
|
|
|
983
1195
|
*
|
|
984
1196
|
* @example
|
|
985
1197
|
* const result = await client.storeMerchants.updateRole({
|
|
986
|
-
* storeId: "
|
|
987
|
-
* merchantId: "
|
|
1198
|
+
* storeId: "STO_xxx",
|
|
1199
|
+
* merchantId: "MER_xxx",
|
|
988
1200
|
* role: "member",
|
|
989
1201
|
* });
|
|
990
1202
|
*/
|
|
@@ -1015,7 +1227,7 @@ declare class StoresResource {
|
|
|
1015
1227
|
*
|
|
1016
1228
|
* @example
|
|
1017
1229
|
* const { store } = await client.stores.update({
|
|
1018
|
-
* id: "
|
|
1230
|
+
* id: "STO_xxx",
|
|
1019
1231
|
* name: "Updated Name",
|
|
1020
1232
|
* });
|
|
1021
1233
|
*/
|
|
@@ -1029,7 +1241,7 @@ declare class StoresResource {
|
|
|
1029
1241
|
* @returns Deleted store entity (with `deletedAt` set)
|
|
1030
1242
|
*
|
|
1031
1243
|
* @example
|
|
1032
|
-
* const { store } = await client.stores.delete({ id: "
|
|
1244
|
+
* const { store } = await client.stores.delete({ id: "STO_xxx" });
|
|
1033
1245
|
*/
|
|
1034
1246
|
delete(params: DeleteStoreParams): Promise<{
|
|
1035
1247
|
store: Store;
|
|
@@ -1048,10 +1260,10 @@ declare class SubscriptionProductGroupsResource {
|
|
|
1048
1260
|
*
|
|
1049
1261
|
* @example
|
|
1050
1262
|
* const { group } = await client.subscriptionProductGroups.create({
|
|
1051
|
-
* storeId: "
|
|
1263
|
+
* storeId: "STO_xxx",
|
|
1052
1264
|
* name: "Pro Plans",
|
|
1053
1265
|
* rules: { sharedTrial: true },
|
|
1054
|
-
* productIds: ["
|
|
1266
|
+
* productIds: ["PROD_aaa", "PROD_bbb"],
|
|
1055
1267
|
* });
|
|
1056
1268
|
*/
|
|
1057
1269
|
create(params: CreateSubscriptionProductGroupParams): Promise<{
|
|
@@ -1065,8 +1277,8 @@ declare class SubscriptionProductGroupsResource {
|
|
|
1065
1277
|
*
|
|
1066
1278
|
* @example
|
|
1067
1279
|
* const { group } = await client.subscriptionProductGroups.update({
|
|
1068
|
-
* id: "
|
|
1069
|
-
* productIds: ["
|
|
1280
|
+
* id: "GRP_xxx",
|
|
1281
|
+
* productIds: ["PROD_aaa", "PROD_bbb", "PROD_ccc"],
|
|
1070
1282
|
* });
|
|
1071
1283
|
*/
|
|
1072
1284
|
update(params: UpdateSubscriptionProductGroupParams): Promise<{
|
|
@@ -1079,7 +1291,7 @@ declare class SubscriptionProductGroupsResource {
|
|
|
1079
1291
|
* @returns Deleted group entity
|
|
1080
1292
|
*
|
|
1081
1293
|
* @example
|
|
1082
|
-
* const { group } = await client.subscriptionProductGroups.delete({ id: "
|
|
1294
|
+
* const { group } = await client.subscriptionProductGroups.delete({ id: "GRP_xxx" });
|
|
1083
1295
|
*/
|
|
1084
1296
|
delete(params: DeleteSubscriptionProductGroupParams): Promise<{
|
|
1085
1297
|
group: SubscriptionProductGroup;
|
|
@@ -1091,7 +1303,7 @@ declare class SubscriptionProductGroupsResource {
|
|
|
1091
1303
|
* @returns Published group entity
|
|
1092
1304
|
*
|
|
1093
1305
|
* @example
|
|
1094
|
-
* const { group } = await client.subscriptionProductGroups.publish({ id: "
|
|
1306
|
+
* const { group } = await client.subscriptionProductGroups.publish({ id: "GRP_xxx" });
|
|
1095
1307
|
*/
|
|
1096
1308
|
publish(params: PublishSubscriptionProductGroupParams): Promise<{
|
|
1097
1309
|
group: SubscriptionProductGroup;
|
|
@@ -1110,10 +1322,10 @@ declare class SubscriptionProductsResource {
|
|
|
1110
1322
|
*
|
|
1111
1323
|
* @example
|
|
1112
1324
|
* const { product } = await client.subscriptionProducts.create({
|
|
1113
|
-
* storeId: "
|
|
1325
|
+
* storeId: "STO_xxx",
|
|
1114
1326
|
* name: "Pro Plan",
|
|
1115
1327
|
* billingPeriod: "monthly",
|
|
1116
|
-
* prices: { USD: { amount:
|
|
1328
|
+
* prices: { USD: { amount: "9.99", taxCategory: "saas" } },
|
|
1117
1329
|
* });
|
|
1118
1330
|
*/
|
|
1119
1331
|
create(params: CreateSubscriptionProductParams): Promise<{
|
|
@@ -1127,10 +1339,10 @@ declare class SubscriptionProductsResource {
|
|
|
1127
1339
|
*
|
|
1128
1340
|
* @example
|
|
1129
1341
|
* const { product } = await client.subscriptionProducts.update({
|
|
1130
|
-
* id: "
|
|
1342
|
+
* id: "PROD_xxx",
|
|
1131
1343
|
* name: "Pro Plan v2",
|
|
1132
1344
|
* billingPeriod: "monthly",
|
|
1133
|
-
* prices: { USD: { amount:
|
|
1345
|
+
* prices: { USD: { amount: "14.99", taxCategory: "saas" } },
|
|
1134
1346
|
* });
|
|
1135
1347
|
*/
|
|
1136
1348
|
update(params: UpdateSubscriptionProductParams): Promise<{
|
|
@@ -1143,7 +1355,7 @@ declare class SubscriptionProductsResource {
|
|
|
1143
1355
|
* @returns Published product detail
|
|
1144
1356
|
*
|
|
1145
1357
|
* @example
|
|
1146
|
-
* const { product } = await client.subscriptionProducts.publish({ id: "
|
|
1358
|
+
* const { product } = await client.subscriptionProducts.publish({ id: "PROD_xxx" });
|
|
1147
1359
|
*/
|
|
1148
1360
|
publish(params: PublishSubscriptionProductParams): Promise<{
|
|
1149
1361
|
product: SubscriptionProductDetail;
|
|
@@ -1156,7 +1368,7 @@ declare class SubscriptionProductsResource {
|
|
|
1156
1368
|
*
|
|
1157
1369
|
* @example
|
|
1158
1370
|
* const { product } = await client.subscriptionProducts.updateStatus({
|
|
1159
|
-
* id: "
|
|
1371
|
+
* id: "PROD_xxx",
|
|
1160
1372
|
* status: ProductVersionStatus.Active,
|
|
1161
1373
|
* });
|
|
1162
1374
|
*/
|
|
@@ -1215,19 +1427,21 @@ declare class WebhooksResource {
|
|
|
1215
1427
|
* import { WaffoPancake } from "@waffo/pancake-ts";
|
|
1216
1428
|
*
|
|
1217
1429
|
* const client = new WaffoPancake({
|
|
1218
|
-
* merchantId:
|
|
1430
|
+
* merchantId: "MER_2D5F8G3H1K4M6N9P0Q7R8S", // MER_{base62} format
|
|
1219
1431
|
* privateKey: process.env.WAFFO_PRIVATE_KEY!,
|
|
1220
1432
|
* });
|
|
1221
1433
|
*
|
|
1222
|
-
* // Create a store
|
|
1434
|
+
* // Create a store — IDs are returned in {prefix}_{base62} format
|
|
1223
1435
|
* const { store } = await client.stores.create({ name: "My Store" });
|
|
1436
|
+
* // => store.id = "STO_..."
|
|
1224
1437
|
*
|
|
1225
1438
|
* // Create a product
|
|
1226
1439
|
* const { product } = await client.onetimeProducts.create({
|
|
1227
|
-
* storeId: store.id,
|
|
1440
|
+
* storeId: store.id, // "STO_..."
|
|
1228
1441
|
* name: "E-Book",
|
|
1229
1442
|
* prices: { USD: { amount: 2900, taxCategory: "digital_goods" } },
|
|
1230
1443
|
* });
|
|
1444
|
+
* // => product.id = "PROD_..."
|
|
1231
1445
|
*
|
|
1232
1446
|
* // Create a checkout session
|
|
1233
1447
|
* const session = await client.checkout.createSession({
|
|
@@ -1346,4 +1560,4 @@ declare class WaffoPancakeError extends Error {
|
|
|
1346
1560
|
*/
|
|
1347
1561
|
declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
|
|
1348
1562
|
|
|
1349
|
-
export { type AddMerchantParams, type AddMerchantResult, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type BillingDetail, BillingPeriod, type CancelSubscriptionParams, type CancelSubscriptionResult, CheckoutSessionProductType, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, RefundStatus, RefundTicketStatus, type RemoveMerchantParams, type RemoveMerchantResult, type SessionToken, type Store, StoreRole, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, type WebhookSettings, verifyWebhook };
|
|
1563
|
+
export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelSubscriptionParams, type CancelSubscriptionResult, CheckoutSessionProductType, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, RefundStatus, RefundTicketStatus, type RemoveMerchantParams, type RemoveMerchantResult, type SessionToken, type Store, StoreRole, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, type WebhookSettings, verifyWebhook };
|