Class IapticStripe

Main class for interacting with Iaptic's Stripe integration

This class handles all Stripe-related operations including product listing, checkout sessions, and subscription management.

Constructors

Methods

  • Changes a subscription plan

    Parameters

    Returns Promise<Purchase>

    Promise resolving to the updated purchase details

    This method handles immediate plan changes without requiring customer portal access

  • Clears all stored data including access tokens and cached products

    Returns void

  • Gets the current access token if one exists

    Returns undefined | string

    The current access token or undefined if none exists

  • Gets a list of available products and their pricing

    Returns Promise<Product[]>

    Promise resolving to an array of products

    Results are cached locally. Use refreshProducts() to force a fresh fetch.

  • Gets the customer's purchase history

    Parameters

    • OptionalaccessToken: string

      Optional access token (uses stored token if not provided)

    Returns Promise<Purchase[]>

    Promise resolving to an array of purchases

    This method will automatically schedule refresh operations for active subscriptions

  • Parameters

    • callback: (accessToken: string) => void

    Returns void

  • Creates a new order and redirects to Stripe Checkout

    Parameters

    • params: Order

      Order parameters including product and URLs

    Returns Promise<void>

    Error if the checkout session creation fails

    This method will redirect the user to Stripe's checkout page on success

  • Redirects to Stripe Customer Portal for subscription management

    Parameters

    • params: { accessToken?: string; returnUrl?: string }

      Portal parameters including return URL

    Returns Promise<void>

    Error if portal session creation fails

    This method will redirect the user to Stripe's customer portal on success

  • Forces a refresh of the products list from the server

    Returns Promise<Product[]>

    Promise resolving to an array of products