import { WhereFilterOp } from "@firebase/firestore"; import { StripePayments } from "./init"; /** * Interface of a Stripe Product stored in the app database. */ export interface Product { /** * Unique Stripe product ID. */ readonly id: string; /** * Whether the product is currently available for purchase. */ readonly active: boolean; /** * The product's name, meant to be displayable to the customer. Whenever this product is sold * via a subscription, name will show up on associated invoice line item descriptions. */ readonly name: string; /** * The product's description, meant to be displayable to the customer. Use this field to * optionally store a long form explanation of the product being sold for your own * rendering purposes. */ readonly description: string | null; /** * The Firebase role that will be assigned to the user if they are subscribed to this plan. */ readonly role: string | null; /** * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. */ readonly images: string[]; /** * A list of Prices for this billing product. Only populated if explicitly requested * during retrieval. */ readonly prices: Price[]; /** * A collection of additional product metadata. */ readonly metadata: { [key: string]: string | number | null; }; readonly [propName: string]: any; } /** * Interface of a Stripe Price object stored in the app database. */ export interface Price { /** * Unique Stripe price ID. */ readonly id: string; /** * ID of the Stripe product to which this price is related. */ readonly product: string; /** * Whether the price can be used for new purchases. */ readonly active: boolean; /** * Three-letter ISO currency code. */ readonly currency: string; /** * The unit amount in cents to be charged, represented as a whole integer if possible. */ readonly unit_amount: number | null; /** * A brief description of the price. */ readonly description: string | null; /** * One of `one_time` or `recurring` depending on whether the price is for a one-time purchase * or a recurring (subscription) purchase. */ readonly type: "one_time" | "recurring"; /** * The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. */ readonly interval: "day" | "month" | "week" | "year" | null; /** * The number of intervals (specified in the {@link Price.interval} attribute) between * subscription billings. For example, `interval=month` and `interval_count=3` bills every * 3 months. */ readonly interval_count: number | null; /** * Default number of trial days when subscribing a customer to this price using * {@link https://stripe.com/docs/api#create_subscription-trial_from_plan | trial_from_plan}. */ readonly trial_period_days: number | null; readonly [propName: string]: any; } /** * Optional parameters for the {@link getProduct} function. */ export interface GetProductOptions { /** * Set to `true` to retrieve the prices along with a product. If not set, the product is * returned with no prices (i.e. {@link Product.prices} field will be empty). */ includePrices?: boolean; } /** * Retrieves a Stripe product from the database. * * @param payments - A valid {@link StripePayments} object. * @param productId - ID of the product to retrieve. * @param options - A set of options to customize the behavior. * @returns Resolves with a Stripe Product object if found. Rejects if the specified product ID * does not exist. */ export declare function getProduct(payments: StripePayments, productId: string, options?: GetProductOptions): Promise; /** * Optional parameters for the {@link getProducts} function. */ export interface GetProductsOptions { /** * Set to `true` to retrieve only the currently active set of Stripe products. If not set, * returns all available products. When set, the effect is same as if called with the filter * `["active", "==", true]`. */ activeOnly?: boolean; /** * An array of optoinal filters that will be applied when querying the products from the app * database. */ where?: WhereFilter[]; /** * Set to `true` to retrieve the prices along with a product. If not set, the product is * returned with no prices (i.e. {@link Product.prices} field will be empty). */ includePrices?: boolean; /** * Maximum number of products to return. */ limit?: number; } export { WhereFilterOp } from "@firebase/firestore"; /** * A filter constraint that can be applied to database queries. Consists of a field name (in * Firestore dotted notation), a Firestore filter operator, and a value. */ export declare type WhereFilter = [string, WhereFilterOp, any]; /** * Retrieves a Stripe product from the database. * * @param payments - A valid {@link StripePayments} object. * @param productId - ID of the product to retrieve. * @param options - A set of options to customize the behavior. * @returns Resolves with an array of Stripe Product objects. May be empty. */ export declare function getProducts(payments: StripePayments, options?: GetProductsOptions): Promise; /** * Retrieves a Stripe price from the database. * * @param payments - A valid {@link StripePayments} object. * @param productId - ID of the product to which the price belongs. * @param priceId - ID of the price to retrieve. * @returns Resolves with a Stripe Price object if found. Rejects if the specified * product ID or the price ID does not exist. */ export declare function getPrice(payments: StripePayments, productId: string, priceId: string): Promise; /** * Retrieves all Stripe prices associated with the specified product. * * @param payments - A valid {@link StripePayments} object. * @param productId - ID of the product to which the prices belong. * @returns Resolves with an array of Stripe Price objects. Rejects if the specified * product ID does not exist. If the product exists, but doesn't have any prices, resolves * with the empty array. */ export declare function getPrices(payments: StripePayments, productId: string): Promise; //# sourceMappingURL=product.d.ts.map