@plyaz/types 1.16.7 → 1.16.9
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.
|
@@ -5,6 +5,17 @@ import type { PROVIDER_PRODUCT_STATUS } from './enums';
|
|
|
5
5
|
* Billing cycle for subscription or recurring payments
|
|
6
6
|
*/
|
|
7
7
|
export type BillingCycle = 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'yearly' | 'one-time';
|
|
8
|
+
export type Interval = 'day' | 'week' | 'month' | 'year';
|
|
9
|
+
export interface CustomInterval {
|
|
10
|
+
/** Stripe-compatible interval (for fixed intervals) */
|
|
11
|
+
interval?: Interval;
|
|
12
|
+
/** Number of intervals (for fixed intervals) */
|
|
13
|
+
interval_count?: number;
|
|
14
|
+
/** Custom start date (optional) */
|
|
15
|
+
startDate?: Date;
|
|
16
|
+
/** Custom end date (optional) */
|
|
17
|
+
endDate?: Date;
|
|
18
|
+
}
|
|
8
19
|
/**
|
|
9
20
|
* Parameters to create a new product in the payment provider
|
|
10
21
|
*/
|
|
@@ -353,20 +353,40 @@ export interface SavedPaymentMethod<TMetadata extends object = object> {
|
|
|
353
353
|
export interface CreateSubscriptionParams<TMetadata extends object = object> {
|
|
354
354
|
/** Plyaz user ID (Stripe customer ID or your internal user ID mapped to Stripe) */
|
|
355
355
|
userId: string;
|
|
356
|
+
/** Selected payment method from supported options */
|
|
357
|
+
paymentMethod: PAYMENT_METHOD;
|
|
358
|
+
/**
|
|
359
|
+
* Optional provider override for advanced use cases
|
|
360
|
+
* If not specified, optimal provider will be auto-selected
|
|
361
|
+
*/
|
|
362
|
+
provider?: PAYMENT_PROVIDER_TYPE;
|
|
356
363
|
/** Plan to subscribe the user to (internal plan name) */
|
|
357
364
|
plan: string;
|
|
358
|
-
/**
|
|
365
|
+
/** Product pricing */
|
|
359
366
|
priceId: string;
|
|
360
|
-
/** Optional payment method ID (for existing customers) */
|
|
361
|
-
paymentMethodId?: string;
|
|
362
367
|
/** Optional trial period in days */
|
|
363
368
|
trialDays?: number;
|
|
364
|
-
/** URL to redirect after successful
|
|
365
|
-
|
|
366
|
-
/** URL to redirect after
|
|
367
|
-
cancelUrl
|
|
369
|
+
/** URL to redirect user after successful payment completion */
|
|
370
|
+
returnUrl?: string;
|
|
371
|
+
/** URL to redirect user after payment cancellation */
|
|
372
|
+
cancelUrl?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Idempotency key to prevent duplicate payment processing
|
|
375
|
+
* Should be unique per payment attempt, recommended: UUID v4
|
|
376
|
+
*/
|
|
377
|
+
idempotencyKey?: string;
|
|
368
378
|
/** Optional metadata for additional info */
|
|
369
|
-
metadata?:
|
|
379
|
+
metadata?: {
|
|
380
|
+
/** Geographic and device information */
|
|
381
|
+
geoInfo?: {
|
|
382
|
+
country: string;
|
|
383
|
+
region?: string;
|
|
384
|
+
city?: string;
|
|
385
|
+
timezone?: string;
|
|
386
|
+
};
|
|
387
|
+
/** Custom metadata fields */
|
|
388
|
+
custom?: TMetadata;
|
|
389
|
+
};
|
|
370
390
|
}
|
|
371
391
|
export interface SubscriptionResult<TMetadata extends object = object> {
|
|
372
392
|
/** Checkout session URL for user to complete subscription */
|
package/package.json
CHANGED