@shware/purchase 1.8.9 → 2.0.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/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/app-store/config.cjs +105 -128
- package/dist/app-store/config.cjs.map +1 -1
- package/dist/app-store/config.d.cts +36 -33
- package/dist/app-store/config.d.cts.map +1 -0
- package/dist/app-store/config.d.mts +42 -0
- package/dist/app-store/config.d.mts.map +1 -0
- package/dist/app-store/config.mjs +100 -91
- package/dist/app-store/config.mjs.map +1 -1
- package/dist/app-store/index.cjs +3 -31
- package/dist/app-store/index.d.cts +2 -3
- package/dist/app-store/index.d.mts +2 -0
- package/dist/app-store/index.mjs +1 -5
- package/dist/google-play/config.cjs +108 -123
- package/dist/google-play/config.cjs.map +1 -1
- package/dist/google-play/config.d.cts +35 -33
- package/dist/google-play/config.d.cts.map +1 -0
- package/dist/google-play/config.d.mts +41 -0
- package/dist/google-play/config.d.mts.map +1 -0
- package/dist/google-play/config.mjs +103 -86
- package/dist/google-play/config.mjs.map +1 -1
- package/dist/google-play/index.cjs +9 -42
- package/dist/google-play/index.d.cts +3 -4
- package/dist/google-play/index.d.mts +3 -0
- package/dist/google-play/index.mjs +2 -17
- package/dist/google-play/real-time-developer-notification.cjs +122 -81
- package/dist/google-play/real-time-developer-notification.cjs.map +1 -1
- package/dist/google-play/real-time-developer-notification.d.cts +119 -117
- package/dist/google-play/real-time-developer-notification.d.cts.map +1 -0
- package/dist/google-play/real-time-developer-notification.d.mts +150 -0
- package/dist/google-play/real-time-developer-notification.d.mts.map +1 -0
- package/dist/google-play/real-time-developer-notification.mjs +118 -53
- package/dist/google-play/real-time-developer-notification.mjs.map +1 -1
- package/dist/index.cjs +13 -48
- package/dist/index.d.cts +5 -6
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +2 -19
- package/dist/stripe/config.cjs +114 -133
- package/dist/stripe/config.cjs.map +1 -1
- package/dist/stripe/config.d.cts +46 -37
- package/dist/stripe/config.d.cts.map +1 -0
- package/dist/stripe/config.d.mts +52 -0
- package/dist/stripe/config.d.mts.map +1 -0
- package/dist/stripe/config.mjs +109 -96
- package/dist/stripe/config.mjs.map +1 -1
- package/dist/stripe/handler.cjs +25 -53
- package/dist/stripe/handler.cjs.map +1 -1
- package/dist/stripe/handler.d.cts +10 -9
- package/dist/stripe/handler.d.cts.map +1 -0
- package/dist/stripe/handler.d.mts +16 -0
- package/dist/stripe/handler.d.mts.map +1 -0
- package/dist/stripe/handler.mjs +25 -29
- package/dist/stripe/handler.mjs.map +1 -1
- package/dist/stripe/index.cjs +27 -74
- package/dist/stripe/index.d.cts +8 -12
- package/dist/stripe/index.d.mts +8 -0
- package/dist/stripe/index.mjs +5 -44
- package/dist/stripe/mapper.cjs +168 -219
- package/dist/stripe/mapper.cjs.map +1 -1
- package/dist/stripe/mapper.d.cts +115 -114
- package/dist/stripe/mapper.d.cts.map +1 -0
- package/dist/stripe/mapper.d.mts +158 -0
- package/dist/stripe/mapper.d.mts.map +1 -0
- package/dist/stripe/mapper.mjs +155 -182
- package/dist/stripe/mapper.mjs.map +1 -1
- package/dist/stripe/metadata.cjs +11 -35
- package/dist/stripe/metadata.cjs.map +1 -1
- package/dist/stripe/metadata.d.cts +9 -7
- package/dist/stripe/metadata.d.cts.map +1 -0
- package/dist/stripe/metadata.d.mts +12 -0
- package/dist/stripe/metadata.d.mts.map +1 -0
- package/dist/stripe/metadata.mjs +11 -11
- package/dist/stripe/metadata.mjs.map +1 -1
- package/dist/stripe/pending-checkout.cjs +55 -61
- package/dist/stripe/pending-checkout.cjs.map +1 -1
- package/dist/stripe/pending-checkout.d.cts +3 -1
- package/dist/stripe/pending-checkout.d.cts.map +1 -0
- package/dist/stripe/{pending-checkout.d.ts → pending-checkout.d.mts} +3 -1
- package/dist/stripe/pending-checkout.d.mts.map +1 -0
- package/dist/stripe/pending-checkout.mjs +52 -34
- package/dist/stripe/pending-checkout.mjs.map +1 -1
- package/dist/stripe/schema.cjs +30 -55
- package/dist/stripe/schema.cjs.map +1 -1
- package/dist/stripe/schema.d.cts +36 -37
- package/dist/stripe/schema.d.cts.map +1 -0
- package/dist/stripe/schema.d.mts +40 -0
- package/dist/stripe/schema.d.mts.map +1 -0
- package/dist/stripe/schema.mjs +28 -40
- package/dist/stripe/schema.mjs.map +1 -1
- package/dist/subscription/index.cjs +178 -80
- package/dist/subscription/index.cjs.map +1 -1
- package/dist/subscription/index.d.cts +136 -134
- package/dist/subscription/index.d.cts.map +1 -0
- package/dist/subscription/index.d.mts +150 -0
- package/dist/subscription/index.d.mts.map +1 -0
- package/dist/subscription/index.mjs +173 -51
- package/dist/subscription/index.mjs.map +1 -1
- package/dist/types.cjs +0 -19
- package/dist/types.d.cts +7 -6
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +10 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -1
- package/package.json +40 -25
- package/dist/app-store/config.d.ts +0 -39
- package/dist/app-store/index.cjs.map +0 -1
- package/dist/app-store/index.d.ts +0 -3
- package/dist/app-store/index.mjs.map +0 -1
- package/dist/google-play/config.d.ts +0 -39
- package/dist/google-play/index.cjs.map +0 -1
- package/dist/google-play/index.d.ts +0 -4
- package/dist/google-play/index.mjs.map +0 -1
- package/dist/google-play/real-time-developer-notification.d.ts +0 -148
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.mjs.map +0 -1
- package/dist/stripe/config.d.ts +0 -43
- package/dist/stripe/handler.d.ts +0 -15
- package/dist/stripe/index.cjs.map +0 -1
- package/dist/stripe/index.d.ts +0 -12
- package/dist/stripe/index.mjs.map +0 -1
- package/dist/stripe/mapper.d.ts +0 -157
- package/dist/stripe/metadata.d.ts +0 -10
- package/dist/stripe/schema.d.ts +0 -41
- package/dist/subscription/index.d.ts +0 -148
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.ts +0 -9
- package/dist/types.mjs.map +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Metadata, IsUnique } from '../types.js';
|
|
2
|
-
import 'ms';
|
|
3
|
-
|
|
4
|
-
declare const addMethod: unique symbol;
|
|
5
|
-
declare class Subscription<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, PI extends string = never, I extends Lowercase<string> = never> {
|
|
6
|
-
readonly productId: string;
|
|
7
|
-
readonly config: GooglePlayConfig<NS, PE, PI>;
|
|
8
|
-
readonly plans: Map<string, Metadata & {
|
|
9
|
-
plan?: PE;
|
|
10
|
-
}>;
|
|
11
|
-
readonly defaultPlans: Set<string>;
|
|
12
|
-
constructor(config: GooglePlayConfig<NS, PE, PI>, productId: string);
|
|
13
|
-
basePlan: <K extends Lowercase<string>>(planId: K extends I ? never : K, plan: PE, metadata?: Metadata) => Subscription<NS, PE, PI, I | K>;
|
|
14
|
-
default: <const T extends readonly [I, ...I[]]>(planIds: T & (IsUnique<T> extends true ? unknown : never)) => GooglePlayConfig<NS, PE, PI>;
|
|
15
|
-
}
|
|
16
|
-
type Options = {
|
|
17
|
-
package: string;
|
|
18
|
-
audience: string;
|
|
19
|
-
};
|
|
20
|
-
declare class GooglePlayConfig<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, PI extends string = never> {
|
|
21
|
-
readonly package: string;
|
|
22
|
-
readonly audience: string;
|
|
23
|
-
private onetimes;
|
|
24
|
-
private subscriptions;
|
|
25
|
-
private products;
|
|
26
|
-
[addMethod]: (subscription: Subscription<NS, PE, PI>) => this;
|
|
27
|
-
private getId;
|
|
28
|
-
private constructor();
|
|
29
|
-
static create: <NS_1 extends Lowercase<string>, PE_1 extends string = string>(options: Options) => GooglePlayConfig<NS_1, PE_1, never>;
|
|
30
|
-
subscription: <K extends `${NS}.${Lowercase<string>}`>(productId: K extends PI ? never : K) => Subscription<NS, PE, PI | K, never>;
|
|
31
|
-
onetime: <K extends `${NS}.${Lowercase<string>}`>(productId: K extends PI ? never : K, metadata?: Metadata) => GooglePlayConfig<NS, PE, PI | K>;
|
|
32
|
-
getPlan: (productId: string, planId: string) => PE;
|
|
33
|
-
getMode: (productId: string) => "payment" | "subscription";
|
|
34
|
-
getCreditAmount: (productId: string, planId?: string) => number;
|
|
35
|
-
private getCreditExpiresIn;
|
|
36
|
-
getCreditExpiresAt: (productId: string, planId?: string) => string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { GooglePlayConfig };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/google-play/index.ts"],"sourcesContent":["export {\n type PubsubMessage,\n type DeveloperNotification,\n type SubscriptionNotification,\n type OneTimeProductNotification,\n type VoidedPurchaseNotification,\n type TestNotification,\n GooglePlaySubscriptionState,\n SubscriptionNotificationType,\n OneTimeProductNotificationType,\n VoidedPurchaseProductType,\n VoidedPurchaseRefundType,\n} from './real-time-developer-notification';\nexport { GooglePlayConfig } from './config';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8CAYO;AACP,oBAAiC;","names":[]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { DeveloperNotification, GooglePlaySubscriptionState, OneTimeProductNotification, OneTimeProductNotificationType, PubsubMessage, SubscriptionNotification, SubscriptionNotificationType, TestNotification, VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType } from './real-time-developer-notification.js';
|
|
2
|
-
export { GooglePlayConfig } from './config.js';
|
|
3
|
-
import '../types.js';
|
|
4
|
-
import 'ms';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/google-play/index.ts"],"sourcesContent":["export {\n type PubsubMessage,\n type DeveloperNotification,\n type SubscriptionNotification,\n type OneTimeProductNotification,\n type VoidedPurchaseNotification,\n type TestNotification,\n GooglePlaySubscriptionState,\n SubscriptionNotificationType,\n OneTimeProductNotificationType,\n VoidedPurchaseProductType,\n VoidedPurchaseRefundType,\n} from './real-time-developer-notification';\nexport { GooglePlayConfig } from './config';\n"],"mappings":";AAAA;AAAA,EAOE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;","names":[]}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
type PubsubMessage = {
|
|
2
|
-
data: string;
|
|
3
|
-
attributes: Record<string, string>;
|
|
4
|
-
messageId: string;
|
|
5
|
-
publishTime: string;
|
|
6
|
-
orderingKey: string;
|
|
7
|
-
};
|
|
8
|
-
/** https://developer.android.com/google/play/billing/rtdn-reference */
|
|
9
|
-
interface DeveloperNotification {
|
|
10
|
-
version: string;
|
|
11
|
-
packageName: string;
|
|
12
|
-
eventTimeMillis: number;
|
|
13
|
-
subscriptionNotification: SubscriptionNotification;
|
|
14
|
-
oneTimeProductNotification: OneTimeProductNotification;
|
|
15
|
-
voidedPurchaseNotification: VoidedPurchaseNotification;
|
|
16
|
-
testNotification: TestNotification;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)
|
|
20
|
-
* */
|
|
21
|
-
declare enum SubscriptionNotificationType {
|
|
22
|
-
/** A subscription was recovered from account hold. */
|
|
23
|
-
SUBSCRIPTION_RECOVERED = 1,
|
|
24
|
-
/** An active subscription was renewed. */
|
|
25
|
-
SUBSCRIPTION_RENEWED = 2,
|
|
26
|
-
/**
|
|
27
|
-
* A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation,
|
|
28
|
-
* sent when the user cancels.
|
|
29
|
-
*/
|
|
30
|
-
SUBSCRIPTION_CANCELED = 3,
|
|
31
|
-
/** A new subscription was purchased. */
|
|
32
|
-
SUBSCRIPTION_PURCHASED = 4,
|
|
33
|
-
/** A subscription has entered account hold (if enabled). */
|
|
34
|
-
SUBSCRIPTION_ON_HOLD = 5,
|
|
35
|
-
/** A subscription has entered grace period (if enabled). */
|
|
36
|
-
SUBSCRIPTION_IN_GRACE_PERIOD = 6,
|
|
37
|
-
/**
|
|
38
|
-
* User has restored their subscription from Play > Account > Subscriptions. The subscription was
|
|
39
|
-
* canceled but had not expired yet when the user restores. For more information, see Restorations.
|
|
40
|
-
*/
|
|
41
|
-
SUBSCRIPTION_RESTARTED = 7,
|
|
42
|
-
/** (DEPRECATED) A subscription price change has successfully been confirmed by the user. */
|
|
43
|
-
SUBSCRIPTION_PRICE_CHANGE_CONFIRMED = 8,
|
|
44
|
-
/** A subscription's recurrence time has been extended. */
|
|
45
|
-
SUBSCRIPTION_DEFERRED = 9,
|
|
46
|
-
/** A subscription has been paused. */
|
|
47
|
-
SUBSCRIPTION_PAUSED = 10,
|
|
48
|
-
/** A subscription pause schedule has been changed. */
|
|
49
|
-
SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED = 11,
|
|
50
|
-
/** A subscription has been revoked from the user before the expiration time. */
|
|
51
|
-
SUBSCRIPTION_REVOKED = 12,
|
|
52
|
-
/** A subscription has expired. */
|
|
53
|
-
SUBSCRIPTION_EXPIRED = 13,
|
|
54
|
-
/** A subscription item's price change details are updated. */
|
|
55
|
-
SUBSCRIPTION_PRICE_CHANGE_UPDATED = 19,
|
|
56
|
-
/** A pending transaction of a subscription has been canceled. */
|
|
57
|
-
SUBSCRIPTION_PENDING_PURCHASE_CANCELED = 20
|
|
58
|
-
}
|
|
59
|
-
interface SubscriptionNotification {
|
|
60
|
-
version: string;
|
|
61
|
-
purchaseToken: string;
|
|
62
|
-
notificationType: SubscriptionNotificationType;
|
|
63
|
-
}
|
|
64
|
-
declare enum OneTimeProductNotificationType {
|
|
65
|
-
/** A one-time product was successfully purchased by a user. */
|
|
66
|
-
ONE_TIME_PRODUCT_PURCHASED = 1,
|
|
67
|
-
/** A pending one-time product purchase has been canceled by the user. */
|
|
68
|
-
ONE_TIME_PRODUCT_CANCELED = 2
|
|
69
|
-
}
|
|
70
|
-
interface OneTimeProductNotification {
|
|
71
|
-
version: string;
|
|
72
|
-
sku: string;
|
|
73
|
-
purchaseToken: string;
|
|
74
|
-
notificationType: OneTimeProductNotificationType;
|
|
75
|
-
}
|
|
76
|
-
declare enum VoidedPurchaseProductType {
|
|
77
|
-
/** A subscription purchase has been voided. */
|
|
78
|
-
PRODUCT_TYPE_SUBSCRIPTION = 1,
|
|
79
|
-
/** A one-time purchase has been voided. */
|
|
80
|
-
PRODUCT_TYPE_ONE_TIME = 2
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType
|
|
84
|
-
* will be REFUND_TYPE_FULL_REFUND.
|
|
85
|
-
*/
|
|
86
|
-
declare enum VoidedPurchaseRefundType {
|
|
87
|
-
/** The purchase has been fully voided. */
|
|
88
|
-
REFUND_TYPE_FULL_REFUND = 1,
|
|
89
|
-
/**
|
|
90
|
-
* The purchase has been partially voided by a quantity-based partial refund, applicable only to
|
|
91
|
-
* multi-quantity purchases. A purchase can be partially voided multiple times.
|
|
92
|
-
*/
|
|
93
|
-
REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND = 2
|
|
94
|
-
}
|
|
95
|
-
interface VoidedPurchaseNotification {
|
|
96
|
-
purchaseToken: string;
|
|
97
|
-
orderId: string;
|
|
98
|
-
productType: VoidedPurchaseProductType;
|
|
99
|
-
refundType: VoidedPurchaseRefundType;
|
|
100
|
-
}
|
|
101
|
-
interface TestNotification {
|
|
102
|
-
version: string;
|
|
103
|
-
}
|
|
104
|
-
/** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */
|
|
105
|
-
declare enum GooglePlaySubscriptionState {
|
|
106
|
-
/** Unspecified subscription state. */
|
|
107
|
-
SUBSCRIPTION_STATE_UNSPECIFIED = "SUBSCRIPTION_STATE_UNSPECIFIED",
|
|
108
|
-
/**
|
|
109
|
-
* Subscription was created but awaiting payment during signup. In this state, all items are
|
|
110
|
-
* awaiting payment.
|
|
111
|
-
*/
|
|
112
|
-
SUBSCRIPTION_STATE_PENDING = "SUBSCRIPTION_STATE_PENDING",
|
|
113
|
-
/**
|
|
114
|
-
* Subscription is active.
|
|
115
|
-
* (1) If the subscription is an auto renewing plan, at least one item is autoRenewEnabled and not expired.
|
|
116
|
-
* (2) If the subscription is a prepaid plan, at least one item is not expired.
|
|
117
|
-
*/
|
|
118
|
-
SUBSCRIPTION_STATE_ACTIVE = "SUBSCRIPTION_STATE_ACTIVE",
|
|
119
|
-
/**
|
|
120
|
-
* Subscription is paused. The state is only available when the subscription is an auto renewing
|
|
121
|
-
* plan. In this state, all items are in paused state.
|
|
122
|
-
*/
|
|
123
|
-
SUBSCRIPTION_STATE_PAUSED = "SUBSCRIPTION_STATE_PAUSED",
|
|
124
|
-
/**
|
|
125
|
-
* Subscription is in grace period. The state is only available when the subscription is an auto
|
|
126
|
-
* renewing plan. In this state, all items are in grace period.
|
|
127
|
-
*/
|
|
128
|
-
SUBSCRIPTION_STATE_IN_GRACE_PERIOD = "SUBSCRIPTION_STATE_IN_GRACE_PERIOD",
|
|
129
|
-
/**
|
|
130
|
-
* Subscription is on hold (suspended). The state is only available when the subscription is an
|
|
131
|
-
* auto renewing plan. In this state, all items are on hold.
|
|
132
|
-
*/
|
|
133
|
-
SUBSCRIPTION_STATE_ON_HOLD = "SUBSCRIPTION_STATE_ON_HOLD",
|
|
134
|
-
/**
|
|
135
|
-
* Subscription is canceled but not expired yet. The state is only available when the subscription
|
|
136
|
-
* is an auto renewing plan. All items have autoRenewEnabled set to false.
|
|
137
|
-
*/
|
|
138
|
-
SUBSCRIPTION_STATE_CANCELED = "SUBSCRIPTION_STATE_CANCELED",
|
|
139
|
-
/** Subscription is expired. All items have expiryTime in the past. */
|
|
140
|
-
SUBSCRIPTION_STATE_EXPIRED = "SUBSCRIPTION_STATE_EXPIRED",
|
|
141
|
-
/**
|
|
142
|
-
* Pending transaction for subscription is canceled. If this pending purchase was for an existing
|
|
143
|
-
* subscription, use linkedPurchaseToken to get the current state of that subscription.
|
|
144
|
-
*/
|
|
145
|
-
SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED = "SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED"
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export { type DeveloperNotification, GooglePlaySubscriptionState, type OneTimeProductNotification, OneTimeProductNotificationType, type PubsubMessage, type SubscriptionNotification, SubscriptionNotificationType, type TestNotification, type VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType };
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Platform,\n SubscriptionStatus,\n ALL_PLATFORMS,\n AVAILABLE_STATUS,\n ALL_SUBSCRIPTION_STATUS,\n} from './subscription/index';\n\nexport { AppStoreConfig } from './app-store/config';\nexport { GooglePlayConfig } from './google-play/config';\nexport { StripeConfig } from './stripe/config';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAMO;AAEP,oBAA+B;AAC/B,IAAAA,iBAAiC;AACjC,IAAAA,iBAA6B;","names":["import_config"]}
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { ALL_PLATFORMS, ALL_SUBSCRIPTION_STATUS, AVAILABLE_STATUS, Platform, SubscriptionStatus } from './subscription/index.js';
|
|
2
|
-
export { AppStoreConfig } from './app-store/config.js';
|
|
3
|
-
export { GooglePlayConfig } from './google-play/config.js';
|
|
4
|
-
export { StripeConfig } from './stripe/config.js';
|
|
5
|
-
import './types.js';
|
|
6
|
-
import 'ms';
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Platform,\n SubscriptionStatus,\n ALL_PLATFORMS,\n AVAILABLE_STATUS,\n ALL_SUBSCRIPTION_STATUS,\n} from './subscription/index';\n\nexport { AppStoreConfig } from './app-store/config';\nexport { GooglePlayConfig } from './google-play/config';\nexport { StripeConfig } from './stripe/config';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;","names":[]}
|
package/dist/stripe/config.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Metadata } from '../types.js';
|
|
2
|
-
import 'ms';
|
|
3
|
-
|
|
4
|
-
type PriceId = `price_${string}`;
|
|
5
|
-
declare const addMethod: unique symbol;
|
|
6
|
-
declare class Product<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, PI extends string = never, I extends PriceId = never> {
|
|
7
|
-
readonly id: string;
|
|
8
|
-
readonly config: StripeConfig<NS, PE, PI>;
|
|
9
|
-
readonly plan: PE | null;
|
|
10
|
-
readonly prices: Map<PriceId, Metadata>;
|
|
11
|
-
defaultPriceId: I | null;
|
|
12
|
-
constructor(config: StripeConfig<NS, PE, PI>, id: string, plan?: PE | null);
|
|
13
|
-
price: <K extends PriceId>(priceId: K extends I ? never : K, metadata?: Metadata) => Product<NS, PE, PI, I | K>;
|
|
14
|
-
default: (defaultPriceId: I) => StripeConfig<NS, PE, PI>;
|
|
15
|
-
}
|
|
16
|
-
type Options = {
|
|
17
|
-
returnUrl: string;
|
|
18
|
-
cancelUrl: string;
|
|
19
|
-
successUrl: `${string}session_id={CHECKOUT_SESSION_ID}${string}`;
|
|
20
|
-
cancellationCouponId: string;
|
|
21
|
-
allowPromotionCodes: boolean;
|
|
22
|
-
};
|
|
23
|
-
declare class StripeConfig<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, PI extends string = never> {
|
|
24
|
-
private products;
|
|
25
|
-
returnUrl: string;
|
|
26
|
-
cancelUrl: string;
|
|
27
|
-
successUrl: `${string}session_id={CHECKOUT_SESSION_ID}${string}`;
|
|
28
|
-
cancellationCouponId: string;
|
|
29
|
-
allowPromotionCodes: boolean;
|
|
30
|
-
get productIds(): string[];
|
|
31
|
-
[addMethod]: (product: Product<NS, PE, PI>) => this;
|
|
32
|
-
private constructor();
|
|
33
|
-
static create: <NS_1 extends Lowercase<string>, PE_1 extends string>(options: Options) => StripeConfig<NS_1, PE_1, never>;
|
|
34
|
-
product: <K extends `${NS}.${Lowercase<string>}`>(productId: K extends PI ? never : K, plan?: PE | null) => Product<NS, PE, PI | K, never>;
|
|
35
|
-
getPlan: (productId: string) => PE;
|
|
36
|
-
getMode: (productId: string) => "payment" | "subscription";
|
|
37
|
-
getPriceId: (productId: string) => PriceId;
|
|
38
|
-
getCreditAmount: (productId: string, priceId?: string) => number;
|
|
39
|
-
private getCreditExpiresIn;
|
|
40
|
-
getCreditExpiresAt: (productId: string, priceId?: string) => string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { type PriceId, StripeConfig };
|
package/dist/stripe/handler.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Stripe } from 'stripe';
|
|
2
|
-
|
|
3
|
-
type StripeEventObject<T extends Stripe.Event.Type> = Extract<Stripe.Event, {
|
|
4
|
-
type: T;
|
|
5
|
-
}>['data']['object'];
|
|
6
|
-
type EventHandlerFn<T extends Stripe.Event.Type = Stripe.Event.Type> = (object: StripeEventObject<T>) => Promise<void>;
|
|
7
|
-
declare class StripeEventHandler {
|
|
8
|
-
private readonly handlers;
|
|
9
|
-
private constructor();
|
|
10
|
-
static create(): StripeEventHandler;
|
|
11
|
-
on: <T extends Stripe.Event.Type>(type: T, handler: EventHandlerFn<T>) => this;
|
|
12
|
-
process: (event: Stripe.Event) => Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { StripeEventHandler };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/stripe/index.ts"],"sourcesContent":["export {\n mapTime,\n mapPrice,\n mapCharge,\n mapInvoice,\n mapLineItem,\n mapPaymentIntent,\n mapCheckoutSession,\n mapSubscriptionStatus,\n minorUnits,\n price,\n getPurchaseProperties,\n getBeginCheckoutProperties,\n type Price,\n type CheckoutSession,\n type PaymentStatus,\n type PurchaseProperties,\n type ProductPrice,\n type BeginCheckoutProperties,\n} from './mapper';\nexport { StripeEventHandler } from './handler';\nexport {\n cancellationDetailsSchema,\n createCheckoutSessionSchema,\n type CancellationDetails,\n type CreateCheckoutSessionDTO,\n} from './schema';\nexport { METADATA_KEYS } from './metadata';\nexport { StripeConfig, type PriceId } from './config';\nexport { addPendingCheckout, removePendingCheckout, getPendingCheckouts } from './pending-checkout';\n\nexport type { Stripe } from 'stripe';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAmBO;AACP,qBAAmC;AACnC,oBAKO;AACP,sBAA8B;AAC9B,oBAA2C;AAC3C,8BAA+E;","names":[]}
|
package/dist/stripe/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { BeginCheckoutProperties, CheckoutSession, PaymentStatus, Price, ProductPrice, PurchaseProperties, getBeginCheckoutProperties, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price } from './mapper.js';
|
|
2
|
-
export { StripeEventHandler } from './handler.js';
|
|
3
|
-
export { CancellationDetails, CreateCheckoutSessionDTO, cancellationDetailsSchema, createCheckoutSessionSchema } from './schema.js';
|
|
4
|
-
export { METADATA_KEYS } from './metadata.js';
|
|
5
|
-
export { PriceId, StripeConfig } from './config.js';
|
|
6
|
-
export { addPendingCheckout, getPendingCheckouts, removePendingCheckout } from './pending-checkout.js';
|
|
7
|
-
export { Stripe } from 'stripe';
|
|
8
|
-
import '../subscription/index.js';
|
|
9
|
-
import 'zod/v4/core';
|
|
10
|
-
import 'zod/mini';
|
|
11
|
-
import '../types.js';
|
|
12
|
-
import 'ms';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/stripe/index.ts"],"sourcesContent":["export {\n mapTime,\n mapPrice,\n mapCharge,\n mapInvoice,\n mapLineItem,\n mapPaymentIntent,\n mapCheckoutSession,\n mapSubscriptionStatus,\n minorUnits,\n price,\n getPurchaseProperties,\n getBeginCheckoutProperties,\n type Price,\n type CheckoutSession,\n type PaymentStatus,\n type PurchaseProperties,\n type ProductPrice,\n type BeginCheckoutProperties,\n} from './mapper';\nexport { StripeEventHandler } from './handler';\nexport {\n cancellationDetailsSchema,\n createCheckoutSessionSchema,\n type CancellationDetails,\n type CreateCheckoutSessionDTO,\n} from './schema';\nexport { METADATA_KEYS } from './metadata';\nexport { StripeConfig, type PriceId } from './config';\nexport { addPendingCheckout, removePendingCheckout, getPendingCheckouts } from './pending-checkout';\n\nexport type { Stripe } from 'stripe';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,qBAAqB;AAC9B,SAAS,oBAAkC;AAC3C,SAAS,oBAAoB,uBAAuB,2BAA2B;","names":[]}
|
package/dist/stripe/mapper.d.ts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { Stripe } from 'stripe';
|
|
2
|
-
import { SubscriptionStatus } from '../subscription/index.js';
|
|
3
|
-
|
|
4
|
-
declare function mapTime<T extends number | null>(stripeTimestampSeconds: T): T extends number ? string : null;
|
|
5
|
-
type Price = {
|
|
6
|
-
id: string;
|
|
7
|
-
type: Stripe.Price.Type;
|
|
8
|
-
active: boolean;
|
|
9
|
-
billing_scheme: Stripe.Price.BillingScheme;
|
|
10
|
-
currency: Stripe.Price['currency'];
|
|
11
|
-
unit_amount: number | null;
|
|
12
|
-
unit_amount_decimal: string | null;
|
|
13
|
-
recurring: Stripe.Price.Recurring | null;
|
|
14
|
-
};
|
|
15
|
-
declare function mapPrice(price: Stripe.Price): Price;
|
|
16
|
-
declare function mapLineItem(item: Stripe.LineItem): {
|
|
17
|
-
id: string;
|
|
18
|
-
currency: string;
|
|
19
|
-
quantity: number | null;
|
|
20
|
-
description: string | null;
|
|
21
|
-
amount_tax: number;
|
|
22
|
-
amount_total: number;
|
|
23
|
-
amount_subtotal: number;
|
|
24
|
-
amount_discount: number;
|
|
25
|
-
price: Price | null;
|
|
26
|
-
};
|
|
27
|
-
type PaymentStatus = 'no_payment_required' | 'paid' | 'unpaid';
|
|
28
|
-
declare function mapCheckoutSession(session: Stripe.Checkout.Session): {
|
|
29
|
-
id: string;
|
|
30
|
-
url: string | null;
|
|
31
|
-
coupon: string | undefined;
|
|
32
|
-
livemode: boolean;
|
|
33
|
-
expires_at: number;
|
|
34
|
-
payment_status: PaymentStatus;
|
|
35
|
-
currency: string | null;
|
|
36
|
-
amount_total: number | null;
|
|
37
|
-
line_items: {
|
|
38
|
-
id: string;
|
|
39
|
-
currency: string;
|
|
40
|
-
quantity: number | null;
|
|
41
|
-
description: string | null;
|
|
42
|
-
amount_tax: number;
|
|
43
|
-
amount_total: number;
|
|
44
|
-
amount_subtotal: number;
|
|
45
|
-
amount_discount: number;
|
|
46
|
-
price: Price | null;
|
|
47
|
-
}[] | undefined;
|
|
48
|
-
};
|
|
49
|
-
declare function mapInvoice(i: Stripe.Invoice): {
|
|
50
|
-
id: string;
|
|
51
|
-
number: string | null;
|
|
52
|
-
total: number;
|
|
53
|
-
subtotal: number;
|
|
54
|
-
amount_due: number;
|
|
55
|
-
amount_paid: number;
|
|
56
|
-
amount_remaining: number;
|
|
57
|
-
currency: string;
|
|
58
|
-
billing_reason: Stripe.Invoice.BillingReason | null;
|
|
59
|
-
hosted_invoice_url: string | null | undefined;
|
|
60
|
-
invoice_pdf: string | null | undefined;
|
|
61
|
-
receipt_number: string | null;
|
|
62
|
-
status: Stripe.Invoice.Status | null;
|
|
63
|
-
created: number;
|
|
64
|
-
period_start: number;
|
|
65
|
-
period_end: number;
|
|
66
|
-
};
|
|
67
|
-
declare function mapPaymentIntent(intent: Stripe.PaymentIntent): {
|
|
68
|
-
id: string;
|
|
69
|
-
amount: number;
|
|
70
|
-
amount_capturable: number;
|
|
71
|
-
amount_received: number;
|
|
72
|
-
currency: string;
|
|
73
|
-
client_secret: string | null;
|
|
74
|
-
description: string | null;
|
|
75
|
-
status: Stripe.PaymentIntent.Status;
|
|
76
|
-
created: number;
|
|
77
|
-
};
|
|
78
|
-
declare function mapCharge(charge: Stripe.Charge): {
|
|
79
|
-
id: string;
|
|
80
|
-
description: string | null;
|
|
81
|
-
currency: string;
|
|
82
|
-
amount: number;
|
|
83
|
-
amount_captured: number;
|
|
84
|
-
amount_refunded: number;
|
|
85
|
-
receipt_email: string | null;
|
|
86
|
-
receipt_number: string | null;
|
|
87
|
-
receipt_url: string | null;
|
|
88
|
-
status: Stripe.Charge.Status;
|
|
89
|
-
created: number;
|
|
90
|
-
payment_intent: {
|
|
91
|
-
id: string;
|
|
92
|
-
amount: number;
|
|
93
|
-
amount_capturable: number;
|
|
94
|
-
amount_received: number;
|
|
95
|
-
currency: string;
|
|
96
|
-
client_secret: string | null;
|
|
97
|
-
description: string | null;
|
|
98
|
-
status: Stripe.PaymentIntent.Status;
|
|
99
|
-
created: number;
|
|
100
|
-
} | undefined;
|
|
101
|
-
};
|
|
102
|
-
type CheckoutSession = ReturnType<typeof mapCheckoutSession>;
|
|
103
|
-
type ProductPrice = {
|
|
104
|
-
id: string;
|
|
105
|
-
type: Stripe.Price.Type;
|
|
106
|
-
unit_amount: number;
|
|
107
|
-
currency: Stripe.Price['currency'];
|
|
108
|
-
product: {
|
|
109
|
-
id: Stripe.Product['id'];
|
|
110
|
-
name: Stripe.Product['name'];
|
|
111
|
-
description: Stripe.Product['description'];
|
|
112
|
-
livemode: Stripe.Product['livemode'];
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
declare function mapSubscriptionStatus(status: Stripe.Subscription.Status): SubscriptionStatus;
|
|
116
|
-
declare const ZERO_DECIMAL_CURRENCIES: string[];
|
|
117
|
-
declare function minorUnits(currency: string): 1 | 100;
|
|
118
|
-
declare function price(value: number, currency: string): number;
|
|
119
|
-
interface Item {
|
|
120
|
-
item_id: string;
|
|
121
|
-
item_name: string;
|
|
122
|
-
affiliation?: 'Google Store' | (string & {});
|
|
123
|
-
coupon?: string;
|
|
124
|
-
discount?: number;
|
|
125
|
-
index?: number;
|
|
126
|
-
item_brand?: string;
|
|
127
|
-
item_category?: string;
|
|
128
|
-
item_category2?: string;
|
|
129
|
-
item_category3?: string;
|
|
130
|
-
item_category4?: string;
|
|
131
|
-
item_category5?: string;
|
|
132
|
-
item_list_id?: string;
|
|
133
|
-
item_list_name?: string;
|
|
134
|
-
item_variant?: string;
|
|
135
|
-
location_id?: string;
|
|
136
|
-
price?: number;
|
|
137
|
-
quantity?: number;
|
|
138
|
-
}
|
|
139
|
-
interface PurchaseProperties {
|
|
140
|
-
currency: string;
|
|
141
|
-
value: number;
|
|
142
|
-
transaction_id: string;
|
|
143
|
-
coupon?: string;
|
|
144
|
-
shipping?: number;
|
|
145
|
-
tax?: number;
|
|
146
|
-
items?: Item[];
|
|
147
|
-
}
|
|
148
|
-
interface BeginCheckoutProperties {
|
|
149
|
-
currency: string;
|
|
150
|
-
value: number;
|
|
151
|
-
coupon?: string;
|
|
152
|
-
items: Item[];
|
|
153
|
-
}
|
|
154
|
-
declare function getPurchaseProperties(session: CheckoutSession): PurchaseProperties;
|
|
155
|
-
declare function getBeginCheckoutProperties(p: ProductPrice): BeginCheckoutProperties;
|
|
156
|
-
|
|
157
|
-
export { type BeginCheckoutProperties, type CheckoutSession, type Item, type PaymentStatus, type Price, type ProductPrice, type PurchaseProperties, ZERO_DECIMAL_CURRENCIES, getBeginCheckoutProperties, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const METADATA_KEYS: {
|
|
2
|
-
readonly USER_ID: "user_id";
|
|
3
|
-
readonly USER_ACCOUNT_TOKEN: "user_account_token";
|
|
4
|
-
readonly PRODUCT_ID: "product_id";
|
|
5
|
-
readonly REFERRAL_CODE: "referral_code";
|
|
6
|
-
readonly CREDIT_AMOUNT: "credit_amount";
|
|
7
|
-
readonly CREDIT_EXPIRES_IN: "credit_expires_in";
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { METADATA_KEYS };
|
package/dist/stripe/schema.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as zod_v4_core from 'zod/v4/core';
|
|
2
|
-
import * as zod_mini from 'zod/mini';
|
|
3
|
-
import { output } from 'zod/mini';
|
|
4
|
-
import { Stripe } from 'stripe';
|
|
5
|
-
|
|
6
|
-
declare const cancellationDetailsSchema: zod_mini.ZodMiniObject<{
|
|
7
|
-
comment: zod_mini.ZodMiniOptional<zod_mini.ZodMiniNullable<zod_mini.ZodMiniString<string>>>;
|
|
8
|
-
feedback: zod_mini.ZodMiniOptional<zod_mini.ZodMiniNullable<zod_mini.ZodMiniEnum<{
|
|
9
|
-
other: "other";
|
|
10
|
-
customer_service: "customer_service";
|
|
11
|
-
low_quality: "low_quality";
|
|
12
|
-
missing_features: "missing_features";
|
|
13
|
-
switched_service: "switched_service";
|
|
14
|
-
too_complex: "too_complex";
|
|
15
|
-
too_expensive: "too_expensive";
|
|
16
|
-
unused: "unused";
|
|
17
|
-
}>>>;
|
|
18
|
-
resubscribeIntent: zod_mini.ZodMiniOptional<zod_mini.ZodMiniNullable<zod_mini.ZodMiniEnum<{
|
|
19
|
-
maybe: "maybe";
|
|
20
|
-
no: "no";
|
|
21
|
-
yes: "yes";
|
|
22
|
-
}>>>;
|
|
23
|
-
}, zod_v4_core.$strip>;
|
|
24
|
-
declare function createCheckoutSessionSchema(productIds: string[]): zod_mini.ZodMiniObject<{
|
|
25
|
-
quantity: zod_mini.ZodMiniDefault<zod_mini.ZodMiniNumberFormat>;
|
|
26
|
-
productId: zod_mini.ZodMiniEnum<{
|
|
27
|
-
[x: string]: string;
|
|
28
|
-
}>;
|
|
29
|
-
cancelUrl: zod_mini.ZodMiniOptional<zod_mini.ZodMiniURL>;
|
|
30
|
-
successUrl: zod_mini.ZodMiniOptional<zod_mini.ZodMiniURL>;
|
|
31
|
-
}, zod_v4_core.$strip>;
|
|
32
|
-
interface CancellationDetails extends output<typeof cancellationDetailsSchema> {
|
|
33
|
-
reason?: Stripe.Subscription.CancellationDetails.Reason | null;
|
|
34
|
-
}
|
|
35
|
-
interface CreateCheckoutSessionDTO {
|
|
36
|
-
productId: string;
|
|
37
|
-
cancelUrl?: string;
|
|
38
|
-
successUrl?: `${string}session_id={CHECKOUT_SESSION_ID}${string}`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { type CancellationDetails, type CreateCheckoutSessionDTO, cancellationDetailsSchema, createCheckoutSessionSchema };
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
declare enum Platform {
|
|
2
|
-
APPLE = "APPLE",
|
|
3
|
-
GOOGLE = "GOOGLE",
|
|
4
|
-
STRIPE = "STRIPE"
|
|
5
|
-
}
|
|
6
|
-
declare const ALL_PLATFORMS: readonly [Platform.APPLE, Platform.GOOGLE, Platform.STRIPE];
|
|
7
|
-
/**
|
|
8
|
-
* [Stripe Subscription Status](https://stripe.com/docs/api/subscriptions/object#subscription_object-status)
|
|
9
|
-
* [Stripe Subscription Lifecycle](https://docs.stripe.com/billing/subscriptions/overview)
|
|
10
|
-
*
|
|
11
|
-
* provision product for customer when Status = TRIALING, ACTIVE, IN_GRACE_PERIOD
|
|
12
|
-
*/
|
|
13
|
-
declare enum SubscriptionStatus {
|
|
14
|
-
/**
|
|
15
|
-
* The subscription is currently in a trial period and it’s safe to provision your product for
|
|
16
|
-
* your customer. The subscription transitions automatically to active when the first payment
|
|
17
|
-
* is made.
|
|
18
|
-
*
|
|
19
|
-
* Google: play(LineItems[0].OfferDetails.OfferId == 'xx')
|
|
20
|
-
*
|
|
21
|
-
* Platform: Apple, Google, Stripe
|
|
22
|
-
* */
|
|
23
|
-
TRIALING = "TRIALING",
|
|
24
|
-
/**
|
|
25
|
-
* The subscription is in good standing and the most recent payment is successful. It’s safe to
|
|
26
|
-
* provision your product for your customer.
|
|
27
|
-
*
|
|
28
|
-
* Platform: Apple, Google, Stripe
|
|
29
|
-
* */
|
|
30
|
-
ACTIVE = "ACTIVE",
|
|
31
|
-
/**
|
|
32
|
-
* Apple: The subscription enters the billing retry period. If the subtype is GRACE_PERIOD,
|
|
33
|
-
* continue to provide service through the grace period. If the subtype is empty, the
|
|
34
|
-
* subscription isn’t in a grace period and you can stop providing the subscription service.
|
|
35
|
-
*
|
|
36
|
-
* Google: Subscription is in grace period. The state is only available when the subscription
|
|
37
|
-
* is an auto renewing plan. In this state, all items are in grace period.
|
|
38
|
-
*
|
|
39
|
-
* Platform: Apple, Google
|
|
40
|
-
* */
|
|
41
|
-
IN_GRACE_PERIOD = "IN_GRACE_PERIOD",
|
|
42
|
-
/**
|
|
43
|
-
* A successful payment needs to be made within 23 hours to activate the subscription. Or the
|
|
44
|
-
* payment requires action, like customer authentication. Subscriptions can also be incomplete
|
|
45
|
-
* if there’s a pending payment and the PaymentIntent status would be processing.
|
|
46
|
-
*
|
|
47
|
-
* Platform: Stripe
|
|
48
|
-
* */
|
|
49
|
-
INCOMPLETE = "INCOMPLETE",
|
|
50
|
-
/**
|
|
51
|
-
* The initial payment on the subscription failed and no successful payment was made within 23
|
|
52
|
-
* hours of creating the subscription. These subscriptions don’t bill customers. This status
|
|
53
|
-
* exists so you can track customers that failed to activate their subscriptions.
|
|
54
|
-
*
|
|
55
|
-
* Platform: Stripe
|
|
56
|
-
* */
|
|
57
|
-
INCOMPLETE_EXPIRED = "INCOMPLETE_EXPIRED",
|
|
58
|
-
/**
|
|
59
|
-
* Subscription was created but awaiting payment during signup. In this state, all items are
|
|
60
|
-
* awaiting payment.
|
|
61
|
-
*
|
|
62
|
-
* Platform: Google
|
|
63
|
-
* */
|
|
64
|
-
PENDING = "PENDING",
|
|
65
|
-
/**
|
|
66
|
-
* Pending transaction for subscription is canceled. If this pending purchase was for an
|
|
67
|
-
* existing subscription, use linkedPurchaseToken to get the current state of that subscription.
|
|
68
|
-
*
|
|
69
|
-
* Platform: Google
|
|
70
|
-
* */
|
|
71
|
-
PENDING_PURCHASE_CANCELED = "PENDING_PURCHASE_CANCELED",
|
|
72
|
-
/**
|
|
73
|
-
* Payment on the latest finalized invoice either failed or wasn’t attempted. The subscription
|
|
74
|
-
* continues to create invoices. Your subscription settings determine the subscription’s next
|
|
75
|
-
* state. If the invoice is still unpaid after all Smart Retries have been attempted, you can
|
|
76
|
-
* configure the subscription to move to canceled, unpaid, or leave it as past_due. To move the
|
|
77
|
-
* subscription to active, pay the most recent invoice before its due date.
|
|
78
|
-
*
|
|
79
|
-
* Platform: Stripe
|
|
80
|
-
* */
|
|
81
|
-
PAST_DUE = "PAST_DUE",
|
|
82
|
-
/**
|
|
83
|
-
* Subscription is on hold (suspended). The state is only available when the subscription is an
|
|
84
|
-
* auto renewing plan. In this state, all items are on hold. Grace period ends or Active period
|
|
85
|
-
* ends but not grace period
|
|
86
|
-
*
|
|
87
|
-
* Platform: Google
|
|
88
|
-
* */
|
|
89
|
-
ON_HOLD = "ON_HOLD",
|
|
90
|
-
/**
|
|
91
|
-
* The subscription has been canceled. During cancellation, automatic collection for all unpaid
|
|
92
|
-
* invoices is disabled (auto_advance=false). This is a terminal state that can’t be updated.
|
|
93
|
-
*
|
|
94
|
-
* Platform: Apple, Google, Stripe
|
|
95
|
-
* */
|
|
96
|
-
CANCELED = "CANCELED",
|
|
97
|
-
/**
|
|
98
|
-
* The latest invoice hasn’t been paid but the subscription remains in place. The latest invoice
|
|
99
|
-
* remains open and invoices continue to be generated but payments aren’t attempted. You should
|
|
100
|
-
* revoke access to your product when the subscription is unpaid since payments were already
|
|
101
|
-
* attempted and retried when it was past_due. To move the subscription to active, pay the most
|
|
102
|
-
* recent invoice before its due date.
|
|
103
|
-
*
|
|
104
|
-
* Platform: Stripe
|
|
105
|
-
* */
|
|
106
|
-
UNPAID = "UNPAID",
|
|
107
|
-
/**
|
|
108
|
-
* Google: Subscription is paused. The state is only available when the subscription is an auto
|
|
109
|
-
* renewing plan. In this state, all items are in paused state.
|
|
110
|
-
*
|
|
111
|
-
* Stripe: The subscription has ended its trial period without a default payment method and the
|
|
112
|
-
* trial_settings.end_behavior.missing_payment_method is set to pause. Invoices will no longer
|
|
113
|
-
* be created for the subscription. After a default payment method has been attached to the
|
|
114
|
-
* customer, you can resume the subscription.
|
|
115
|
-
*
|
|
116
|
-
* Platform: Google, Stripe
|
|
117
|
-
* */
|
|
118
|
-
PAUSED = "PAUSED",
|
|
119
|
-
/**
|
|
120
|
-
* For example, a user buys a subscription and receives a purchase token A. The
|
|
121
|
-
* linkedPurchaseToken field will not be set in the API response because the purchase token
|
|
122
|
-
* belongs to a brand new subscription.
|
|
123
|
-
*
|
|
124
|
-
* If the user upgrades their subscription, a new purchase token B will be generated. Since the
|
|
125
|
-
* upgrade is replacing the subscription from purchase token A, the linkedPurchaseToken field
|
|
126
|
-
* for token B will be set to point to token A. Notice it points backwards in time to the
|
|
127
|
-
* original purchase token.
|
|
128
|
-
*
|
|
129
|
-
* +---------------------------+ +------------------------+ +------------------------+
|
|
130
|
-
* | Step 1 first purchase | | Step 2 upgrades | | Step 3 downgrades |
|
|
131
|
-
* | purchaseToken: A |->| purchaseToken: B |->| purchaseToken: C |
|
|
132
|
-
* | linkedPurchaseToken: null | | linkedPurchaseToken: A | | linkedPurchaseToken: B |
|
|
133
|
-
* +---------------------------+ +------------------------+ +------------------------+
|
|
134
|
-
*
|
|
135
|
-
* Platform: Google
|
|
136
|
-
* */
|
|
137
|
-
REPLACED = "REPLACED",
|
|
138
|
-
/**
|
|
139
|
-
* Google: Subscription is expired. All items have expiryTime in the past.
|
|
140
|
-
*
|
|
141
|
-
* Platform: Apple, Google
|
|
142
|
-
* */
|
|
143
|
-
EXPIRED = "EXPIRED"
|
|
144
|
-
}
|
|
145
|
-
declare const AVAILABLE_STATUS: SubscriptionStatus[];
|
|
146
|
-
declare const ALL_SUBSCRIPTION_STATUS: readonly [SubscriptionStatus.TRIALING, SubscriptionStatus.ACTIVE, SubscriptionStatus.IN_GRACE_PERIOD, SubscriptionStatus.INCOMPLETE, SubscriptionStatus.INCOMPLETE_EXPIRED, SubscriptionStatus.PENDING, SubscriptionStatus.PENDING_PURCHASE_CANCELED, SubscriptionStatus.PAST_DUE, SubscriptionStatus.ON_HOLD, SubscriptionStatus.CANCELED, SubscriptionStatus.UNPAID, SubscriptionStatus.PAUSED, SubscriptionStatus.REPLACED, SubscriptionStatus.EXPIRED];
|
|
147
|
-
|
|
148
|
-
export { ALL_PLATFORMS, ALL_SUBSCRIPTION_STATUS, AVAILABLE_STATUS, Platform, SubscriptionStatus };
|
package/dist/types.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { StringValue } from 'ms';\n\nexport type Metadata = { credits: number; expiresIn: StringValue };\n\nexport type IsUnique<T extends readonly unknown[]> = T extends readonly [infer First, ...infer Rest]\n ? First extends Rest[number]\n ? false\n : IsUnique<Rest>\n : true;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|