@bzr/bazaar
    Preparing search index...

    Class MonetizationAPIInternal

    The class that encapsulates the monetization API

    Index

    Properties

    products: {
        create: (
            product: {
                costInCents: number;
                description: string;
                group?: string;
                name: string;
                repeatInterval: ProductRepeatInterval;
            },
            options?: { sellerId?: string },
        ) => Promise<Product>;
        delete: (productId: string) => Promise<{ message: string }>;
        list: (query?: { group?: string; sellerId?: string }) => Promise<Product[]>;
        update: (productId: string, product: ProductUpdate) => Promise<Product>;
    } = ...

    Products

    Type Declaration

    • create: (
          product: {
              costInCents: number;
              description: string;
              group?: string;
              name: string;
              repeatInterval: ProductRepeatInterval;
          },
          options?: { sellerId?: string },
      ) => Promise<Product>

      Creates a product. Sold by the calling user, or by sellerId: an org the user administers, on a plan that allows monetization.

    • delete: (productId: string) => Promise<{ message: string }>

      Deletes product

    • list: (query?: { group?: string; sellerId?: string }) => Promise<Product[]>

      Lists products

    • update: (productId: string, product: ProductUpdate) => Promise<Product>

      Updates a product's name or description. Prices cannot change.

    purchases: {
        list: (query?: { type?: PurchaseType }) => Promise<Purchase[]>;
        make: (productId: string, onClose?: (() => void) | null) => void;
        manage: (purchaseId: string, onClose?: (() => void) | null) => void;
        openModal: (
            options:
                | { productId: string }
                | { purchaseId: string }
                | { group: string; sellerId: string },
            onClose?: (() => void) | null,
        ) => void;
        openPopup: (
            options:
                | { productId: string }
                | { purchaseId: string }
                | { group: string; sellerId: string },
            onClose?: (() => void) | null,
        ) => void;
    } = ...

    Purchases

    Type Declaration

    • list: (query?: { type?: PurchaseType }) => Promise<Purchase[]>

      Lists purchases

    • make: (productId: string, onClose?: (() => void) | null) => void

      Opens the popup to buy a product: openPopup({ productId }).

    • manage: (purchaseId: string, onClose?: (() => void) | null) => void

      Opens the popup to change or cancel a purchase: openPopup({ purchaseId }).

    • openModal: (
          options:
              | { productId: string }
              | { purchaseId: string }
              | { group: string; sellerId: string },
          onClose?: (() => void) | null,
      ) => void

      Use openPopup. This opens a browser popup (window.open); iframe and dialog modals are disabled.

    • openPopup: (
          options:
              | { productId: string }
              | { purchaseId: string }
              | { group: string; sellerId: string },
          onClose?: (() => void) | null,
      ) => void

      Opens a popup to buy products or buy, change, or cancel subscriptions. Iframe and dialog modals are disabled.

    sales: {
        list: (query?: { group?: string; sellerId?: string }) => Promise<Sale[]>;
    } = ...

    Sales of your products

    Type Declaration

    • list: (query?: { group?: string; sellerId?: string }) => Promise<Sale[]>

      Lists purchases of your products, with buyers. sellerId: an org you administer, for its sales.

    Methods

    • Parameters

      • onClose: (() => void) | null = null

      Returns void

      Use openPopup. This opens a browser popup (window.open); iframe and dialog modals are disabled.

    • Opens monetization in a popup (window.open). Iframe and dialog modals are disabled.

      Parameters

      • onClose: (() => void) | null = null

      Returns void