@plyaz/types 1.16.6 → 1.16.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CurrencyCode } from '../../../locale/types';
|
|
2
2
|
import type { FeeBreakdown, Money } from '../../transaction';
|
|
3
3
|
import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE, PAYMENT_STATUS } from '../provider-capability';
|
|
4
|
-
import type { WITHDRAWAL_STATUS } from './enums';
|
|
4
|
+
import type { SUBSCRIPTION_STATUS, WITHDRAWAL_STATUS } from './enums';
|
|
5
5
|
/**
|
|
6
6
|
* Parameters required to initiate a refund.
|
|
7
7
|
* Refunds can be full or partial.
|
|
@@ -353,26 +353,32 @@ 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
|
-
/** Plan to subscribe the user to
|
|
357
|
-
plan:
|
|
358
|
-
/**
|
|
359
|
-
|
|
356
|
+
/** Plan to subscribe the user to (internal plan name) */
|
|
357
|
+
plan: string;
|
|
358
|
+
/** Stripe Price ID for the subscription */
|
|
359
|
+
priceId: string;
|
|
360
|
+
/** Optional payment method ID (for existing customers) */
|
|
361
|
+
paymentMethodId?: string;
|
|
360
362
|
/** Optional trial period in days */
|
|
361
363
|
trialDays?: number;
|
|
364
|
+
/** URL to redirect after successful checkout */
|
|
365
|
+
successUrl: string;
|
|
366
|
+
/** URL to redirect after canceled checkout */
|
|
367
|
+
cancelUrl: string;
|
|
362
368
|
/** Optional metadata for additional info */
|
|
363
369
|
metadata?: TMetadata;
|
|
364
370
|
}
|
|
365
371
|
export interface SubscriptionResult<TMetadata extends object = object> {
|
|
366
|
-
/**
|
|
367
|
-
|
|
368
|
-
/**
|
|
372
|
+
/** Checkout session URL for user to complete subscription */
|
|
373
|
+
checkoutUrl: string;
|
|
374
|
+
/** Optional: provider subscription ID (available after webhook confirmation) */
|
|
369
375
|
providerSubscriptionId?: string;
|
|
370
376
|
/** Status: active, trialing, paused, canceled, expired */
|
|
371
|
-
status
|
|
372
|
-
/** Next billing date */
|
|
377
|
+
status?: SUBSCRIPTION_STATUS;
|
|
378
|
+
/** Next billing date (available after webhook) */
|
|
373
379
|
nextBillingDate?: Date;
|
|
374
|
-
/** Subscription start date */
|
|
375
|
-
startedAt
|
|
380
|
+
/** Subscription start date (available after webhook) */
|
|
381
|
+
startedAt?: Date;
|
|
376
382
|
/** Provider-specific metadata */
|
|
377
383
|
metadata?: TMetadata;
|
|
378
384
|
}
|
package/package.json
CHANGED