TagoIO SDK for JavaScript and TypeScript
    Preparing search index...

    Class Billing

    Hierarchy

    Index

    Constructors

    Methods

    • Cancel a scheduled downgrade.

      Returns Promise<string>

      Success message.

      If the subscription has no schedule.

    • Cancel the last pending operation if the payment has failed.

      Works for subscription upgrade operations and not for recurring payment errors.

      Returns Promise<string>

      Success message.

      If there's no pending payment.

    • Check if a coupon is valid by its promo code.

      Parameters

      • Optionalcode: string

        Customer-facing code for the coupon (promo code).

      Returns Promise<BillingCoupon>

      If the coupon code is not valid or not found.

      If coupon is specific to a an account.

      If coupon can only be applied to new subscriptions.

    • Edit the resource allocation for the profiles in an account.

      The resource allocation array doesn't need to have an object for each of the account's profiles, as long as the sum of the allocated amounts for the services doesn't exceed the account's service limit.

      The resource allocation object for a profile doesn't need to have all the services.

      Parameters

      Returns Promise<string>

      Success message.

      If passed an object that is not an allocation array.

      If the account only has one profile.

      If one of the profile IDs in the allocation array doesn't exist in the account.

      If the allocated amount for one of the services exceeds the available amount.

    • Edit an account's billing information.

      Parameters

      • billingInformation: Partial

        Data to be updated in the account's billing information.

      Returns Promise<string>

    • Edit an account's payment method.

      Parameters

      • stripeCardToken: string

        Token for the new payment method added via Stripe API.

      Returns Promise<string>

      Success or error message.

      If token is invalid or Stripe can't create the payment method with it.

    • Edit an account's subscription to change plan, services or add-ons.

      Only one of either plan, services, or addons can be in subscription.

      Parameters

      Returns Promise<void>

      If the subscription has a pending operation.

      If updating more than one of plan, services and add-ons at the same time.

      If purchasing add-ons or changing service limits on the Free plan.

      If using an invalid coupon.

    • Get the payment history for an account.

      The route uses pagination and the lastId parameter should be the stripe_id parameter from the last history entry.

      Parameters

      • OptionalqueryObj: { amount?: number; lastId?: string }

        Object to configure the amount of entries fetched and the ID of the history entry for pagination.

      Returns Promise<BillingPaymentHistoryEntry[]>

      Array with payment history entries or an empty array when no entries are available.

      If lastId is passed and is invalid.

    • Get information for the account subscription schedule for downgrades.

      In the response, subscription reflects how the entire subscription will look at the end of the billing cycle when the downgrade is applied. If there is a scheduled downgrade for either plan, services or add-ons, everything is returned and not only the changes.

      Returns Promise<BillingSchedule>

    • Remove an account's payment method from the Stripe subscription.

      Only removes the card if the account is on the Free plan or if it has enough credit balance.

      Returns Promise<string>

      Success or error message.

      If subscription is active with an upcoming invoice.

      If account doesn't have a payment method.

    • Retry payment for an operation where the payment was unsuccessful.

      Works for payment errors in recurring payments or in subscription upgrade operations.

      Returns Promise<string>

      Success message.

      If account has no subscription.

      If there's no pending payment.

      If payment method is declined or for other payment processing errors.