@waffo/pancake-ts 0.19.1 → 0.21.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 +20 -0
- package/README.md +26 -21
- package/dist/index.cjs +5 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -10
- package/dist/index.d.ts +34 -10
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/docs/api-reference.md +15 -18
- package/docs/webhook-guide.md +45 -13
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -353,6 +353,10 @@ interface NotificationSettings {
|
|
|
353
353
|
emailTrialStarted: boolean;
|
|
354
354
|
emailTrialEnding: boolean;
|
|
355
355
|
emailUpcomingCharge: boolean;
|
|
356
|
+
/** One toggle for all three plan-change customer emails (scheduled / failed / applied) */
|
|
357
|
+
emailSubscriptionPlanChanged: boolean;
|
|
358
|
+
/** Customer email sent when a refund on their payment completes */
|
|
359
|
+
emailRefundSucceeded: boolean;
|
|
356
360
|
notifyNewOrders: boolean;
|
|
357
361
|
notifyNewSubscriptions: boolean;
|
|
358
362
|
notifySubscriptionCanceled: boolean;
|
|
@@ -360,18 +364,25 @@ interface NotificationSettings {
|
|
|
360
364
|
notifySubscriptionPastDue: boolean;
|
|
361
365
|
notifySubscriptionRenewed: boolean;
|
|
362
366
|
notifySubscriptionUncanceled: boolean;
|
|
363
|
-
|
|
367
|
+
notifySubscriptionPlanChanged: boolean;
|
|
364
368
|
notifyChargeback: boolean;
|
|
369
|
+
/** Merchant notification sent when a refund on a payment completes */
|
|
370
|
+
notifyRefundSucceeded: boolean;
|
|
365
371
|
}
|
|
366
372
|
/**
|
|
367
373
|
* Merchant-writable subset of {@link NotificationSettings}.
|
|
368
374
|
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
375
|
+
* Every `notify*` toggle, plus `emailUpcomingCharge` — the renewal reminder is the
|
|
376
|
+
* one consumer email a merchant may switch off, and switching it off silences it
|
|
377
|
+
* for every billing period in that store, yearly plans included.
|
|
378
|
+
*
|
|
379
|
+
* Every other consumer-email toggle (`email*`) is managed by the PANCAKE
|
|
380
|
+
* platform and **not** writable from this SDK; the `update-store` endpoint silently
|
|
381
|
+
* drops them and names them in the response's `warnings`. Payout result
|
|
382
|
+
* notifications are platform-managed and always delivered — they have no toggle
|
|
383
|
+
* key. Use this type for any merchant-side update.
|
|
373
384
|
*/
|
|
374
|
-
type MerchantWritableNotificationSettings = Pick<NotificationSettings, "notifyNewOrders" | "notifyNewSubscriptions" | "notifySubscriptionCanceled" | "notifySubscriptionEnded" | "notifySubscriptionPastDue" | "notifySubscriptionRenewed" | "notifySubscriptionUncanceled" | "
|
|
385
|
+
type MerchantWritableNotificationSettings = Pick<NotificationSettings, "notifyNewOrders" | "notifyNewSubscriptions" | "notifySubscriptionCanceled" | "notifySubscriptionEnded" | "notifySubscriptionPastDue" | "notifySubscriptionRenewed" | "notifySubscriptionUncanceled" | "notifySubscriptionPlanChanged" | "notifyChargeback" | "notifyRefundSucceeded" | "emailUpcomingCharge">;
|
|
375
386
|
/**
|
|
376
387
|
* Single-theme checkout page styling.
|
|
377
388
|
* @see docs/api-reference/endpoints/stores/overview.mdx
|
|
@@ -1034,14 +1045,22 @@ declare enum WebhookEventType {
|
|
|
1034
1045
|
OrderCompleted = "order.completed",
|
|
1035
1046
|
/** Subscription first payment succeeded (newly activated) */
|
|
1036
1047
|
SubscriptionActivated = "subscription.activated",
|
|
1037
|
-
/** Subscription
|
|
1048
|
+
/** Subscription payment succeeded — a pure payment event, carries no subscription period or status */
|
|
1038
1049
|
SubscriptionPaymentSucceeded = "subscription.payment_succeeded",
|
|
1050
|
+
/** Current billing period rolled forward (renewal) */
|
|
1051
|
+
SubscriptionRenewed = "subscription.renewed",
|
|
1052
|
+
/** Subscription recovered from past due (a retried charge succeeded) */
|
|
1053
|
+
SubscriptionRecovered = "subscription.recovered",
|
|
1054
|
+
/** Plan change took effect (upgrade/downgrade) */
|
|
1055
|
+
SubscriptionPlanChanged = "subscription.plan_changed",
|
|
1056
|
+
/** Plan change confirmed, takes effect next billing period */
|
|
1057
|
+
SubscriptionPlanChangeScheduled = "subscription.plan_change_scheduled",
|
|
1058
|
+
/** Plan change did not complete, the current plan stays in effect */
|
|
1059
|
+
SubscriptionPlanChangeFailed = "subscription.plan_change_failed",
|
|
1039
1060
|
/** Customer initiated cancellation (expires at end of current period) */
|
|
1040
1061
|
SubscriptionCanceling = "subscription.canceling",
|
|
1041
1062
|
/** Customer withdrew cancellation (subscription restored) */
|
|
1042
1063
|
SubscriptionUncanceled = "subscription.uncanceled",
|
|
1043
|
-
/** Subscription product changed (upgrade/downgrade) */
|
|
1044
|
-
SubscriptionUpdated = "subscription.updated",
|
|
1045
1064
|
/** Subscription fully terminated */
|
|
1046
1065
|
SubscriptionCanceled = "subscription.canceled",
|
|
1047
1066
|
/** Renewal payment failed (past due) */
|
|
@@ -1057,7 +1076,12 @@ declare enum WebhookEventType {
|
|
|
1057
1076
|
*/
|
|
1058
1077
|
interface WebhookEventData {
|
|
1059
1078
|
orderId: string;
|
|
1060
|
-
/**
|
|
1079
|
+
/**
|
|
1080
|
+
* Order status (e.g., "completed", "active", "canceling").
|
|
1081
|
+
*
|
|
1082
|
+
* Absent on `subscription.payment_succeeded` — that event describes one charge only.
|
|
1083
|
+
* Read the subscription's status from the subscription events instead.
|
|
1084
|
+
*/
|
|
1061
1085
|
orderStatus?: string;
|
|
1062
1086
|
buyerEmail: string;
|
|
1063
1087
|
/** Merchant-provided customer identity from checkout session */
|
package/dist/index.d.ts
CHANGED
|
@@ -353,6 +353,10 @@ interface NotificationSettings {
|
|
|
353
353
|
emailTrialStarted: boolean;
|
|
354
354
|
emailTrialEnding: boolean;
|
|
355
355
|
emailUpcomingCharge: boolean;
|
|
356
|
+
/** One toggle for all three plan-change customer emails (scheduled / failed / applied) */
|
|
357
|
+
emailSubscriptionPlanChanged: boolean;
|
|
358
|
+
/** Customer email sent when a refund on their payment completes */
|
|
359
|
+
emailRefundSucceeded: boolean;
|
|
356
360
|
notifyNewOrders: boolean;
|
|
357
361
|
notifyNewSubscriptions: boolean;
|
|
358
362
|
notifySubscriptionCanceled: boolean;
|
|
@@ -360,18 +364,25 @@ interface NotificationSettings {
|
|
|
360
364
|
notifySubscriptionPastDue: boolean;
|
|
361
365
|
notifySubscriptionRenewed: boolean;
|
|
362
366
|
notifySubscriptionUncanceled: boolean;
|
|
363
|
-
|
|
367
|
+
notifySubscriptionPlanChanged: boolean;
|
|
364
368
|
notifyChargeback: boolean;
|
|
369
|
+
/** Merchant notification sent when a refund on a payment completes */
|
|
370
|
+
notifyRefundSucceeded: boolean;
|
|
365
371
|
}
|
|
366
372
|
/**
|
|
367
373
|
* Merchant-writable subset of {@link NotificationSettings}.
|
|
368
374
|
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
375
|
+
* Every `notify*` toggle, plus `emailUpcomingCharge` — the renewal reminder is the
|
|
376
|
+
* one consumer email a merchant may switch off, and switching it off silences it
|
|
377
|
+
* for every billing period in that store, yearly plans included.
|
|
378
|
+
*
|
|
379
|
+
* Every other consumer-email toggle (`email*`) is managed by the PANCAKE
|
|
380
|
+
* platform and **not** writable from this SDK; the `update-store` endpoint silently
|
|
381
|
+
* drops them and names them in the response's `warnings`. Payout result
|
|
382
|
+
* notifications are platform-managed and always delivered — they have no toggle
|
|
383
|
+
* key. Use this type for any merchant-side update.
|
|
373
384
|
*/
|
|
374
|
-
type MerchantWritableNotificationSettings = Pick<NotificationSettings, "notifyNewOrders" | "notifyNewSubscriptions" | "notifySubscriptionCanceled" | "notifySubscriptionEnded" | "notifySubscriptionPastDue" | "notifySubscriptionRenewed" | "notifySubscriptionUncanceled" | "
|
|
385
|
+
type MerchantWritableNotificationSettings = Pick<NotificationSettings, "notifyNewOrders" | "notifyNewSubscriptions" | "notifySubscriptionCanceled" | "notifySubscriptionEnded" | "notifySubscriptionPastDue" | "notifySubscriptionRenewed" | "notifySubscriptionUncanceled" | "notifySubscriptionPlanChanged" | "notifyChargeback" | "notifyRefundSucceeded" | "emailUpcomingCharge">;
|
|
375
386
|
/**
|
|
376
387
|
* Single-theme checkout page styling.
|
|
377
388
|
* @see docs/api-reference/endpoints/stores/overview.mdx
|
|
@@ -1034,14 +1045,22 @@ declare enum WebhookEventType {
|
|
|
1034
1045
|
OrderCompleted = "order.completed",
|
|
1035
1046
|
/** Subscription first payment succeeded (newly activated) */
|
|
1036
1047
|
SubscriptionActivated = "subscription.activated",
|
|
1037
|
-
/** Subscription
|
|
1048
|
+
/** Subscription payment succeeded — a pure payment event, carries no subscription period or status */
|
|
1038
1049
|
SubscriptionPaymentSucceeded = "subscription.payment_succeeded",
|
|
1050
|
+
/** Current billing period rolled forward (renewal) */
|
|
1051
|
+
SubscriptionRenewed = "subscription.renewed",
|
|
1052
|
+
/** Subscription recovered from past due (a retried charge succeeded) */
|
|
1053
|
+
SubscriptionRecovered = "subscription.recovered",
|
|
1054
|
+
/** Plan change took effect (upgrade/downgrade) */
|
|
1055
|
+
SubscriptionPlanChanged = "subscription.plan_changed",
|
|
1056
|
+
/** Plan change confirmed, takes effect next billing period */
|
|
1057
|
+
SubscriptionPlanChangeScheduled = "subscription.plan_change_scheduled",
|
|
1058
|
+
/** Plan change did not complete, the current plan stays in effect */
|
|
1059
|
+
SubscriptionPlanChangeFailed = "subscription.plan_change_failed",
|
|
1039
1060
|
/** Customer initiated cancellation (expires at end of current period) */
|
|
1040
1061
|
SubscriptionCanceling = "subscription.canceling",
|
|
1041
1062
|
/** Customer withdrew cancellation (subscription restored) */
|
|
1042
1063
|
SubscriptionUncanceled = "subscription.uncanceled",
|
|
1043
|
-
/** Subscription product changed (upgrade/downgrade) */
|
|
1044
|
-
SubscriptionUpdated = "subscription.updated",
|
|
1045
1064
|
/** Subscription fully terminated */
|
|
1046
1065
|
SubscriptionCanceled = "subscription.canceled",
|
|
1047
1066
|
/** Renewal payment failed (past due) */
|
|
@@ -1057,7 +1076,12 @@ declare enum WebhookEventType {
|
|
|
1057
1076
|
*/
|
|
1058
1077
|
interface WebhookEventData {
|
|
1059
1078
|
orderId: string;
|
|
1060
|
-
/**
|
|
1079
|
+
/**
|
|
1080
|
+
* Order status (e.g., "completed", "active", "canceling").
|
|
1081
|
+
*
|
|
1082
|
+
* Absent on `subscription.payment_succeeded` — that event describes one charge only.
|
|
1083
|
+
* Read the subscription's status from the subscription events instead.
|
|
1084
|
+
*/
|
|
1061
1085
|
orderStatus?: string;
|
|
1062
1086
|
buyerEmail: string;
|
|
1063
1087
|
/** Merchant-provided customer identity from checkout session */
|
package/dist/index.js
CHANGED
|
@@ -1517,9 +1517,13 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
|
|
|
1517
1517
|
WebhookEventType2["OrderCompleted"] = "order.completed";
|
|
1518
1518
|
WebhookEventType2["SubscriptionActivated"] = "subscription.activated";
|
|
1519
1519
|
WebhookEventType2["SubscriptionPaymentSucceeded"] = "subscription.payment_succeeded";
|
|
1520
|
+
WebhookEventType2["SubscriptionRenewed"] = "subscription.renewed";
|
|
1521
|
+
WebhookEventType2["SubscriptionRecovered"] = "subscription.recovered";
|
|
1522
|
+
WebhookEventType2["SubscriptionPlanChanged"] = "subscription.plan_changed";
|
|
1523
|
+
WebhookEventType2["SubscriptionPlanChangeScheduled"] = "subscription.plan_change_scheduled";
|
|
1524
|
+
WebhookEventType2["SubscriptionPlanChangeFailed"] = "subscription.plan_change_failed";
|
|
1520
1525
|
WebhookEventType2["SubscriptionCanceling"] = "subscription.canceling";
|
|
1521
1526
|
WebhookEventType2["SubscriptionUncanceled"] = "subscription.uncanceled";
|
|
1522
|
-
WebhookEventType2["SubscriptionUpdated"] = "subscription.updated";
|
|
1523
1527
|
WebhookEventType2["SubscriptionCanceled"] = "subscription.canceled";
|
|
1524
1528
|
WebhookEventType2["SubscriptionPastDue"] = "subscription.past_due";
|
|
1525
1529
|
WebhookEventType2["RefundSucceeded"] = "refund.succeeded";
|