Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Product

Index

Functions

  • description

    Creates a product, given a name, subscription type amount, and currency. Called asynchronously with await. All data is provided as-is from the server, with the addition of an ok boolean for error handling.

    docs

    https://docs.hyper.co/reference/create-product

    example
    import { Client, Product } from 'hyper'
    const client = Hyper('my-api-key')

    let body = {
    name: "My Product",
    type: "recurring",
    amount: 100,
    currency: "usd"
    }

    const res = await Product.create(client, body)

    Parameters

    Returns Promise<HyperApiResponse>

    HyperApiResponse

  • description

    Retrieves a product, given its id. Called asynchronously with await. All data is provided as-is from the server, with the addition of an ok boolean for error handling.

    docs

    https://docs.hyper.co/reference/retrieve-product

    example
    import { Client, Product } from 'hyper'
    const client = Hyper('my-api-key')

    let product = "my-product-id"

    const res = await Product.get(client, product)

    Parameters

    • client: HyperApiClient

      (HyperApiClient) The client to use for the request

    • product: string

      (string) The id of the product to fetch

    Returns Promise<HyperApiResponse>

    HyperApiResponse

  • description

    Updates a product, given its id and new value(s). Called asynchronously with await. All data is provided as-is from the server, with the addition of an ok boolean for error handling.

    docs

    https://docs.hyper.co/reference/update-product

    example
    import { Client, Product } from 'hyper'
    const client = Hyper('my-api-key')

    let product = "my-product-id"

    let body = {
    rental_period_days: 10
    }

    const res = await Product.update(client, product, body)

    Parameters

    • client: HyperApiClient

      (HyperApiClient) The client to use for the request

    • product: string

      (string) The id of the product to update

    • body: ProductBodyUpdate

      (ProductBodyUpdate) An object with the updated key/value pairs provided

    Returns Promise<HyperApiResponse>

    HyperApiResponse

Generated using TypeDoc