import { Stripe } from "../../commonjs/stripe.js"; import { StripeBillingRow, StripePremiumRow, PremiumGiftRow, CardClues } from "../../types.js"; export declare type UpdateFlow = "UpdatePremiumSubscription"; export interface SetupMetadata extends Stripe.Metadata { flow: UpdateFlow; } export interface PaymentDetails { card: CardClues; stripePaymentMethodId: string; } export interface SubscriptionDetails { status: Stripe.Subscription.Status; current_period_end: number; } export interface MinimalCard extends Partial { brand: string; last4: string; country: string; exp_year: number; exp_month: number; } export interface PremiumDatalayer { deleteStripePremiumRow(userId: string): Promise; getPremiumGiftRow(userId: string): Promise; getStripePremiumRow(userId: string): Promise; assertStripeBillingRow(userId: string): Promise; upsertStripePremiumRow(userId: string, row: StripePremiumRow): Promise; getStripeBillingRowByStripeCustomerId(stripeCustomerId: string): Promise; } export interface StripeLiaison { createCustomer(): Promise<{ stripeCustomerId: string; }>; checkoutSubscriptionPurchase(options: { userId: string; popupUrl: string; stripePlanId: string; stripeCustomerId: string; }): Promise<{ stripeSessionId: string; }>; checkoutSubscriptionUpdate(options: { userId: string; flow: UpdateFlow; popupUrl: string; stripeCustomerId: string; stripeSubscriptionId: string; }): Promise<{ stripeSessionId: string; }>; updateSubscriptionPaymentMethod(options: { stripeSubscriptionId: string; stripePaymentMethodId: string; }): Promise; scheduleSubscriptionCancellation(options: { stripeSubscriptionId: string; }): Promise; fetchSubscriptionDetails(stripeSubscriptionId: string): Promise; fetchPaymentDetails(stripePaymentMethodId: string): Promise; fetchPaymentDetailsByIntentId(stripeIntentId: string): Promise; fetchPaymentDetailsBySubscriptionId(stripeSubscriptionId: string): Promise; } export interface StripeWebhooks { [eventType: string]: (event: Stripe.Event) => Promise; ["checkout.session.completed"](event: Stripe.Event): Promise; ["customer.subscription.updated"](event: Stripe.Event): Promise; }