@waffo/pancake-ts 0.8.0 → 0.10.0
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 +50 -0
- package/README.md +32 -8
- package/dist/index.cjs +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -3
- package/dist/index.d.ts +35 -3
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/docs/api-reference.md +45 -41
- package/docs/graphql-guide.md +26 -0
- package/docs/webhook-guide.md +11 -9
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -325,9 +325,28 @@ interface NotificationSettings {
|
|
|
325
325
|
emailSubscriptionCanceled: boolean;
|
|
326
326
|
emailSubscriptionRevoked: boolean;
|
|
327
327
|
emailSubscriptionPastDue: boolean;
|
|
328
|
+
emailTrialStarted: boolean;
|
|
329
|
+
emailTrialEnding: boolean;
|
|
328
330
|
notifyNewOrders: boolean;
|
|
329
331
|
notifyNewSubscriptions: boolean;
|
|
332
|
+
notifySubscriptionCanceled: boolean;
|
|
333
|
+
notifySubscriptionEnded: boolean;
|
|
334
|
+
notifySubscriptionPastDue: boolean;
|
|
335
|
+
notifySubscriptionRenewed: boolean;
|
|
336
|
+
notifySubscriptionUncanceled: boolean;
|
|
337
|
+
notifySubscriptionUpdated: boolean;
|
|
338
|
+
notifyChargeback: boolean;
|
|
339
|
+
notifyPayoutCompleted: boolean;
|
|
340
|
+
notifyPayoutFailed: boolean;
|
|
330
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Merchant-writable subset of {@link NotificationSettings}.
|
|
344
|
+
*
|
|
345
|
+
* Consumer-email toggles (`email*`) are managed by the PANCAKE platform (admin-only
|
|
346
|
+
* via DB) and **not** writable from this SDK; they would be silently dropped by the
|
|
347
|
+
* `update-store` endpoint if included. Use this type for any merchant-side update.
|
|
348
|
+
*/
|
|
349
|
+
type MerchantWritableNotificationSettings = Pick<NotificationSettings, "notifyNewOrders" | "notifyNewSubscriptions" | "notifySubscriptionCanceled" | "notifySubscriptionEnded" | "notifySubscriptionPastDue" | "notifySubscriptionRenewed" | "notifySubscriptionUncanceled" | "notifySubscriptionUpdated" | "notifyChargeback" | "notifyPayoutCompleted" | "notifyPayoutFailed">;
|
|
331
350
|
/**
|
|
332
351
|
* Single-theme checkout page styling.
|
|
333
352
|
* @see waffo-pancake-store-service/app/lib/types.ts
|
|
@@ -398,7 +417,7 @@ interface UpdateStoreParams {
|
|
|
398
417
|
/** Store website URL (set to `null` to remove) */
|
|
399
418
|
website?: string | null;
|
|
400
419
|
/** Notification preferences (partial update — omitted fields keep existing values, set to `null` to clear all) */
|
|
401
|
-
notificationSettings?: Partial<
|
|
420
|
+
notificationSettings?: Partial<MerchantWritableNotificationSettings> | null;
|
|
402
421
|
/** Checkout page theme configuration (partial update — omitted fields keep existing values, set to `null` to clear all) */
|
|
403
422
|
checkoutSettings?: Partial<CheckoutSettings> | null;
|
|
404
423
|
}
|
|
@@ -720,6 +739,8 @@ interface CreateCheckoutSessionParams {
|
|
|
720
739
|
darkMode?: boolean;
|
|
721
740
|
/** Custom metadata */
|
|
722
741
|
metadata?: Record<string, string>;
|
|
742
|
+
/** Order-side business identifier (max 128 chars); inherited by orders, payments, refunds */
|
|
743
|
+
orderMerchantExternalId?: string;
|
|
723
744
|
}
|
|
724
745
|
/** Result of creating a checkout session. */
|
|
725
746
|
interface CheckoutSessionResult {
|
|
@@ -781,6 +802,8 @@ interface CreateRefundTicketParams {
|
|
|
781
802
|
requestedAmount: RequestedAmount;
|
|
782
803
|
/** Custom metadata */
|
|
783
804
|
metadata?: Record<string, unknown>;
|
|
805
|
+
/** Refund-ticket business-side identifier (max 128 chars); inherited by the executed refund on PSP success */
|
|
806
|
+
refundTicketMerchantExternalId?: string;
|
|
784
807
|
}
|
|
785
808
|
/** Parameters for resubmitting a rejected refund ticket (buyer-side). */
|
|
786
809
|
interface ResubmitRefundTicketParams {
|
|
@@ -821,6 +844,8 @@ interface RefundTicket {
|
|
|
821
844
|
executedAt: string | null;
|
|
822
845
|
/** Custom metadata */
|
|
823
846
|
metadata: Record<string, unknown>;
|
|
847
|
+
/** Refund-ticket business-side identifier (max 128 chars, immutable across resubmits) */
|
|
848
|
+
refundTicketMerchantExternalId: string | null;
|
|
824
849
|
/** Current version number */
|
|
825
850
|
versionNumber: number | null;
|
|
826
851
|
/** Current (latest) version data */
|
|
@@ -954,6 +979,10 @@ interface WebhookEventData {
|
|
|
954
979
|
buyerEmail: string;
|
|
955
980
|
/** Merchant-provided buyer identity from checkout session */
|
|
956
981
|
merchantProvidedBuyerIdentity?: string;
|
|
982
|
+
/** Order business identifier; present on order/payment + refund events (inherited from order) */
|
|
983
|
+
orderMerchantExternalId?: string;
|
|
984
|
+
/** Refund-ticket business identifier; only present on refund.* events */
|
|
985
|
+
refundTicketMerchantExternalId?: string;
|
|
957
986
|
currency: string;
|
|
958
987
|
/** Billing/shipping address (structured object) */
|
|
959
988
|
billingDetail?: Record<string, unknown>;
|
|
@@ -1244,6 +1273,7 @@ declare class BuyerSession {
|
|
|
1244
1273
|
* paymentId: "PAY_xxx",
|
|
1245
1274
|
* reason: "Product not as described",
|
|
1246
1275
|
* requestedAmount: { amount: "29.00", currency: "USD" },
|
|
1276
|
+
* refundTicketMerchantExternalId: "REF-2026-00891",
|
|
1247
1277
|
* });
|
|
1248
1278
|
*/
|
|
1249
1279
|
createRefundTicket(params: CreateRefundTicketParams): Promise<{
|
|
@@ -1313,12 +1343,13 @@ declare class CheckoutAnonymousResource {
|
|
|
1313
1343
|
* });
|
|
1314
1344
|
*
|
|
1315
1345
|
* @example
|
|
1316
|
-
* // Pre-fill email
|
|
1346
|
+
* // Pre-fill email + billing + attach business-side order reference
|
|
1317
1347
|
* const result = await client.checkout.anonymous.create({
|
|
1318
1348
|
* productId: "PROD_xxx",
|
|
1319
1349
|
* currency: "USD",
|
|
1320
1350
|
* buyerEmail: "customer@example.com",
|
|
1321
1351
|
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
1352
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
1322
1353
|
* });
|
|
1323
1354
|
*/
|
|
1324
1355
|
create(params: AnonymousCheckoutParams): Promise<CheckoutSessionResult & {
|
|
@@ -1356,6 +1387,7 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1356
1387
|
* currency: "USD",
|
|
1357
1388
|
* buyerIdentity: "user-123",
|
|
1358
1389
|
* buyerEmail: "customer@example.com",
|
|
1390
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
1359
1391
|
* });
|
|
1360
1392
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
1361
1393
|
*/
|
|
@@ -2090,4 +2122,4 @@ declare class WaffoPancakeError extends Error {
|
|
|
2090
2122
|
*/
|
|
2091
2123
|
declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
|
|
2092
2124
|
|
|
2093
|
-
export { type AddMerchantParams, type AddMerchantResult, type AddWebhookParams, type AnonymousCheckoutParams, type ApiError, 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, type Envelope, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type Notice, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PostResult, 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 RemoveWebhookParams, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, type StoreWebhook, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type UpdateWebhookParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookChannel, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, verifyWebhook };
|
|
2125
|
+
export { type AddMerchantParams, type AddMerchantResult, type AddWebhookParams, type AnonymousCheckoutParams, type ApiError, 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, type Envelope, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type MerchantWritableNotificationSettings, type Notice, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PostResult, 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 RemoveWebhookParams, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, type StoreWebhook, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type UpdateWebhookParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookChannel, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -325,9 +325,28 @@ interface NotificationSettings {
|
|
|
325
325
|
emailSubscriptionCanceled: boolean;
|
|
326
326
|
emailSubscriptionRevoked: boolean;
|
|
327
327
|
emailSubscriptionPastDue: boolean;
|
|
328
|
+
emailTrialStarted: boolean;
|
|
329
|
+
emailTrialEnding: boolean;
|
|
328
330
|
notifyNewOrders: boolean;
|
|
329
331
|
notifyNewSubscriptions: boolean;
|
|
332
|
+
notifySubscriptionCanceled: boolean;
|
|
333
|
+
notifySubscriptionEnded: boolean;
|
|
334
|
+
notifySubscriptionPastDue: boolean;
|
|
335
|
+
notifySubscriptionRenewed: boolean;
|
|
336
|
+
notifySubscriptionUncanceled: boolean;
|
|
337
|
+
notifySubscriptionUpdated: boolean;
|
|
338
|
+
notifyChargeback: boolean;
|
|
339
|
+
notifyPayoutCompleted: boolean;
|
|
340
|
+
notifyPayoutFailed: boolean;
|
|
330
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Merchant-writable subset of {@link NotificationSettings}.
|
|
344
|
+
*
|
|
345
|
+
* Consumer-email toggles (`email*`) are managed by the PANCAKE platform (admin-only
|
|
346
|
+
* via DB) and **not** writable from this SDK; they would be silently dropped by the
|
|
347
|
+
* `update-store` endpoint if included. Use this type for any merchant-side update.
|
|
348
|
+
*/
|
|
349
|
+
type MerchantWritableNotificationSettings = Pick<NotificationSettings, "notifyNewOrders" | "notifyNewSubscriptions" | "notifySubscriptionCanceled" | "notifySubscriptionEnded" | "notifySubscriptionPastDue" | "notifySubscriptionRenewed" | "notifySubscriptionUncanceled" | "notifySubscriptionUpdated" | "notifyChargeback" | "notifyPayoutCompleted" | "notifyPayoutFailed">;
|
|
331
350
|
/**
|
|
332
351
|
* Single-theme checkout page styling.
|
|
333
352
|
* @see waffo-pancake-store-service/app/lib/types.ts
|
|
@@ -398,7 +417,7 @@ interface UpdateStoreParams {
|
|
|
398
417
|
/** Store website URL (set to `null` to remove) */
|
|
399
418
|
website?: string | null;
|
|
400
419
|
/** Notification preferences (partial update — omitted fields keep existing values, set to `null` to clear all) */
|
|
401
|
-
notificationSettings?: Partial<
|
|
420
|
+
notificationSettings?: Partial<MerchantWritableNotificationSettings> | null;
|
|
402
421
|
/** Checkout page theme configuration (partial update — omitted fields keep existing values, set to `null` to clear all) */
|
|
403
422
|
checkoutSettings?: Partial<CheckoutSettings> | null;
|
|
404
423
|
}
|
|
@@ -720,6 +739,8 @@ interface CreateCheckoutSessionParams {
|
|
|
720
739
|
darkMode?: boolean;
|
|
721
740
|
/** Custom metadata */
|
|
722
741
|
metadata?: Record<string, string>;
|
|
742
|
+
/** Order-side business identifier (max 128 chars); inherited by orders, payments, refunds */
|
|
743
|
+
orderMerchantExternalId?: string;
|
|
723
744
|
}
|
|
724
745
|
/** Result of creating a checkout session. */
|
|
725
746
|
interface CheckoutSessionResult {
|
|
@@ -781,6 +802,8 @@ interface CreateRefundTicketParams {
|
|
|
781
802
|
requestedAmount: RequestedAmount;
|
|
782
803
|
/** Custom metadata */
|
|
783
804
|
metadata?: Record<string, unknown>;
|
|
805
|
+
/** Refund-ticket business-side identifier (max 128 chars); inherited by the executed refund on PSP success */
|
|
806
|
+
refundTicketMerchantExternalId?: string;
|
|
784
807
|
}
|
|
785
808
|
/** Parameters for resubmitting a rejected refund ticket (buyer-side). */
|
|
786
809
|
interface ResubmitRefundTicketParams {
|
|
@@ -821,6 +844,8 @@ interface RefundTicket {
|
|
|
821
844
|
executedAt: string | null;
|
|
822
845
|
/** Custom metadata */
|
|
823
846
|
metadata: Record<string, unknown>;
|
|
847
|
+
/** Refund-ticket business-side identifier (max 128 chars, immutable across resubmits) */
|
|
848
|
+
refundTicketMerchantExternalId: string | null;
|
|
824
849
|
/** Current version number */
|
|
825
850
|
versionNumber: number | null;
|
|
826
851
|
/** Current (latest) version data */
|
|
@@ -954,6 +979,10 @@ interface WebhookEventData {
|
|
|
954
979
|
buyerEmail: string;
|
|
955
980
|
/** Merchant-provided buyer identity from checkout session */
|
|
956
981
|
merchantProvidedBuyerIdentity?: string;
|
|
982
|
+
/** Order business identifier; present on order/payment + refund events (inherited from order) */
|
|
983
|
+
orderMerchantExternalId?: string;
|
|
984
|
+
/** Refund-ticket business identifier; only present on refund.* events */
|
|
985
|
+
refundTicketMerchantExternalId?: string;
|
|
957
986
|
currency: string;
|
|
958
987
|
/** Billing/shipping address (structured object) */
|
|
959
988
|
billingDetail?: Record<string, unknown>;
|
|
@@ -1244,6 +1273,7 @@ declare class BuyerSession {
|
|
|
1244
1273
|
* paymentId: "PAY_xxx",
|
|
1245
1274
|
* reason: "Product not as described",
|
|
1246
1275
|
* requestedAmount: { amount: "29.00", currency: "USD" },
|
|
1276
|
+
* refundTicketMerchantExternalId: "REF-2026-00891",
|
|
1247
1277
|
* });
|
|
1248
1278
|
*/
|
|
1249
1279
|
createRefundTicket(params: CreateRefundTicketParams): Promise<{
|
|
@@ -1313,12 +1343,13 @@ declare class CheckoutAnonymousResource {
|
|
|
1313
1343
|
* });
|
|
1314
1344
|
*
|
|
1315
1345
|
* @example
|
|
1316
|
-
* // Pre-fill email
|
|
1346
|
+
* // Pre-fill email + billing + attach business-side order reference
|
|
1317
1347
|
* const result = await client.checkout.anonymous.create({
|
|
1318
1348
|
* productId: "PROD_xxx",
|
|
1319
1349
|
* currency: "USD",
|
|
1320
1350
|
* buyerEmail: "customer@example.com",
|
|
1321
1351
|
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
1352
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
1322
1353
|
* });
|
|
1323
1354
|
*/
|
|
1324
1355
|
create(params: AnonymousCheckoutParams): Promise<CheckoutSessionResult & {
|
|
@@ -1356,6 +1387,7 @@ declare class CheckoutAuthenticatedResource {
|
|
|
1356
1387
|
* currency: "USD",
|
|
1357
1388
|
* buyerIdentity: "user-123",
|
|
1358
1389
|
* buyerEmail: "customer@example.com",
|
|
1390
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
1359
1391
|
* });
|
|
1360
1392
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
1361
1393
|
*/
|
|
@@ -2090,4 +2122,4 @@ declare class WaffoPancakeError extends Error {
|
|
|
2090
2122
|
*/
|
|
2091
2123
|
declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
|
|
2092
2124
|
|
|
2093
|
-
export { type AddMerchantParams, type AddMerchantResult, type AddWebhookParams, type AnonymousCheckoutParams, type ApiError, 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, type Envelope, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type Notice, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PostResult, 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 RemoveWebhookParams, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, type StoreWebhook, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type UpdateWebhookParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookChannel, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, verifyWebhook };
|
|
2125
|
+
export { type AddMerchantParams, type AddMerchantResult, type AddWebhookParams, type AnonymousCheckoutParams, type ApiError, 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, type Envelope, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type MerchantWritableNotificationSettings, type Notice, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PostResult, 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 RemoveWebhookParams, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, type StoreWebhook, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type UpdateWebhookParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookChannel, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -271,6 +271,11 @@ function validateEnum(field, value, allowed) {
|
|
|
271
271
|
fail(`Invalid ${field}: expected one of [${allowed.join(", ")}], got "${value}"`);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
+
function validateMaxLength(field, value, max) {
|
|
275
|
+
if (value !== void 0 && value.length > max) {
|
|
276
|
+
fail(`${field} must be at most ${max} characters, got ${value.length}`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
274
279
|
function validatePositiveInteger(field, value) {
|
|
275
280
|
if (!Number.isInteger(value) || value <= 0) {
|
|
276
281
|
fail(`Invalid ${field}: expected positive integer, got ${value}`);
|
|
@@ -313,6 +318,7 @@ function validateCheckoutCommon(params) {
|
|
|
313
318
|
if (params.expiresInSeconds !== void 0) {
|
|
314
319
|
validatePositiveInteger("expiresInSeconds", params.expiresInSeconds);
|
|
315
320
|
}
|
|
321
|
+
validateMaxLength("orderMerchantExternalId", params.orderMerchantExternalId, 128);
|
|
316
322
|
}
|
|
317
323
|
|
|
318
324
|
// src/resources/auth.ts
|
|
@@ -415,6 +421,7 @@ var BuyerSession = class {
|
|
|
415
421
|
* paymentId: "PAY_xxx",
|
|
416
422
|
* reason: "Product not as described",
|
|
417
423
|
* requestedAmount: { amount: "29.00", currency: "USD" },
|
|
424
|
+
* refundTicketMerchantExternalId: "REF-2026-00891",
|
|
418
425
|
* });
|
|
419
426
|
*/
|
|
420
427
|
async createRefundTicket(params) {
|
|
@@ -422,6 +429,7 @@ var BuyerSession = class {
|
|
|
422
429
|
validateRequired("reason", params.reason);
|
|
423
430
|
validateAmountString("requestedAmount.amount", params.requestedAmount.amount);
|
|
424
431
|
validateCurrencyCode("requestedAmount.currency", params.requestedAmount.currency);
|
|
432
|
+
validateMaxLength("refundTicketMerchantExternalId", params.refundTicketMerchantExternalId, 128);
|
|
425
433
|
return unwrapAction(await this.http.post("/v1/actions/refund-ticket/create-ticket", params));
|
|
426
434
|
}
|
|
427
435
|
/**
|
|
@@ -488,12 +496,13 @@ var CheckoutAnonymousResource = class {
|
|
|
488
496
|
* });
|
|
489
497
|
*
|
|
490
498
|
* @example
|
|
491
|
-
* // Pre-fill email
|
|
499
|
+
* // Pre-fill email + billing + attach business-side order reference
|
|
492
500
|
* const result = await client.checkout.anonymous.create({
|
|
493
501
|
* productId: "PROD_xxx",
|
|
494
502
|
* currency: "USD",
|
|
495
503
|
* buyerEmail: "customer@example.com",
|
|
496
504
|
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
505
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
497
506
|
* });
|
|
498
507
|
*/
|
|
499
508
|
async create(params) {
|
|
@@ -529,6 +538,7 @@ var CheckoutAuthenticatedResource = class {
|
|
|
529
538
|
* currency: "USD",
|
|
530
539
|
* buyerIdentity: "user-123",
|
|
531
540
|
* buyerEmail: "customer@example.com",
|
|
541
|
+
* orderMerchantExternalId: "ORDER-2026-00891",
|
|
532
542
|
* });
|
|
533
543
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
534
544
|
*/
|