@waffo/pancake-ts 0.18.0 → 0.19.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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/index.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -6
- package/dist/index.d.ts +37 -6
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -177,7 +177,7 @@ declare enum OnetimeOrderStatus {
|
|
|
177
177
|
* - pending -> active, canceled, closed (PSP CLOSE from never-activated)
|
|
178
178
|
* - active -> canceling, past_due, canceled, expired
|
|
179
179
|
* - canceling -> active, canceled
|
|
180
|
-
* - past_due -> active, canceled
|
|
180
|
+
* - past_due -> active, canceling, canceled
|
|
181
181
|
* - closed -> terminal (never-activated subscription closed by PSP)
|
|
182
182
|
* - canceled -> terminal
|
|
183
183
|
* - expired -> terminal
|
|
@@ -505,12 +505,18 @@ interface UpdateRoleResult {
|
|
|
505
505
|
* @example
|
|
506
506
|
* // JPY ¥1000
|
|
507
507
|
* { amount: "1000", taxCategory: "software" }
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* // USD $9.99 with a $1.00 trial period (subscription products only)
|
|
511
|
+
* { amount: "9.99", taxCategory: "saas", trialAmount: "1.00" }
|
|
508
512
|
*/
|
|
509
513
|
interface PriceInfo {
|
|
510
514
|
/** Price amount as display string (e.g., "9.99" for USD, "1000" for JPY) */
|
|
511
515
|
amount: string;
|
|
512
516
|
/** Tax category */
|
|
513
517
|
taxCategory: TaxCategory;
|
|
518
|
+
/** Trial period price as display string; requires `metadata.trialDays` and must be lower than `amount` */
|
|
519
|
+
trialAmount?: string;
|
|
514
520
|
}
|
|
515
521
|
/**
|
|
516
522
|
* Multi-currency prices (keyed by ISO 4217 currency code).
|
|
@@ -757,6 +763,17 @@ type CashierLanguage = "en" | "pt-BR" | "es-MX" | "id-ID" | "vi-VN" | "ru-RU" |
|
|
|
757
763
|
* Currencies outside this matrix cannot be charged at all — checkout session creation is rejected with a 400.
|
|
758
764
|
*/
|
|
759
765
|
type PaymentMethod = "card" | "applepay" | "googlepay" | "wechat";
|
|
766
|
+
/**
|
|
767
|
+
* Session-level price override, accepted with API Key authentication only.
|
|
768
|
+
* For subscription products it replaces the regular period price; the trial price comes from the locked product version.
|
|
769
|
+
* @see docs/api-reference/endpoints/orders/create-checkout-session.mdx
|
|
770
|
+
*/
|
|
771
|
+
interface PriceSnapshot {
|
|
772
|
+
/** Price amount as display string (e.g., "9.99" for USD, "1000" for JPY) */
|
|
773
|
+
amount: string;
|
|
774
|
+
/** Tax category */
|
|
775
|
+
taxCategory: TaxCategory;
|
|
776
|
+
}
|
|
760
777
|
/**
|
|
761
778
|
* Parameters for creating a checkout session.
|
|
762
779
|
* @see docs/api-reference/endpoints/orders/create-checkout-session.mdx
|
|
@@ -767,7 +784,7 @@ interface CreateCheckoutSessionParams {
|
|
|
767
784
|
/** Currency code (ISO 4217) */
|
|
768
785
|
currency: string;
|
|
769
786
|
/** Optional price snapshot override (reads from DB if omitted) */
|
|
770
|
-
priceSnapshot?:
|
|
787
|
+
priceSnapshot?: PriceSnapshot;
|
|
771
788
|
/** Trial toggle override (subscription only) */
|
|
772
789
|
withTrial?: boolean;
|
|
773
790
|
/** Pre-filled customer email */
|
|
@@ -1554,7 +1571,9 @@ declare class CustomerSession {
|
|
|
1554
1571
|
*
|
|
1555
1572
|
* @example
|
|
1556
1573
|
* const { orderId, status } = await customer.cancelSubscription({ orderId: "ORD_xxx" });
|
|
1557
|
-
* // status: "canceled" (was pending)
|
|
1574
|
+
* // status: "canceled" (was pending)
|
|
1575
|
+
* // or "canceling" (was active — stops at the end of the current period)
|
|
1576
|
+
* // or "canceling" (was past_due — stops immediately)
|
|
1558
1577
|
*/
|
|
1559
1578
|
cancelSubscription(params: CancelSubscriptionParams): Promise<CancelSubscriptionResult & {
|
|
1560
1579
|
warnings?: Notice[];
|
|
@@ -1574,6 +1593,12 @@ declare class CustomerSession {
|
|
|
1574
1593
|
/**
|
|
1575
1594
|
* Reactivate a subscription that is in `canceling` status.
|
|
1576
1595
|
*
|
|
1596
|
+
* A subscription that had an unpaid charge at the moment cancellation was
|
|
1597
|
+
* requested is refused with 400 (`Subscription with an unpaid balance cannot
|
|
1598
|
+
* be reactivated`), which is worded differently from the 400 returned when
|
|
1599
|
+
* the order is not in `canceling` status. Cancelling a `past_due`
|
|
1600
|
+
* subscription always falls into the former category.
|
|
1601
|
+
*
|
|
1577
1602
|
* @param params - Order to reactivate
|
|
1578
1603
|
* @returns Order ID and resulting status
|
|
1579
1604
|
*
|
|
@@ -1749,8 +1774,14 @@ declare class OrdersResource {
|
|
|
1749
1774
|
/**
|
|
1750
1775
|
* Cancel a subscription order.
|
|
1751
1776
|
*
|
|
1752
|
-
* - pending -> canceled (immediate)
|
|
1753
|
-
* - active/trialing -> canceling (PSP cancel
|
|
1777
|
+
* - pending -> canceled (immediate, no PSP call)
|
|
1778
|
+
* - active/trialing -> canceling (PSP cancel scheduled for the end of the
|
|
1779
|
+
* current billing period; the subscription stays usable until then)
|
|
1780
|
+
* - past_due -> canceling (PSP cancel dispatched immediately; the billing
|
|
1781
|
+
* period has already lapsed, so nothing is left to use)
|
|
1782
|
+
*
|
|
1783
|
+
* In both canceling cases the terminal `canceled` status is written when the
|
|
1784
|
+
* PSP cancellation webhook arrives, not by this call.
|
|
1754
1785
|
*
|
|
1755
1786
|
* @param params - Order to cancel
|
|
1756
1787
|
* @returns Order ID and resulting status
|
|
@@ -2339,4 +2370,4 @@ declare class WaffoPancakeError extends Error {
|
|
|
2339
2370
|
*/
|
|
2340
2371
|
declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
|
|
2341
2372
|
|
|
2342
|
-
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 CashierLanguage, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type CustomerSessionOptions, 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, type PaymentMethod, 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, ScanAction, ScanPolicyCategory, type ScanPromptParams, ScanReasonCode, type ScanResult, ScanSemanticMode, ScanSemanticStatus, 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 };
|
|
2373
|
+
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 CashierLanguage, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type CustomerSessionOptions, 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, type PaymentMethod, PaymentStatus, type PostResult, type PriceInfo, type PriceSnapshot, 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, ScanAction, ScanPolicyCategory, type ScanPromptParams, ScanReasonCode, type ScanResult, ScanSemanticMode, ScanSemanticStatus, 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
|
@@ -177,7 +177,7 @@ declare enum OnetimeOrderStatus {
|
|
|
177
177
|
* - pending -> active, canceled, closed (PSP CLOSE from never-activated)
|
|
178
178
|
* - active -> canceling, past_due, canceled, expired
|
|
179
179
|
* - canceling -> active, canceled
|
|
180
|
-
* - past_due -> active, canceled
|
|
180
|
+
* - past_due -> active, canceling, canceled
|
|
181
181
|
* - closed -> terminal (never-activated subscription closed by PSP)
|
|
182
182
|
* - canceled -> terminal
|
|
183
183
|
* - expired -> terminal
|
|
@@ -505,12 +505,18 @@ interface UpdateRoleResult {
|
|
|
505
505
|
* @example
|
|
506
506
|
* // JPY ¥1000
|
|
507
507
|
* { amount: "1000", taxCategory: "software" }
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* // USD $9.99 with a $1.00 trial period (subscription products only)
|
|
511
|
+
* { amount: "9.99", taxCategory: "saas", trialAmount: "1.00" }
|
|
508
512
|
*/
|
|
509
513
|
interface PriceInfo {
|
|
510
514
|
/** Price amount as display string (e.g., "9.99" for USD, "1000" for JPY) */
|
|
511
515
|
amount: string;
|
|
512
516
|
/** Tax category */
|
|
513
517
|
taxCategory: TaxCategory;
|
|
518
|
+
/** Trial period price as display string; requires `metadata.trialDays` and must be lower than `amount` */
|
|
519
|
+
trialAmount?: string;
|
|
514
520
|
}
|
|
515
521
|
/**
|
|
516
522
|
* Multi-currency prices (keyed by ISO 4217 currency code).
|
|
@@ -757,6 +763,17 @@ type CashierLanguage = "en" | "pt-BR" | "es-MX" | "id-ID" | "vi-VN" | "ru-RU" |
|
|
|
757
763
|
* Currencies outside this matrix cannot be charged at all — checkout session creation is rejected with a 400.
|
|
758
764
|
*/
|
|
759
765
|
type PaymentMethod = "card" | "applepay" | "googlepay" | "wechat";
|
|
766
|
+
/**
|
|
767
|
+
* Session-level price override, accepted with API Key authentication only.
|
|
768
|
+
* For subscription products it replaces the regular period price; the trial price comes from the locked product version.
|
|
769
|
+
* @see docs/api-reference/endpoints/orders/create-checkout-session.mdx
|
|
770
|
+
*/
|
|
771
|
+
interface PriceSnapshot {
|
|
772
|
+
/** Price amount as display string (e.g., "9.99" for USD, "1000" for JPY) */
|
|
773
|
+
amount: string;
|
|
774
|
+
/** Tax category */
|
|
775
|
+
taxCategory: TaxCategory;
|
|
776
|
+
}
|
|
760
777
|
/**
|
|
761
778
|
* Parameters for creating a checkout session.
|
|
762
779
|
* @see docs/api-reference/endpoints/orders/create-checkout-session.mdx
|
|
@@ -767,7 +784,7 @@ interface CreateCheckoutSessionParams {
|
|
|
767
784
|
/** Currency code (ISO 4217) */
|
|
768
785
|
currency: string;
|
|
769
786
|
/** Optional price snapshot override (reads from DB if omitted) */
|
|
770
|
-
priceSnapshot?:
|
|
787
|
+
priceSnapshot?: PriceSnapshot;
|
|
771
788
|
/** Trial toggle override (subscription only) */
|
|
772
789
|
withTrial?: boolean;
|
|
773
790
|
/** Pre-filled customer email */
|
|
@@ -1554,7 +1571,9 @@ declare class CustomerSession {
|
|
|
1554
1571
|
*
|
|
1555
1572
|
* @example
|
|
1556
1573
|
* const { orderId, status } = await customer.cancelSubscription({ orderId: "ORD_xxx" });
|
|
1557
|
-
* // status: "canceled" (was pending)
|
|
1574
|
+
* // status: "canceled" (was pending)
|
|
1575
|
+
* // or "canceling" (was active — stops at the end of the current period)
|
|
1576
|
+
* // or "canceling" (was past_due — stops immediately)
|
|
1558
1577
|
*/
|
|
1559
1578
|
cancelSubscription(params: CancelSubscriptionParams): Promise<CancelSubscriptionResult & {
|
|
1560
1579
|
warnings?: Notice[];
|
|
@@ -1574,6 +1593,12 @@ declare class CustomerSession {
|
|
|
1574
1593
|
/**
|
|
1575
1594
|
* Reactivate a subscription that is in `canceling` status.
|
|
1576
1595
|
*
|
|
1596
|
+
* A subscription that had an unpaid charge at the moment cancellation was
|
|
1597
|
+
* requested is refused with 400 (`Subscription with an unpaid balance cannot
|
|
1598
|
+
* be reactivated`), which is worded differently from the 400 returned when
|
|
1599
|
+
* the order is not in `canceling` status. Cancelling a `past_due`
|
|
1600
|
+
* subscription always falls into the former category.
|
|
1601
|
+
*
|
|
1577
1602
|
* @param params - Order to reactivate
|
|
1578
1603
|
* @returns Order ID and resulting status
|
|
1579
1604
|
*
|
|
@@ -1749,8 +1774,14 @@ declare class OrdersResource {
|
|
|
1749
1774
|
/**
|
|
1750
1775
|
* Cancel a subscription order.
|
|
1751
1776
|
*
|
|
1752
|
-
* - pending -> canceled (immediate)
|
|
1753
|
-
* - active/trialing -> canceling (PSP cancel
|
|
1777
|
+
* - pending -> canceled (immediate, no PSP call)
|
|
1778
|
+
* - active/trialing -> canceling (PSP cancel scheduled for the end of the
|
|
1779
|
+
* current billing period; the subscription stays usable until then)
|
|
1780
|
+
* - past_due -> canceling (PSP cancel dispatched immediately; the billing
|
|
1781
|
+
* period has already lapsed, so nothing is left to use)
|
|
1782
|
+
*
|
|
1783
|
+
* In both canceling cases the terminal `canceled` status is written when the
|
|
1784
|
+
* PSP cancellation webhook arrives, not by this call.
|
|
1754
1785
|
*
|
|
1755
1786
|
* @param params - Order to cancel
|
|
1756
1787
|
* @returns Order ID and resulting status
|
|
@@ -2339,4 +2370,4 @@ declare class WaffoPancakeError extends Error {
|
|
|
2339
2370
|
*/
|
|
2340
2371
|
declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
|
|
2341
2372
|
|
|
2342
|
-
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 CashierLanguage, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type CustomerSessionOptions, 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, type PaymentMethod, 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, ScanAction, ScanPolicyCategory, type ScanPromptParams, ScanReasonCode, type ScanResult, ScanSemanticMode, ScanSemanticStatus, 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 };
|
|
2373
|
+
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 CashierLanguage, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type CustomerSessionOptions, 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, type PaymentMethod, PaymentStatus, type PostResult, type PriceInfo, type PriceSnapshot, 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, ScanAction, ScanPolicyCategory, type ScanPromptParams, ScanReasonCode, type ScanResult, ScanSemanticMode, ScanSemanticStatus, 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
|
@@ -541,7 +541,9 @@ var CustomerSession = class {
|
|
|
541
541
|
*
|
|
542
542
|
* @example
|
|
543
543
|
* const { orderId, status } = await customer.cancelSubscription({ orderId: "ORD_xxx" });
|
|
544
|
-
* // status: "canceled" (was pending)
|
|
544
|
+
* // status: "canceled" (was pending)
|
|
545
|
+
* // or "canceling" (was active — stops at the end of the current period)
|
|
546
|
+
* // or "canceling" (was past_due — stops immediately)
|
|
545
547
|
*/
|
|
546
548
|
async cancelSubscription(params) {
|
|
547
549
|
validateShortId("orderId", params.orderId, "ORD");
|
|
@@ -563,6 +565,12 @@ var CustomerSession = class {
|
|
|
563
565
|
/**
|
|
564
566
|
* Reactivate a subscription that is in `canceling` status.
|
|
565
567
|
*
|
|
568
|
+
* A subscription that had an unpaid charge at the moment cancellation was
|
|
569
|
+
* requested is refused with 400 (`Subscription with an unpaid balance cannot
|
|
570
|
+
* be reactivated`), which is worded differently from the 400 returned when
|
|
571
|
+
* the order is not in `canceling` status. Cancelling a `past_due`
|
|
572
|
+
* subscription always falls into the former category.
|
|
573
|
+
*
|
|
566
574
|
* @param params - Order to reactivate
|
|
567
575
|
* @returns Order ID and resulting status
|
|
568
576
|
*
|
|
@@ -761,8 +769,14 @@ var OrdersResource = class {
|
|
|
761
769
|
/**
|
|
762
770
|
* Cancel a subscription order.
|
|
763
771
|
*
|
|
764
|
-
* - pending -> canceled (immediate)
|
|
765
|
-
* - active/trialing -> canceling (PSP cancel
|
|
772
|
+
* - pending -> canceled (immediate, no PSP call)
|
|
773
|
+
* - active/trialing -> canceling (PSP cancel scheduled for the end of the
|
|
774
|
+
* current billing period; the subscription stays usable until then)
|
|
775
|
+
* - past_due -> canceling (PSP cancel dispatched immediately; the billing
|
|
776
|
+
* period has already lapsed, so nothing is left to use)
|
|
777
|
+
*
|
|
778
|
+
* In both canceling cases the terminal `canceled` status is written when the
|
|
779
|
+
* PSP cancellation webhook arrives, not by this call.
|
|
766
780
|
*
|
|
767
781
|
* @param params - Order to cancel
|
|
768
782
|
* @returns Order ID and resulting status
|