Product

A product is any item or service that a patient can purchase. For example, you can have a '30-min consulation' product that a patient can purchase for $100. Or you could have a monthly subscription to a course that the patient could purchase for $10/month.

The product model

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the product.

  • Name
    object
    Type
    string
    Description

    Always 'product'.

  • Name
    name
    Type
    string
    Description

    Name of the product.

  • Name
    description
    Type
    string
    Description

    Description of the product.

  • Name
    category
    Type
    string
    Description

    Which product category this product belongs to.

    Possible values:
    registration
    appointment
    prescription
    lab
    course
    other
  • Name
    pricing
    Type
    object
    Description
  • Name
    quantity
    Type
    number | null
    Description

    Quantity of the product that can be sold. If an unlimited quantity is available, set as undefined.

  • Name
    created_by
    Type
    string
    Description

    Creator of the product.

  • Name
    created_at
    Type
    number
    Description

    Timestamp (in ISO 8601 format) of when the product was created.

  • Name
    last_updated_at
    Type
    number
    Description

    Timestamp (in ISO 8601 format) of when the product was last updated.

Response

{
    "id": "prod_3XxtAULYUrX7GVsTKePy",
    "object": "product",
    "patient": "user_Z1zXZKvqrpwxbznuW6lJ",

    "name": "30-min Consultation",
    "description": "30-min consultation with Dr. Smith",
    "category": "appointment",
    "pricing": {
        "is_paid": true,
        "price": 100,
        "recurring": {
            "is_recurring": false,
        },
    },
    "quantity": null,

    "created_by": "user_xeDpGyt67wTor93qKtS7",
    "created_at": "2024-04-03T04:12:01.781Z",
    "last_updated_at": "2024-04-03T04:12:01.781Z"
}


POST/v2/products

Create a product

Creates a new product.

Required attributes

  • Name
    name
    Type
    string
    Description

    Name of the product.

  • Name
    category
    Type
    string
    Description

    Which product category this product belongs to.

    Possible values:
    registration
    appointment
    prescription
    lab
    course
    other
  • Name
    pricing
    Type
    object
    Description
  • Name
    quantity
    Type
    number | null
    Description

    Quantity of the product that can be sold. If an unlimited quantity is available, set as undefined.

  • Name
    created_by
    Type
    string
    Description

    Creator of the product.

Optional attributes

  • Name
    description
    Type
    string
    Description

    Description of the product.

Request

POST
/v2/products
curl -X POST "https://{{base_subdomain}}.avonhealth.com/v2/products" \
  -H "Authorization: Bearer {{token}}" \
  -H "x-jwt: {{jwt}}" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "Example",
    "category": "registration",
    "quantity": 1,
    "created_by": "user_Z1zXZKvqrpwxbznuW6lJ"
  }'

Response

    {
        "id": "prod_3XxtAULYUrX7GVsTKePy",
        "object": "product",
        "patient": "user_Z1zXZKvqrpwxbznuW6lJ",

        "name": "30-min Consultation",
        "description": "30-min consultation with Dr. Smith",
        "category": "appointment",
        "pricing": {
            "is_paid": true,
            "price": 100,
            "recurring": {
                "is_recurring": false,
            },
        },
        "quantity": null,

        "created_by": "user_xeDpGyt67wTor93qKtS7",
        "created_at": "2024-04-03T04:12:01.781Z",
        "last_updated_at": "2024-04-03T04:12:01.781Z"
    }


GET/v2/products/:id

Retrieve a product

Retrieves the specified product.

Request

GET
/v2/products/:id
curl "https://{{base_subdomain}}.avonhealth.com/v2/products/:id" \
  -H "Authorization: Bearer {{token}}" \
  -H "x-jwt: {{jwt}}"

Response

    {
        "id": "prod_3XxtAULYUrX7GVsTKePy",
        "object": "product",
        "patient": "user_Z1zXZKvqrpwxbznuW6lJ",

        "name": "30-min Consultation",
        "description": "30-min consultation with Dr. Smith",
        "category": "appointment",
        "pricing": {
            "is_paid": true,
            "price": 100,
            "recurring": {
                "is_recurring": false,
            },
        },
        "quantity": null,

        "created_by": "user_xeDpGyt67wTor93qKtS7",
        "created_at": "2024-04-03T04:12:01.781Z",
        "last_updated_at": "2024-04-03T04:12:01.781Z"
    }


POST/v2/products/:id

Update a product

Updates the specified product object by setting the values of the parameters passed. Any other parameters not provided will not be modified.

Required attributes

  • Name
    updated_by
    Type
    string
    Description

    Updates to the product made by.

Optional attributes

  • Name
    name
    Type
    string
    Description

    Name of the product.

  • Name
    description
    Type
    string
    Description

    Description of the product.

  • Name
    category
    Type
    string
    Description

    Which product category this product belongs to.

    Possible values:
    registration
    appointment
    prescription
    lab
    course
    other
  • Name
    quantity
    Type
    number | null
    Description

    Quantity of the product that can be sold. If an unlimited quantity is available, set as undefined.

Request

POST
/v2/products/:id
curl -X POST "https://{{base_subdomain}}.avonhealth.com/v2/products/:id" \
  -H "Authorization: Bearer {{token}}" \
  -H "x-jwt: {{jwt}}" \
  -H "Content-Type: application/json" \
  --data '{
    "updated_by": "user_Z1zXZKvqrpwxbznuW6lJ"
  }'

Response

    {
        "id": "prod_3XxtAULYUrX7GVsTKePy",
        "object": "product",
        "patient": "user_Z1zXZKvqrpwxbznuW6lJ",

        "name": "30-min Consultation",
        "description": "30-min consultation with Dr. Smith",
        "category": "appointment",
        "pricing": {
            "is_paid": true,
            "price": 100,
            "recurring": {
                "is_recurring": false,
            },
        },
        "quantity": null,

        "created_by": "user_xeDpGyt67wTor93qKtS7",
        "created_at": "2024-04-03T04:12:01.781Z",
        "last_updated_at": "2024-04-03T04:12:01.781Z"
    }

GET/v2/products

List all products

Returns a list of all products.

Request

GET
/v2/products
curl "https://{{base_subdomain}}.avonhealth.com/v2/products" \
  -H "Authorization: Bearer {{token}}" \
  -H "x-jwt: {{jwt}}"

Response

    {
      "object": "list",
      "data": [
        {
            "id": "prod_3XxtAULYUrX7GVsTKePy",
            "object": "product",
            "patient": "user_Z1zXZKvqrpwxbznuW6lJ",

            "name": "30-min Consultation",
            "description": "30-min consultation with Dr. Smith",
            "category": "appointment",
            "pricing": {
                "is_paid": true,
                "price": 100,
                "recurring": {
                    "is_recurring": false,
                },
            },
            "quantity": null,

            "created_by": "user_xeDpGyt67wTor93qKtS7",
            "created_at": "2024-04-03T04:12:01.781Z",
            "last_updated_at": "2024-04-03T04:12:01.781Z"
        },
      ]
    }

DELETE/v2/products/:id

Delete a product

Deletes the specified product. Only delete a product if it has never been used in a transaction (e.g. in an invoice, in the auto-billing).

Required attributes

    Optional attributes

      Request

      DELETE
      /v2/products/:id
      curl -X DELETE "https://{{base_subdomain}}.avonhealth.com/v2/products/:id" \
        -H "Authorization: Bearer {{token}}" \
        -H "x-jwt: {{jwt}}"
      

      Response

          {
              "id": "prod_3XxtAULYUrX7GVsTKePy",
              "object": "product",
              "delete": true
          }