@waffo/pancake-ts 0.3.4 → 0.4.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/dist/index.d.cts CHANGED
@@ -211,7 +211,12 @@ declare enum ErrorLayer {
211
211
  * @see waffo-pancake-user-service/app/lib/utils/jwt.ts IssueSessionTokenRequest
212
212
  */
213
213
  interface IssueSessionTokenParams {
214
- /** Buyer identity (email or any merchant-provided identifier string) */
214
+ /**
215
+ * Buyer identity — encoded into the JWT payload for merchant-side buyer
216
+ * identification. Accepts an email or any merchant-provided identifier string.
217
+ * To pre-fill the checkout page's email field, use `buyerEmail` on
218
+ * `checkout.authenticated.create`.
219
+ */
215
220
  buyerIdentity: string;
216
221
  /** Store ID (optional when `productId` is provided) */
217
222
  storeId?: string;
@@ -690,6 +695,16 @@ interface RequestedAmount {
690
695
  /** Currency code (ISO 4217) */
691
696
  currency: string;
692
697
  }
698
+ /**
699
+ * Per-version data for a refund ticket. Each ticket can be submitted/resubmitted
700
+ * multiple times; this is the shape of a single submission.
701
+ */
702
+ interface RefundTicketVersionData {
703
+ /** Refund reason supplied by the buyer */
704
+ reason: string;
705
+ /** Requested refund amount; `null` if the version has no amount recorded */
706
+ requestedAmount: RequestedAmount | null;
707
+ }
693
708
  /** Parameters for creating a refund ticket (buyer-side). */
694
709
  interface CreateRefundTicketParams {
695
710
  /** Payment ID to refund */
@@ -742,8 +757,8 @@ interface RefundTicket {
742
757
  metadata: Record<string, unknown>;
743
758
  /** Current version number */
744
759
  versionNumber: number | null;
745
- /** Current version data (includes reason, amount, etc.) */
746
- versionData: Record<string, unknown> | null;
760
+ /** Current (latest) version data */
761
+ versionData: RefundTicketVersionData | null;
747
762
  /** Creation timestamp (ISO 8601) */
748
763
  createdAt: string;
749
764
  /** Last update timestamp (ISO 8601) */
@@ -752,8 +767,11 @@ interface RefundTicket {
752
767
  /**
753
768
  * Parameters for anonymous checkout.
754
769
  *
755
- * The buyer enters the checkout page without a session token and fills in
756
- * billing details manually. No identity is provided upfront.
770
+ * The buyer reaches the checkout page without a session token. Merchants may still
771
+ * pre-fill `buyerEmail` and `billingDetail`; omitting them leaves the form blank.
772
+ *
773
+ * Accepts every field of {@link CreateCheckoutSessionParams} — this wrapper simply
774
+ * forwards the params unchanged to `/v1/actions/checkout/create-session`.
757
775
  *
758
776
  * @example
759
777
  * const result = await client.checkout.anonymous.create({
@@ -762,61 +780,32 @@ interface RefundTicket {
762
780
  * });
763
781
  * // Redirect to result.checkoutUrl
764
782
  */
765
- interface AnonymousCheckoutParams {
766
- /** Product ID */
767
- productId: string;
768
- /** Currency code (ISO 4217) */
769
- currency: string;
770
- /** Optional price snapshot override (reads from DB if omitted) */
771
- priceSnapshot?: PriceInfo;
772
- /** Trial toggle override (subscription only) */
773
- withTrial?: boolean;
774
- /** Redirect URL after successful payment */
775
- successUrl?: string;
776
- /** Session expiration in seconds (default: 45 minutes) */
777
- expiresInSeconds?: number;
778
- /** Dark mode override (true=dark, false=light, omit=use store default) */
779
- darkMode?: boolean;
780
- /** Custom metadata */
781
- metadata?: Record<string, string>;
782
- }
783
+ type AnonymousCheckoutParams = CreateCheckoutSessionParams;
783
784
  /**
784
785
  * Parameters for authenticated checkout.
785
786
  *
786
- * The merchant provides a buyer identity; the SDK issues a session token
787
- * and appends it to the checkout URL as a URL fragment.
787
+ * Merges the checkout-session fields ({@link CreateCheckoutSessionParams}) with the
788
+ * extra `buyerIdentity` required by `issue-session-token`. The wrapper splits the
789
+ * input: `buyerIdentity` goes to the token call; everything else (including
790
+ * `buyerEmail`) goes to the create-session call. The two fields are independent.
788
791
  *
789
792
  * @example
790
793
  * const result = await client.checkout.authenticated.create({
791
794
  * productId: "PROD_xxx",
792
795
  * currency: "USD",
793
- * buyerIdentity: "customer@example.com",
796
+ * buyerIdentity: "user-123", // merchant-side buyer id (goes into JWT)
797
+ * buyerEmail: "customer@example.com", // pre-filled on the checkout page
794
798
  * });
795
799
  * // Redirect to result.checkoutUrl (includes #token=...)
796
800
  */
797
- interface AuthenticatedCheckoutParams {
798
- /** Product ID */
799
- productId: string;
800
- /** Currency code (ISO 4217) */
801
- currency: string;
802
- /** Buyer identity (email or merchant-provided identifier) */
801
+ interface AuthenticatedCheckoutParams extends CreateCheckoutSessionParams {
802
+ /**
803
+ * Buyer identity — sent to `issue-session-token` and encoded into the JWT
804
+ * payload for merchant-side buyer identification. Accepts an email or any
805
+ * merchant-provided identifier string. Use `buyerEmail` to pre-fill the
806
+ * checkout page's email input.
807
+ */
803
808
  buyerIdentity: string;
804
- /** Pre-filled buyer email (defaults to `buyerIdentity` when omitted) */
805
- buyerEmail?: string;
806
- /** Pre-filled billing details */
807
- billingDetail?: BillingDetail;
808
- /** Optional price snapshot override (reads from DB if omitted) */
809
- priceSnapshot?: PriceInfo;
810
- /** Trial toggle override (subscription only) */
811
- withTrial?: boolean;
812
- /** Redirect URL after successful payment */
813
- successUrl?: string;
814
- /** Session expiration in seconds (default: 45 minutes) */
815
- expiresInSeconds?: number;
816
- /** Dark mode override (true=dark, false=light, omit=use store default) */
817
- darkMode?: boolean;
818
- /** Custom metadata */
819
- metadata?: Record<string, string>;
820
809
  }
821
810
  /**
822
811
  * Result of an authenticated checkout creation.
@@ -1163,7 +1152,8 @@ declare class BuyerGraphQL {
1163
1152
  /**
1164
1153
  * Anonymous checkout — no buyer identity provided.
1165
1154
  *
1166
- * The buyer fills in billing details manually on the checkout page.
1155
+ * The buyer reaches the checkout page without a session token. Merchants may still
1156
+ * pre-fill `buyerEmail` and `billingDetail` on the page by passing them here.
1167
1157
  * Internally creates a checkout session and returns the redirect URL.
1168
1158
  */
1169
1159
  declare class CheckoutAnonymousResource {
@@ -1176,11 +1166,20 @@ declare class CheckoutAnonymousResource {
1176
1166
  * @returns Session ID, checkout URL, and expiration
1177
1167
  *
1178
1168
  * @example
1169
+ * // Minimal — buyer fills everything on the page
1170
+ * const result = await client.checkout.anonymous.create({
1171
+ * productId: "PROD_xxx",
1172
+ * currency: "USD",
1173
+ * });
1174
+ *
1175
+ * @example
1176
+ * // Pre-fill email and billing without issuing a session token
1179
1177
  * const result = await client.checkout.anonymous.create({
1180
1178
  * productId: "PROD_xxx",
1181
1179
  * currency: "USD",
1180
+ * buyerEmail: "customer@example.com",
1181
+ * billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
1182
1182
  * });
1183
- * // Redirect to result.checkoutUrl
1184
1183
  */
1185
1184
  create(params: AnonymousCheckoutParams): Promise<CheckoutSessionResult>;
1186
1185
  }
@@ -1199,10 +1198,12 @@ declare class CheckoutAuthenticatedResource {
1199
1198
  * Create an authenticated checkout session.
1200
1199
  *
1201
1200
  * Behavior:
1202
- * - Issues a session token via `issue-session-token`
1203
- * - Creates a checkout session via `create-session`
1204
- * - Appends the token to the checkout URL as a URL fragment
1205
- * - Defaults `buyerEmail` to `buyerIdentity` when omitted
1201
+ * - Issues a session token via `issue-session-token` (receives `buyerIdentity` + `productId` only)
1202
+ * - Creates a checkout session via `create-session` (receives every other field unchanged)
1203
+ * - Appends the token to the checkout URL as a URL fragment (`#token=...`)
1204
+ *
1205
+ * `buyerIdentity` and `buyerEmail` are independent inputs: identity is for the JWT,
1206
+ * email is for pre-filling the checkout page. The SDK forwards each to its own endpoint.
1206
1207
  *
1207
1208
  * @param params - Checkout parameters including buyer identity
1208
1209
  * @returns Session details with token-appended checkout URL
@@ -1211,7 +1212,8 @@ declare class CheckoutAuthenticatedResource {
1211
1212
  * const result = await client.checkout.authenticated.create({
1212
1213
  * productId: "PROD_xxx",
1213
1214
  * currency: "USD",
1214
- * buyerIdentity: "customer@example.com",
1215
+ * buyerIdentity: "user-123",
1216
+ * buyerEmail: "customer@example.com",
1215
1217
  * });
1216
1218
  * // Redirect to result.checkoutUrl (includes #token=...)
1217
1219
  */
@@ -1239,7 +1241,8 @@ declare class CheckoutAuthenticatedResource {
1239
1241
  * const result = await client.checkout.authenticated.create({
1240
1242
  * productId: "PROD_xxx",
1241
1243
  * currency: "USD",
1242
- * buyerIdentity: "customer@example.com",
1244
+ * buyerIdentity: "userIdInYourSystem",
1245
+ * buyerEmail: "customer@example.com",
1243
1246
  * });
1244
1247
  * // result.checkoutUrl includes #token=...
1245
1248
  */
@@ -1830,4 +1833,4 @@ declare class WaffoPancakeError extends Error {
1830
1833
  */
1831
1834
  declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
1832
1835
 
1833
- export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, 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, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, 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 };
1836
+ export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, 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, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RefundTicketVersionData, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, 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 };
package/dist/index.d.ts CHANGED
@@ -211,7 +211,12 @@ declare enum ErrorLayer {
211
211
  * @see waffo-pancake-user-service/app/lib/utils/jwt.ts IssueSessionTokenRequest
212
212
  */
213
213
  interface IssueSessionTokenParams {
214
- /** Buyer identity (email or any merchant-provided identifier string) */
214
+ /**
215
+ * Buyer identity — encoded into the JWT payload for merchant-side buyer
216
+ * identification. Accepts an email or any merchant-provided identifier string.
217
+ * To pre-fill the checkout page's email field, use `buyerEmail` on
218
+ * `checkout.authenticated.create`.
219
+ */
215
220
  buyerIdentity: string;
216
221
  /** Store ID (optional when `productId` is provided) */
217
222
  storeId?: string;
@@ -690,6 +695,16 @@ interface RequestedAmount {
690
695
  /** Currency code (ISO 4217) */
691
696
  currency: string;
692
697
  }
698
+ /**
699
+ * Per-version data for a refund ticket. Each ticket can be submitted/resubmitted
700
+ * multiple times; this is the shape of a single submission.
701
+ */
702
+ interface RefundTicketVersionData {
703
+ /** Refund reason supplied by the buyer */
704
+ reason: string;
705
+ /** Requested refund amount; `null` if the version has no amount recorded */
706
+ requestedAmount: RequestedAmount | null;
707
+ }
693
708
  /** Parameters for creating a refund ticket (buyer-side). */
694
709
  interface CreateRefundTicketParams {
695
710
  /** Payment ID to refund */
@@ -742,8 +757,8 @@ interface RefundTicket {
742
757
  metadata: Record<string, unknown>;
743
758
  /** Current version number */
744
759
  versionNumber: number | null;
745
- /** Current version data (includes reason, amount, etc.) */
746
- versionData: Record<string, unknown> | null;
760
+ /** Current (latest) version data */
761
+ versionData: RefundTicketVersionData | null;
747
762
  /** Creation timestamp (ISO 8601) */
748
763
  createdAt: string;
749
764
  /** Last update timestamp (ISO 8601) */
@@ -752,8 +767,11 @@ interface RefundTicket {
752
767
  /**
753
768
  * Parameters for anonymous checkout.
754
769
  *
755
- * The buyer enters the checkout page without a session token and fills in
756
- * billing details manually. No identity is provided upfront.
770
+ * The buyer reaches the checkout page without a session token. Merchants may still
771
+ * pre-fill `buyerEmail` and `billingDetail`; omitting them leaves the form blank.
772
+ *
773
+ * Accepts every field of {@link CreateCheckoutSessionParams} — this wrapper simply
774
+ * forwards the params unchanged to `/v1/actions/checkout/create-session`.
757
775
  *
758
776
  * @example
759
777
  * const result = await client.checkout.anonymous.create({
@@ -762,61 +780,32 @@ interface RefundTicket {
762
780
  * });
763
781
  * // Redirect to result.checkoutUrl
764
782
  */
765
- interface AnonymousCheckoutParams {
766
- /** Product ID */
767
- productId: string;
768
- /** Currency code (ISO 4217) */
769
- currency: string;
770
- /** Optional price snapshot override (reads from DB if omitted) */
771
- priceSnapshot?: PriceInfo;
772
- /** Trial toggle override (subscription only) */
773
- withTrial?: boolean;
774
- /** Redirect URL after successful payment */
775
- successUrl?: string;
776
- /** Session expiration in seconds (default: 45 minutes) */
777
- expiresInSeconds?: number;
778
- /** Dark mode override (true=dark, false=light, omit=use store default) */
779
- darkMode?: boolean;
780
- /** Custom metadata */
781
- metadata?: Record<string, string>;
782
- }
783
+ type AnonymousCheckoutParams = CreateCheckoutSessionParams;
783
784
  /**
784
785
  * Parameters for authenticated checkout.
785
786
  *
786
- * The merchant provides a buyer identity; the SDK issues a session token
787
- * and appends it to the checkout URL as a URL fragment.
787
+ * Merges the checkout-session fields ({@link CreateCheckoutSessionParams}) with the
788
+ * extra `buyerIdentity` required by `issue-session-token`. The wrapper splits the
789
+ * input: `buyerIdentity` goes to the token call; everything else (including
790
+ * `buyerEmail`) goes to the create-session call. The two fields are independent.
788
791
  *
789
792
  * @example
790
793
  * const result = await client.checkout.authenticated.create({
791
794
  * productId: "PROD_xxx",
792
795
  * currency: "USD",
793
- * buyerIdentity: "customer@example.com",
796
+ * buyerIdentity: "user-123", // merchant-side buyer id (goes into JWT)
797
+ * buyerEmail: "customer@example.com", // pre-filled on the checkout page
794
798
  * });
795
799
  * // Redirect to result.checkoutUrl (includes #token=...)
796
800
  */
797
- interface AuthenticatedCheckoutParams {
798
- /** Product ID */
799
- productId: string;
800
- /** Currency code (ISO 4217) */
801
- currency: string;
802
- /** Buyer identity (email or merchant-provided identifier) */
801
+ interface AuthenticatedCheckoutParams extends CreateCheckoutSessionParams {
802
+ /**
803
+ * Buyer identity — sent to `issue-session-token` and encoded into the JWT
804
+ * payload for merchant-side buyer identification. Accepts an email or any
805
+ * merchant-provided identifier string. Use `buyerEmail` to pre-fill the
806
+ * checkout page's email input.
807
+ */
803
808
  buyerIdentity: string;
804
- /** Pre-filled buyer email (defaults to `buyerIdentity` when omitted) */
805
- buyerEmail?: string;
806
- /** Pre-filled billing details */
807
- billingDetail?: BillingDetail;
808
- /** Optional price snapshot override (reads from DB if omitted) */
809
- priceSnapshot?: PriceInfo;
810
- /** Trial toggle override (subscription only) */
811
- withTrial?: boolean;
812
- /** Redirect URL after successful payment */
813
- successUrl?: string;
814
- /** Session expiration in seconds (default: 45 minutes) */
815
- expiresInSeconds?: number;
816
- /** Dark mode override (true=dark, false=light, omit=use store default) */
817
- darkMode?: boolean;
818
- /** Custom metadata */
819
- metadata?: Record<string, string>;
820
809
  }
821
810
  /**
822
811
  * Result of an authenticated checkout creation.
@@ -1163,7 +1152,8 @@ declare class BuyerGraphQL {
1163
1152
  /**
1164
1153
  * Anonymous checkout — no buyer identity provided.
1165
1154
  *
1166
- * The buyer fills in billing details manually on the checkout page.
1155
+ * The buyer reaches the checkout page without a session token. Merchants may still
1156
+ * pre-fill `buyerEmail` and `billingDetail` on the page by passing them here.
1167
1157
  * Internally creates a checkout session and returns the redirect URL.
1168
1158
  */
1169
1159
  declare class CheckoutAnonymousResource {
@@ -1176,11 +1166,20 @@ declare class CheckoutAnonymousResource {
1176
1166
  * @returns Session ID, checkout URL, and expiration
1177
1167
  *
1178
1168
  * @example
1169
+ * // Minimal — buyer fills everything on the page
1170
+ * const result = await client.checkout.anonymous.create({
1171
+ * productId: "PROD_xxx",
1172
+ * currency: "USD",
1173
+ * });
1174
+ *
1175
+ * @example
1176
+ * // Pre-fill email and billing without issuing a session token
1179
1177
  * const result = await client.checkout.anonymous.create({
1180
1178
  * productId: "PROD_xxx",
1181
1179
  * currency: "USD",
1180
+ * buyerEmail: "customer@example.com",
1181
+ * billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
1182
1182
  * });
1183
- * // Redirect to result.checkoutUrl
1184
1183
  */
1185
1184
  create(params: AnonymousCheckoutParams): Promise<CheckoutSessionResult>;
1186
1185
  }
@@ -1199,10 +1198,12 @@ declare class CheckoutAuthenticatedResource {
1199
1198
  * Create an authenticated checkout session.
1200
1199
  *
1201
1200
  * Behavior:
1202
- * - Issues a session token via `issue-session-token`
1203
- * - Creates a checkout session via `create-session`
1204
- * - Appends the token to the checkout URL as a URL fragment
1205
- * - Defaults `buyerEmail` to `buyerIdentity` when omitted
1201
+ * - Issues a session token via `issue-session-token` (receives `buyerIdentity` + `productId` only)
1202
+ * - Creates a checkout session via `create-session` (receives every other field unchanged)
1203
+ * - Appends the token to the checkout URL as a URL fragment (`#token=...`)
1204
+ *
1205
+ * `buyerIdentity` and `buyerEmail` are independent inputs: identity is for the JWT,
1206
+ * email is for pre-filling the checkout page. The SDK forwards each to its own endpoint.
1206
1207
  *
1207
1208
  * @param params - Checkout parameters including buyer identity
1208
1209
  * @returns Session details with token-appended checkout URL
@@ -1211,7 +1212,8 @@ declare class CheckoutAuthenticatedResource {
1211
1212
  * const result = await client.checkout.authenticated.create({
1212
1213
  * productId: "PROD_xxx",
1213
1214
  * currency: "USD",
1214
- * buyerIdentity: "customer@example.com",
1215
+ * buyerIdentity: "user-123",
1216
+ * buyerEmail: "customer@example.com",
1215
1217
  * });
1216
1218
  * // Redirect to result.checkoutUrl (includes #token=...)
1217
1219
  */
@@ -1239,7 +1241,8 @@ declare class CheckoutAuthenticatedResource {
1239
1241
  * const result = await client.checkout.authenticated.create({
1240
1242
  * productId: "PROD_xxx",
1241
1243
  * currency: "USD",
1242
- * buyerIdentity: "customer@example.com",
1244
+ * buyerIdentity: "userIdInYourSystem",
1245
+ * buyerEmail: "customer@example.com",
1243
1246
  * });
1244
1247
  * // result.checkoutUrl includes #token=...
1245
1248
  */
@@ -1830,4 +1833,4 @@ declare class WaffoPancakeError extends Error {
1830
1833
  */
1831
1834
  declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
1832
1835
 
1833
- export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, 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, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, 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 };
1836
+ export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, 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, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RefundTicketVersionData, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, 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 };
package/dist/index.js CHANGED
@@ -464,11 +464,20 @@ var CheckoutAnonymousResource = class {
464
464
  * @returns Session ID, checkout URL, and expiration
465
465
  *
466
466
  * @example
467
+ * // Minimal — buyer fills everything on the page
467
468
  * const result = await client.checkout.anonymous.create({
468
469
  * productId: "PROD_xxx",
469
470
  * currency: "USD",
470
471
  * });
471
- * // Redirect to result.checkoutUrl
472
+ *
473
+ * @example
474
+ * // Pre-fill email and billing without issuing a session token
475
+ * const result = await client.checkout.anonymous.create({
476
+ * productId: "PROD_xxx",
477
+ * currency: "USD",
478
+ * buyerEmail: "customer@example.com",
479
+ * billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
480
+ * });
472
481
  */
473
482
  async create(params) {
474
483
  validateCheckoutCommon(params);
@@ -485,10 +494,12 @@ var CheckoutAuthenticatedResource = class {
485
494
  * Create an authenticated checkout session.
486
495
  *
487
496
  * Behavior:
488
- * - Issues a session token via `issue-session-token`
489
- * - Creates a checkout session via `create-session`
490
- * - Appends the token to the checkout URL as a URL fragment
491
- * - Defaults `buyerEmail` to `buyerIdentity` when omitted
497
+ * - Issues a session token via `issue-session-token` (receives `buyerIdentity` + `productId` only)
498
+ * - Creates a checkout session via `create-session` (receives every other field unchanged)
499
+ * - Appends the token to the checkout URL as a URL fragment (`#token=...`)
500
+ *
501
+ * `buyerIdentity` and `buyerEmail` are independent inputs: identity is for the JWT,
502
+ * email is for pre-filling the checkout page. The SDK forwards each to its own endpoint.
492
503
  *
493
504
  * @param params - Checkout parameters including buyer identity
494
505
  * @returns Session details with token-appended checkout URL
@@ -497,14 +508,15 @@ var CheckoutAuthenticatedResource = class {
497
508
  * const result = await client.checkout.authenticated.create({
498
509
  * productId: "PROD_xxx",
499
510
  * currency: "USD",
500
- * buyerIdentity: "customer@example.com",
511
+ * buyerIdentity: "user-123",
512
+ * buyerEmail: "customer@example.com",
501
513
  * });
502
514
  * // Redirect to result.checkoutUrl (includes #token=...)
503
515
  */
504
516
  async create(params) {
505
517
  validateCheckoutCommon(params);
506
518
  validateRequired("buyerIdentity", params.buyerIdentity);
507
- const { buyerIdentity, buyerEmail, ...sessionFields } = params;
519
+ const { buyerIdentity, ...sessionParams } = params;
508
520
  const [tokenResult, sessionResult] = await Promise.all([
509
521
  this.http.post(
510
522
  "/v1/actions/auth/issue-session-token",
@@ -514,14 +526,7 @@ var CheckoutAuthenticatedResource = class {
514
526
  },
515
527
  { idempotencyWindow: 60 }
516
528
  ),
517
- this.http.post(
518
- "/v1/actions/checkout/create-session",
519
- {
520
- ...sessionFields,
521
- buyerEmail: buyerEmail ?? buyerIdentity
522
- },
523
- { idempotencyWindow: 60 }
524
- )
529
+ this.http.post("/v1/actions/checkout/create-session", sessionParams, { idempotencyWindow: 60 })
525
530
  ]);
526
531
  return {
527
532
  sessionId: sessionResult.sessionId,