Order Events

photon:order:created

An order has been created

Schema

ParamTypeDescription
idstringInternal Photon ID for the order
externalIdstring (optional)External ID passed in during order creation
pharmacyIdstringPhoton ID of the pharmacy that the order was sent to
patientObjectObject containing the Photon ID and the external id of the patient
fillsArrayArray of fill objects that were created for this order. Each fill object includes the ID of the fill and the ID and external ID of the associated prescription

Sample Event

{
    "id": "01G8AHAFRTJ92S62AM44YTBG8W",
    "type": "photon:order:created",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
        "externalId": "1234",
        "pharmacyId": "phr_hRBVwyp23qjQR0ap",
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        },
        "fills": [
            {
                "id": "fil_01G8AHAFNSH1PJMGWECX3BYEP2",
              	"prescription": {
                  "id": "rx_01G8AGBC91W1042CDRB19545EC",
                  "externalId": "1234"
                }
            }
        ],
        "createdAt": "2022-01-01T01:00:00.000Z"
    }
}

photon:order:placed

The order has been sent to a pharmacy

Schema

ParamTypeDescription
idstringInternal Photon ID for the order
externalIdstringExternal ID passed in during order creation
patientObjectObject containing the Photon ID and the external id of the patient

Sample Event

{
    "id": "01G7Z7TNFH0YEGVZ719TQZQBER",
    "type": "photon:order:placed",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
        "externalId": "1234",
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        }
    }

photon:order:fulfillment

The fulfillment status of the order has been updated. You will receive multiple photon:order:fulfillment webhooks as the order progress at the pharmacy. Details about these different events can be found below

Schema

idstringInternal Photon ID for the order
externalIdstringExternal ID passed in during order creation
fulfillmentObjectObject containing the Photon ID and the external id of the patient
patientObjectObject containing the Photon ID and the external id of the patient

Sample Event

{
    "id": "01G54ZB2Y82V0W67G8M2VW8WEQ",
    "type": "photon:order:fulfillment",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
        "externalId": "1234",
        "fulfillment": {
            "type": "MAIL_ORDER",
            "state": "SHIPPED",
            "carrier": "USPS",
            "trackingNumber": "1LS729104296564"
        },
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        }
    }
}

Fulfillment Details

The fulfillment object will vary depending on the type of fulfillment the particular order has.

Mail Order

When the fulfillment type is MAIL_ORDER, the states will be one of the following:

SENTThe order has been sent to the pharmacy
FILLINGThe pharmacy has begun filling the order
SHIPPEDThe order has been shipped
DELIVEREDThe order has been delivered to the patient

The SHIPPED and DELIVERED webhooks will include carrier and tracking number when available.

Pick Up

When the fulfillment type is PICK_UP, the states will be one of the following:

SENTThe order has been sent to the pharmacy and is awaiting confirmation of receipt and ability to fill
RECEIVEDThe pharmacy has confirmed they received the order and are able to fill it
READYThe order has been filled and is waiting for pick up
PICKED_UPThe order has been picked up by the patient

photon:order:completed

The order has been picked up or delivered

Schema

ParamTypeDescription
idstringInternal Photon ID for the order
externalIdstringExternal ID passed in during order creation
patientObjectObject containing the Photon ID and the external id of the patient

Sample Event

{
    "id": "01G6V8S5TYR056ET83M7Y8MKRK",
    "type": "photon:order:completed",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
        "externalId": "1234",
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        }
    }
}

photon:order:canceled

The order has been canceled

Schema

ParamTypeDescription
idstringInternal Photon ID for the order
externalIdstringExternal ID passed in during order creation
patientObjectObject containing the Photon ID and the external id of the patient

Sample Event

{
    "id": "01G7Z7TNFH0YEGVZ719TQZQBER",
    "type": "photon:order:canceled",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
        "externalId": "1234",
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        }
    }

photon:order:rerouted

An order was routed to a different pharmacy.

Schema

ParamTypeDescription
idstringInternal Photon ID for the order
externalIdstringExternal ID passed in during order creation
pharmacyObjectObject containing data about the pharmacy the order was sent to
patientObjectObject containing the Photon ID and the external id of the patient

Sample Event

{
    "id": "01G54ZB2Y82V0W67G8M2VW8WEQ",
    "type": "photon:order:rerouted",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
        "externalId": "1234",
        "pharmacy":{
            "id": "phr_hRBVwyp23qjQR0ap",
            "name": "CVS",
            "address": {
              "street1": "123 Main St",
              "street2": null,
              "city": "Brooklyn",
              "state": "NY",
              "country": "US",
              "postalCode": "11111",
        },
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        }
    }
}

photon:order:error

There was an error while processing the order

Schema

ParamTypeDescription
idstringInternal Photon ID for the order
externalIdstringExternal ID passed in during order creation
reasonstringDescription of the error
patientObjectObject containing the Photon ID and the external id of the patient

Sample Event

{
    "id": "01G54ZB2Y82V0W67G8M2VW8WEQ",
    "type": "photon:order:error",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "time": "2022-01-01T01:00:00.000Z",
    "subject": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
    "source": "org:org_KzSVZBQixLRkqj5d",
    "data": {
        "id": "ord_01G8AHAFDJ7FV2Y77FVWA19009",
        "externalId": "1234",
        "reason": "EXAMPLE REASON",
        "patient": {
            "id": "pat_ieUv67viS0lG18JN",
            "externalId": "1234"
        }
    }
}