Order Data Reference

The Order event monitors the progress of a patient’s order, from creation and payment to fulfillment and shipping. Its payload contains all the relevant information about the order.

Order Event Payload

The payload below is a representation of an Order event trigger.

The payload is based on the order.created event, but it is relevant for all order-based trigger events. See the Workflow Events/Triggers article for a full list of available events.

{
  "_id": "7893efc2581fe0505d48c681",
  "organization": "clinic_x",
  "id": 9876,
  "customer": {
    "_id": "7820cf7b9fdd8c7aae179818",
    "email": "janedoe@email.com",
    "phone": "+15551234567",
    "firstName": "Jane",
    "lastName": "Doe"
  },
  "status": "shipped",
  "statusHistory": [],
  "source": "api",
  "lineItems": [
    {
      "name": "Health Supplement (4-week)",
      "productId": "778e289d7ea1698a8757aa44",
      "price": 199,
      "listPrice": 199,
      "discount": {
        "amount": 199,
        "reductionAmount": 50,
        "reductionType": "percent",
        "type": "coupon",
        "referenceId": "SAVE50NOW"
      },
      "quantity": 1,
      "isSubscription": true,
      "type": "physical",
      "requirements": [
        {
          "type": "qnr",
          "key": "intake_form"
        },
        {
          "type": "qnr",
          "key": "health_history"
        },
        {
          "type": "qnr",
          "key": "photo_id"
        },
        {
          "type": "qnr",
          "key": "selfie_photo"
        }
      ],
      "extras": {
        "pharmacies": {
          "CityCentralPharmacy ID": "XYZ123456ABCDEF7890"
        },
        "excludeInjectionKit": false,
        "GotoPharmacy": false,
        "bigcommerceId": null,
        "stripePriceId": null,
        "drugName": "CityCentral Health Supplement 4 wk starter 10mg",
        "includeInjectionKit": [],
        "categories": ["supplements"]
      }
    }
  ],
  "shippingAddress": {
    "address1": "123 Main Street",
    "address2": "Apt 5",
    "city": "Anytown",
    "provinceCode": "NY",
    "postalCode": "10001",
    "countryCode": "US"
  },
  "coupon": "SAVE50NOW",
  "invoices": [],
  "totalAmount": 99.50,
  "discountAmount": 99.50,
  "baseAmount": 199,
  "requirements": [],
  "version": 3,
  "isDeleted": false,
  "creditUsedAmount": 0,
  "createdAt": "2024-07-25T10:00:00.000Z",
  "updatedAt": "2024-07-25T10:05:00.000Z",
  "__v": 1
  "assignedTo": {
       "_id": "6823w2d85r49ba01b19f12ff",
       "username": "CityCentral-pharmacy@portals.care",
       "firstName": "CityCentral",
       "lastName": "Pharmacy"
  }
}

Order Object Properties

The table below describes the parameters of the payload.

Property

Type

Description

_id

string

A unique identifier for the order (e.g, 7893efc2581fe0505d48c681).

organization

string

The organization associated with the order.

id

number

The order’s numeric ID (e.g.,13883).

customer

object

An object containing the patient's personal information.

customer._id

string

The unique ID of the patient.

customer.email

string

The patient's email address.

customer.phone

string

The patient's phone number.

customer.firstName

string

The patient's first name.

customer.lastName

string

The patient's last name.

status

string

The current status of the order (e.g., "processing", "shipped").

statusHistory

array

A log of status changes for the order.

source

string

The origin of the order (e.g., "checkout", "subscription_cycle").

lineItems

array

A list of products included in the order.

lineItems.name

string

The name of the product.

lineItems.productId

string

The unique ID of the product.

lineItems.price

number

The actual price of the item.

lineItems.listPrice

number

The original price of the item before discounts or sale.

lineItems.discount

object

An object detailing any discounts applied to the item.

lineItems.discount.amount

number

The total discount amount.

lineItems.discount.reductionAmount

number

The value of the discount.

lineItems.discount.reductionType

string

The type of discount reduction (e.g., "percent").

lineItems.discount.type

string

The type of discount (e.g., "coupon").

lineItems.discount.referenceId

string

The ID of the coupon or discount used.

lineItems.quantity

number

The number of units of the item.

lineItems.isSubscription

boolean

Indicates if the product is a subscription.

lineItems.type

string

The type of product (e.g., "physical").

lineItems.requirements

array

A list of requirements (e.g., questionnaires) needed for the product.

lineItems.requirements.type

string

The type of requirement (e.g., "qnr" for questionnaire).

lineItems.requirements.key

string

The specific key for the requirement (e.g, intake_form)

lineItems.extras

object

An object for miscellaneous extra information.

lineItems.extras.pharmacies

object

An object containing pharmacy details.

lineItems.extras.excludeInjectionKit

boolean

Indicates if an injection kit should be excluded.

lineItems.extras.GotoPharmacy

boolean

A flag for pharmacy routing.

lineItems.extras.bigcommerceId

string or null

BigCommerce product ID.

lineItems.extras.stripePriceId

string or null

Stripe price ID.

lineItems.extras.drugName

string

The name of the drug.

lineItems.extras.includeInjectionKit

array

Include injection kit per Pharmacy.

lineItems.extras.categories

array

A list of product categories.

shippingAddress

object

The shipping address for the order.

shippingAddress.address1

string

The first line of the address.

shippingAddress.address2

string

The second line of the address.

shippingAddress.city

string

The city.

shippingAddress.provinceCode

string

The state or province code (e.g., "CA").

shippingAddress.postalCode

string

The postal code.

shippingAddress.countryCode

string

The country code (e.g., "US").

coupon

string

The coupon code used for the order.

invoices

array

A list of associated invoice IDs.

totalAmount

number

The final total amount of the order after all discounts.

discountAmount

number

The total discount applied to the order.

baseAmount

number

The total cost of items before any discounts.

requirements

array

A list of all order requirements.

version

number

The system version of the order.

isDeleted

boolean

A flag indicating if the order has been deleted.

creditUsedAmount

number

The amount of credit used for the order.

createdAt

string

The timestamp when the order was created.

updatedAt

string

The timestamp when the order was last updated.

__v

number

The document version number.

assignedTo

object

An object of the order’s assigned user (often a pharmacy user).

_id

string

The assigned user’s unique identifier.

username

string

The username or login identifier of the assigned user (often an email).

firstName

string

The first name of the assigned user.

lastName

string

The last name of the assigned user.