import { DateTime } from 'luxon'; import type Stripe from 'stripe'; import { type CheckoutBuilder } from './checkout_builder.js'; import type Subscription from '../models/subscription.js'; import { Empty } from '../types.js'; import { type ManagesCustomerContract, type ManagesPaymentMethodsContract, type ManagesSubscriptionsContract } from '../contracts.js'; import type { LucidRow } from '@adonisjs/lucid/types/model'; interface SubscriptionBuilderOwner extends ManagesSubscriptionsContract, ManagesCustomerContract, ManagesPaymentMethodsContract, LucidRow { } declare const SubscriptionBuilder_base: { new (...args: any[]): { "__#private@#prorationBehaviour": Stripe.SubscriptionCreateParams.ProrationBehavior; noProrate(): /*elided*/ any; prorate(): /*elided*/ any; alwaysInvoice(): /*elided*/ any; setProrationBehavior(prorationBehaviour: Stripe.SubscriptionCreateParams.ProrationBehavior): /*elided*/ any; prorateBehavior(): Stripe.SubscriptionCreateParams.ProrationBehavior; }; } & { new (...args: any[]): { "__#private@#paymentBehavior": Stripe.SubscriptionCreateParams.PaymentBehavior; defaultIncomplete(): /*elided*/ any; allowPaymentFailures(): /*elided*/ any; pendingIfPaymentFails(): /*elided*/ any; errorIfPaymentFails(): /*elided*/ any; paymentBehavior(): Stripe.SubscriptionCreateParams.PaymentBehavior; setPaymentBehavior(paymentBehavior: Stripe.SubscriptionCreateParams.PaymentBehavior): /*elided*/ any; }; } & { new (...args: any[]): { confirmIncompletePayment: boolean; paymentConfirmationOptions: Stripe.PaymentIntentConfirmParams; handlePaymentFailure(subscription: Subscription, paymentMethod?: Stripe.PaymentMethod | string): Promise; ignoreIncompletePayments(): /*elided*/ any; withPaymentConfirmationOptions(params: Stripe.PaymentIntentConfirmParams): /*elided*/ any; }; } & typeof Empty & (new (...args: any[]) => import("../contracts.js").AllowsCouponContract) & (new (...args: any[]) => import("../contracts.js").HandlesTaxesContract); export declare class SubscriptionBuilder extends SubscriptionBuilder_base implements PromiseLike { #private; constructor(owner: SubscriptionBuilderOwner, type: string, prices: string[]); /** * Set a price on the subscription builder. */ price(price: string | Partial, quantity?: number | null): this; /** * Set a metered price on the subscription builder. */ meteredPrice(price: string): this; /** * Specify the quantity of a subscription item. */ quantity(quantity: number, price?: string): this; /** * Specify the number of days of the trial. */ trialDays(days: number): this; /** * Specify the ending date of the trial. */ trialUntil(date: DateTime): this; /** * Force the trial to end immediately. */ skipTrial(): this; /** * Change the billing cycle anchor on a subscription creation. */ anchorBillingCycleOn(date: DateTime | number): this; /** * The metadata to apply to a new subscription. */ withMetadata(metadata: Record): this; /** * Add a new Stripe subscription to the Stripe model. */ add(customerParams?: Stripe.CustomerCreateParams, subscriptionParams?: Partial): Promise; /** * Create a new Stripe subscription. */ create(paymentMethod?: string | Stripe.PaymentMethod, customerParams?: Stripe.CustomerCreateParams, subscriptionParams?: Partial): Promise; /** * Create a new Stripe subscription and send an invoice to the customer. */ createAndSendInvoice(customerParams?: Stripe.CustomerCreateParams, subscriptionParams?: Omit): Promise; /** * Create the Subscription. */ createSubscription(stripeSubscription: Stripe.Subscription): Promise; /** * Begin a new Checkout Session. */ checkout(sessionParams?: Stripe.Checkout.SessionCreateParams, customerParams?: Stripe.CustomerCreateParams): CheckoutBuilder; /** * Get the Stripe customer instance for the current user and payment method. */ getStripeCustomer(paymentMethod?: string | Stripe.PaymentMethod, params?: Stripe.CustomerCreateParams): Promise; /** * Build the payload for subscription creation. */ buildPayload(): Partial; /** * Get the trial ending date for the Stripe payload. */ getTrialEndForPayload(): 'now' | number | undefined; /** * Get the price tax rates for the Stripe payload. */ getTaxRatesForPayload(): string[] | null; /** * Get the price tax rates for the Stripe payload. */ getPriceTaxRatesForPayload(price: string): string[] | undefined; /** * Get the items set on the subscription builder. */ getItems(): Stripe.SubscriptionCreateParams.Item[]; /** * PromiseLike implementation — resolves by calling create() with no payment method. */ then(onfulfilled?: ((value: Subscription) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null): Promise; } export {};