@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.
@@ -6,3 +6,10 @@ export declare enum WITHDRAWAL_STATUS {
6
6
  Failed = "failed",
7
7
  Cancelled = "cancelled"
8
8
  }
9
+ export declare enum SUBSCRIPTION_STATUS {
10
+ ACTIVE = "active",
11
+ TRIALING = "trialing",
12
+ PAUSED = "paused",
13
+ CANCELED = "canceled",
14
+ EXPIRED = "expired"
15
+ }
@@ -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: 'standard' | 'pro' | 'enterprise' */
357
- plan: 'standard' | 'pro' | 'enterprise';
358
- /** Payment method to charge (Stripe payment method ID) */
359
- paymentMethodId: string;
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
- /** Internal subscription ID */
367
- subscriptionId: string;
368
- /** Provider subscription ID */
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: 'active' | 'trialing' | 'paused' | 'canceled' | 'expired';
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: Date;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.16.6",
3
+ "version": "1.16.7",
4
4
  "author": "Redeemer Pace",
5
5
  "license": "ISC",
6
6
  "description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",