Place Orders

Optional integration for routing orders to a pharmacy

After writing prescriptions a provider can select a pharmacy and submit an order within the Photon App or Elements UI. Orders can also be submitted programmatically.

Typically partners automate Order requests to save provider time or ensure that a certain action is completed before fulfillment (e.g. charging a credit card). Orders may contain fill requests for multiple prescriptions. OTC medications may also be added at this step.

πŸ“˜

Prescriptions written with Photon are not assigned or sent to a specific pharmacy until an Order is placed. This action can be completed programmatically.

A preferred pharmacy can be specified if a patient choses, otherwise Photon will route the prescription to the the most optimal pharmacy.

Create an Order

A request to the createOrder mutation will place a new order in Photon. This will begin

Below is an example of how to create an order from a backend. Refer to authentication guide for instructions on how to authenticate these requests.

import { GraphQLClient, gql } from "graphql-request";

const graphQLClient = new GraphQLClient("https://api.neutron.health/graphql", {
  headers: {
    authorization:
      "Bearer YOUR_TOKEN_HERE",
  },
});

const query = gql`
  mutation createOrder(
    $externalId: ID
    $patientId: ID!
    $fills: [FillInput!]!
    $address: AddressInput!
    $pharmacyId: ID
  ) {
    createOrder(
      externalId: $externalId
      patientId: $patientId
      fills: $fills
      address: $address
      pharmacyId: $pharmacyId
    ) {
      id
    }
  }
`;

const variables = {
  externalId: "YOUR_ORDER_ID", // optional
  patientId: "pat_123",
  fills: [{ prescriptionId: "rx_456" }],
  pharmacyId: "phr_789",
  address: {
    street1: "123 Main St",
    postalCode: "11111",
    country: "USA",
    state: "NY",
    city: "Brooklyn",
  },
};

const results = await graphQLClient.request(query, variables);