Levels

On this page we'll dive into how to setup custom data for your customers. These can be used to charge different subscriptions and to create different levels of access for your customers. This can also be used for usage based billing.

The Levels Model

The Levels model is used to store custom data for your customers. This can be used to create different levels of access for your customers. This can also be used for usage based billing.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the conversation.

  • Name
    customerId
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    organizationId
    Type
    string
    Description

    Unique identifier for the organization.

  • Name
    levelProperties
    Type
    map
    Description

    Key-value pairs of properties for customer custom fields

  • Name
    createdAt
    Type
    string
    Description

    The date and time the conversation was created.

  • Name
    updatedAt
    Type
    string
    Description

    The date and time the conversation was last updated.


POST/levels/create

Create a Level

This endpoint allows you to create a new level for a customer. You can use this to create different levels of access for your customers. This can also be used for usage based billing.

Required attributes

  • Name
    customerId
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    levels
    Type
    string
    Description

    Unique identifier for the payment method.

Request

POST
/levels/create
curl --location --request POST 'https://api.bluehillpayments.io/levels/create' \
--header 'Content-Type: application/json' \
--data-raw '{
    "organizationId" : "{{organizationId}}", 
    "levels": [
        {
            "customerId" : "EC8CD046740E43298BB1636DB0923A91", 
            "levelProperties" :{
                "users" : 30, 
                "hasTakenReference": true
            }
        }
    ]
}
'

Response

  {
    "data": [
        {
            "createdAt": null,
            "customerId": "033E3B78CDAC405882281A79416CAFF9",
            "id": "0A614DF0AFB24EADA8394B69EC8FFF75",
            "levelProperties": {
                "hasTakenReference": true,
                "users": 30
            },
            "organizationId": "{{organizationId}}",
            "updateAt": null
        }
    ],
    "status": "success"
  }

GET/levels/get/:customerId

Get Levels

This endpoint allows you to get the levels for a customer. You can use this to get the levels for a customer.

Request

GET
/levels/get/:customerId
  curl --location --request GET 'https://api.bluehillpayments.io/levels/get/EC8CD046740E43298BB1636DB0923A91' \
  --header 'Content-Type: application/json' \
  --data-raw ''

Response

{
  "data": {
      "createdAt": "2022-10-04 20:12:50",
      "customerId": "EC8CD046740E43298BB1636DB0923A91",
      "id": "4CFB21D282F14A8BB64A7A1B51EB7464",
      "levelProperties": {
          "constituents": "2800",
          "hasTakenReference": "true",
          "supportHours": "12",
          "text2Give": "1"
      },
      "organizationId": "{{organizationId}}",
      "updateAt": "2022-11-16 17:51:26"
  },
  "status": "success"
}

PUT/levels/update

Update Level Data

This endpoint allows you to update the level data for a customer. You can use this to update the level data for a customer.

Request

PUT
/levels/update
curl --location --request PUT 'https://api.bluehillpayments.io/levels/update' \
--header 'Content-Type: application/json' \
--data-raw '{
    "organizationId" : "{{organizationId}}", 
    "customerId" : "EC8CD046740E43298BB1636DB0923A91", 
    "levelProperties" :{
        "users" : 15000, 
        "text2give": true
    }
}
'

Response

{
  "data": {
      "createdAt": "2022-10-04 20:12:50",
      "customerId": "EC8CD046740E43298BB1636DB0923A91",
      "id": "4CFB21D282F14A8BB64A7A1B51EB7464",
      "levelProperties": {
          "constituents": "2800",
          "hasTakenReference": "true",
          "supportHours": "12",
          "text2Give": "1",
          "text2give": true,
          "users": 15000
      },
      "organizationId": "{{organizationId}}",
      "updateAt": "2023-01-18 01:19:10"
  },
  "status": "success"
}