@plyaz/types 1.16.6 → 1.16.8
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,44 @@ 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
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
paymentMethodId: string;
|
|
356
|
+
paymentMethod: PAYMENT_METHOD;
|
|
357
|
+
/** Plan to subscribe the user to (internal plan name) */
|
|
358
|
+
plan: string;
|
|
360
359
|
/** Optional trial period in days */
|
|
361
360
|
trialDays?: number;
|
|
361
|
+
/** URL to redirect user after successful payment completion */
|
|
362
|
+
returnUrl?: string;
|
|
363
|
+
/** URL to redirect user after payment cancellation */
|
|
364
|
+
cancelUrl?: string;
|
|
365
|
+
/**
|
|
366
|
+
* Idempotency key to prevent duplicate payment processing
|
|
367
|
+
* Should be unique per payment attempt, recommended: UUID v4
|
|
368
|
+
*/
|
|
369
|
+
idempotencyKey?: string;
|
|
362
370
|
/** Optional metadata for additional info */
|
|
363
|
-
metadata?:
|
|
371
|
+
metadata?: {
|
|
372
|
+
/** Geographic and device information */
|
|
373
|
+
geoInfo?: {
|
|
374
|
+
country: string;
|
|
375
|
+
region?: string;
|
|
376
|
+
city?: string;
|
|
377
|
+
timezone?: string;
|
|
378
|
+
};
|
|
379
|
+
/** Custom metadata fields */
|
|
380
|
+
custom?: TMetadata;
|
|
381
|
+
};
|
|
364
382
|
}
|
|
365
383
|
export interface SubscriptionResult<TMetadata extends object = object> {
|
|
366
|
-
/**
|
|
367
|
-
|
|
368
|
-
/**
|
|
384
|
+
/** Checkout session URL for user to complete subscription */
|
|
385
|
+
checkoutUrl: string;
|
|
386
|
+
/** Optional: provider subscription ID (available after webhook confirmation) */
|
|
369
387
|
providerSubscriptionId?: string;
|
|
370
388
|
/** Status: active, trialing, paused, canceled, expired */
|
|
371
|
-
status
|
|
372
|
-
/** Next billing date */
|
|
389
|
+
status?: SUBSCRIPTION_STATUS;
|
|
390
|
+
/** Next billing date (available after webhook) */
|
|
373
391
|
nextBillingDate?: Date;
|
|
374
|
-
/** Subscription start date */
|
|
375
|
-
startedAt
|
|
392
|
+
/** Subscription start date (available after webhook) */
|
|
393
|
+
startedAt?: Date;
|
|
376
394
|
/** Provider-specific metadata */
|
|
377
395
|
metadata?: TMetadata;
|
|
378
396
|
}
|
package/package.json
CHANGED