recur-tw 0.9.4 → 0.9.7

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/server.cjs CHANGED
@@ -20,7 +20,7 @@ var RecurAPIError = class extends Error {
20
20
 
21
21
  // package.json
22
22
  var package_default = {
23
- version: "0.9.4"};
23
+ version: "0.9.7"};
24
24
 
25
25
  // src/server/resources/portal.ts
26
26
  var SDK_VERSION = package_default.version;
package/dist/server.js CHANGED
@@ -18,7 +18,7 @@ var RecurAPIError = class extends Error {
18
18
 
19
19
  // package.json
20
20
  var package_default = {
21
- version: "0.9.4"};
21
+ version: "0.9.7"};
22
22
 
23
23
  // src/server/resources/portal.ts
24
24
  var SDK_VERSION = package_default.version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recur-tw",
3
- "version": "0.9.4",
3
+ "version": "0.9.7",
4
4
  "description": "React & Vanilla JS SDK for embedding subscription checkout flows (Taiwan / PAYUNi)",
5
5
  "type": "module",
6
6
  "private": false,
package/dist/server.d.cts DELETED
@@ -1,194 +0,0 @@
1
- /**
2
- * Recur Server SDK Types
3
- */
4
- interface RecurConfig {
5
- /**
6
- * Secret API key for authentication
7
- * Get this from your organization settings
8
- *
9
- * @example 'sk_test_abc123...' or 'sk_live_xyz789...'
10
- */
11
- secretKey: string;
12
- /**
13
- * Base URL for API calls
14
- * Defaults to 'https://api.recur.tw'
15
- */
16
- baseUrl?: string;
17
- }
18
- /**
19
- * Parameters for creating a portal session
20
- *
21
- * Customer Identification (at least one required):
22
- * - customer: Internal customer ID in Recur (highest priority)
23
- * - externalId: Customer's external ID from your system
24
- * - email: Customer's email address (lowest priority)
25
- */
26
- interface PortalSessionCreateParams {
27
- /**
28
- * The internal ID of the customer to create a portal session for
29
- * Takes highest priority when multiple identifiers are provided
30
- */
31
- customer?: string;
32
- /**
33
- * Customer's email address
34
- * Used to identify the customer if `customer` and `externalId` are not provided
35
- */
36
- email?: string;
37
- /**
38
- * Customer's external ID from your system
39
- * Used to identify the customer if `customer` is not provided
40
- */
41
- externalId?: string;
42
- /**
43
- * The URL to redirect the customer to when they exit the portal
44
- * If not provided, uses the default return URL from portal configuration
45
- */
46
- returnUrl?: string;
47
- /**
48
- * The ID of a specific portal configuration to use
49
- * If not provided, uses the default configuration
50
- */
51
- configuration?: string;
52
- /**
53
- * Preferred locale for the portal
54
- */
55
- locale?: 'zh-TW' | 'en';
56
- }
57
- interface PortalSession {
58
- /**
59
- * Unique identifier for the portal session
60
- */
61
- id: string;
62
- /**
63
- * String representing the object's type
64
- */
65
- object: 'portal.session';
66
- /**
67
- * The URL to redirect the customer to access the portal
68
- */
69
- url: string;
70
- /**
71
- * The ID of the customer for this session
72
- */
73
- customer: string;
74
- /**
75
- * The URL to redirect the customer when they exit the portal
76
- */
77
- returnUrl: string;
78
- /**
79
- * The status of the session
80
- */
81
- status: 'active' | 'expired';
82
- /**
83
- * Time at which the session expires (ISO 8601)
84
- */
85
- expiresAt: string;
86
- /**
87
- * Time at which the session was last accessed (ISO 8601), or null
88
- */
89
- accessedAt: string | null;
90
- /**
91
- * Time at which the session was created (ISO 8601)
92
- */
93
- createdAt: string;
94
- }
95
- interface RecurError {
96
- type: 'authentication_error' | 'invalid_request_error' | 'api_error';
97
- code: string;
98
- message: string;
99
- details?: unknown;
100
- }
101
- declare class RecurAPIError extends Error {
102
- readonly type: string;
103
- readonly code: string;
104
- readonly statusCode: number;
105
- constructor(error: RecurError, statusCode: number);
106
- }
107
-
108
- /**
109
- * Portal Sessions Resource
110
- *
111
- * Create portal sessions to allow customers to manage their subscriptions
112
- */
113
-
114
- declare class PortalSessions {
115
- private config;
116
- constructor(config: RecurConfig);
117
- /**
118
- * Create a portal session for a customer
119
- *
120
- * Customer can be identified using one of:
121
- * - `customer`: Internal customer ID (highest priority)
122
- * - `externalId`: External customer ID from your system
123
- * - `email`: Customer's email address (lowest priority)
124
- *
125
- * @param params - Portal session creation parameters
126
- * @returns The created portal session with URL
127
- *
128
- * @example
129
- * ```typescript
130
- * // By customer ID
131
- * const session = await recur.portal.sessions.create({
132
- * customer: 'cus_xxx',
133
- * returnUrl: 'https://myapp.com/account',
134
- * });
135
- *
136
- * // By email
137
- * const session = await recur.portal.sessions.create({
138
- * email: 'customer@example.com',
139
- * returnUrl: 'https://myapp.com/account',
140
- * });
141
- *
142
- * // By external ID
143
- * const session = await recur.portal.sessions.create({
144
- * externalId: 'user_123',
145
- * returnUrl: 'https://myapp.com/account',
146
- * });
147
- *
148
- * // Redirect the customer to the portal
149
- * redirect(session.url);
150
- * ```
151
- */
152
- create(params: PortalSessionCreateParams): Promise<PortalSession>;
153
- }
154
- declare class Portal {
155
- readonly sessions: PortalSessions;
156
- constructor(config: RecurConfig);
157
- }
158
-
159
- /**
160
- * Recur Server SDK
161
- *
162
- * Server-side SDK for interacting with the Recur API
163
- * Use this in your backend (API routes, server actions, etc.)
164
- *
165
- * @example
166
- * ```typescript
167
- * import { Recur } from 'recur-tw/server';
168
- *
169
- * const recur = new Recur(process.env.RECUR_SECRET_KEY!);
170
- *
171
- * // Create a portal session
172
- * const session = await recur.portal.sessions.create({
173
- * customer: 'cus_xxx',
174
- * returnUrl: 'https://myapp.com/account',
175
- * });
176
- * ```
177
- */
178
-
179
- declare class Recur {
180
- private config;
181
- /**
182
- * Portal resource for managing customer portal sessions
183
- */
184
- readonly portal: Portal;
185
- /**
186
- * Create a new Recur client
187
- *
188
- * @param secretKey - Your Recur secret API key (sk_test_xxx or sk_live_xxx)
189
- * @param options - Additional configuration options
190
- */
191
- constructor(secretKey: string, options?: Omit<RecurConfig, 'secretKey'>);
192
- }
193
-
194
- export { type PortalSession, type PortalSessionCreateParams, Recur, RecurAPIError, type RecurConfig, type RecurError };
package/dist/server.d.ts DELETED
@@ -1,194 +0,0 @@
1
- /**
2
- * Recur Server SDK Types
3
- */
4
- interface RecurConfig {
5
- /**
6
- * Secret API key for authentication
7
- * Get this from your organization settings
8
- *
9
- * @example 'sk_test_abc123...' or 'sk_live_xyz789...'
10
- */
11
- secretKey: string;
12
- /**
13
- * Base URL for API calls
14
- * Defaults to 'https://api.recur.tw'
15
- */
16
- baseUrl?: string;
17
- }
18
- /**
19
- * Parameters for creating a portal session
20
- *
21
- * Customer Identification (at least one required):
22
- * - customer: Internal customer ID in Recur (highest priority)
23
- * - externalId: Customer's external ID from your system
24
- * - email: Customer's email address (lowest priority)
25
- */
26
- interface PortalSessionCreateParams {
27
- /**
28
- * The internal ID of the customer to create a portal session for
29
- * Takes highest priority when multiple identifiers are provided
30
- */
31
- customer?: string;
32
- /**
33
- * Customer's email address
34
- * Used to identify the customer if `customer` and `externalId` are not provided
35
- */
36
- email?: string;
37
- /**
38
- * Customer's external ID from your system
39
- * Used to identify the customer if `customer` is not provided
40
- */
41
- externalId?: string;
42
- /**
43
- * The URL to redirect the customer to when they exit the portal
44
- * If not provided, uses the default return URL from portal configuration
45
- */
46
- returnUrl?: string;
47
- /**
48
- * The ID of a specific portal configuration to use
49
- * If not provided, uses the default configuration
50
- */
51
- configuration?: string;
52
- /**
53
- * Preferred locale for the portal
54
- */
55
- locale?: 'zh-TW' | 'en';
56
- }
57
- interface PortalSession {
58
- /**
59
- * Unique identifier for the portal session
60
- */
61
- id: string;
62
- /**
63
- * String representing the object's type
64
- */
65
- object: 'portal.session';
66
- /**
67
- * The URL to redirect the customer to access the portal
68
- */
69
- url: string;
70
- /**
71
- * The ID of the customer for this session
72
- */
73
- customer: string;
74
- /**
75
- * The URL to redirect the customer when they exit the portal
76
- */
77
- returnUrl: string;
78
- /**
79
- * The status of the session
80
- */
81
- status: 'active' | 'expired';
82
- /**
83
- * Time at which the session expires (ISO 8601)
84
- */
85
- expiresAt: string;
86
- /**
87
- * Time at which the session was last accessed (ISO 8601), or null
88
- */
89
- accessedAt: string | null;
90
- /**
91
- * Time at which the session was created (ISO 8601)
92
- */
93
- createdAt: string;
94
- }
95
- interface RecurError {
96
- type: 'authentication_error' | 'invalid_request_error' | 'api_error';
97
- code: string;
98
- message: string;
99
- details?: unknown;
100
- }
101
- declare class RecurAPIError extends Error {
102
- readonly type: string;
103
- readonly code: string;
104
- readonly statusCode: number;
105
- constructor(error: RecurError, statusCode: number);
106
- }
107
-
108
- /**
109
- * Portal Sessions Resource
110
- *
111
- * Create portal sessions to allow customers to manage their subscriptions
112
- */
113
-
114
- declare class PortalSessions {
115
- private config;
116
- constructor(config: RecurConfig);
117
- /**
118
- * Create a portal session for a customer
119
- *
120
- * Customer can be identified using one of:
121
- * - `customer`: Internal customer ID (highest priority)
122
- * - `externalId`: External customer ID from your system
123
- * - `email`: Customer's email address (lowest priority)
124
- *
125
- * @param params - Portal session creation parameters
126
- * @returns The created portal session with URL
127
- *
128
- * @example
129
- * ```typescript
130
- * // By customer ID
131
- * const session = await recur.portal.sessions.create({
132
- * customer: 'cus_xxx',
133
- * returnUrl: 'https://myapp.com/account',
134
- * });
135
- *
136
- * // By email
137
- * const session = await recur.portal.sessions.create({
138
- * email: 'customer@example.com',
139
- * returnUrl: 'https://myapp.com/account',
140
- * });
141
- *
142
- * // By external ID
143
- * const session = await recur.portal.sessions.create({
144
- * externalId: 'user_123',
145
- * returnUrl: 'https://myapp.com/account',
146
- * });
147
- *
148
- * // Redirect the customer to the portal
149
- * redirect(session.url);
150
- * ```
151
- */
152
- create(params: PortalSessionCreateParams): Promise<PortalSession>;
153
- }
154
- declare class Portal {
155
- readonly sessions: PortalSessions;
156
- constructor(config: RecurConfig);
157
- }
158
-
159
- /**
160
- * Recur Server SDK
161
- *
162
- * Server-side SDK for interacting with the Recur API
163
- * Use this in your backend (API routes, server actions, etc.)
164
- *
165
- * @example
166
- * ```typescript
167
- * import { Recur } from 'recur-tw/server';
168
- *
169
- * const recur = new Recur(process.env.RECUR_SECRET_KEY!);
170
- *
171
- * // Create a portal session
172
- * const session = await recur.portal.sessions.create({
173
- * customer: 'cus_xxx',
174
- * returnUrl: 'https://myapp.com/account',
175
- * });
176
- * ```
177
- */
178
-
179
- declare class Recur {
180
- private config;
181
- /**
182
- * Portal resource for managing customer portal sessions
183
- */
184
- readonly portal: Portal;
185
- /**
186
- * Create a new Recur client
187
- *
188
- * @param secretKey - Your Recur secret API key (sk_test_xxx or sk_live_xxx)
189
- * @param options - Additional configuration options
190
- */
191
- constructor(secretKey: string, options?: Omit<RecurConfig, 'secretKey'>);
192
- }
193
-
194
- export { type PortalSession, type PortalSessionCreateParams, Recur, RecurAPIError, type RecurConfig, type RecurError };