> For the complete documentation index, see [llms.txt](https://docs.mdintegrations.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mdintegrations.com/partner/key-concepts/pharmacy-fulfillment/direct-to-pharmacy-dtp.md).

# Direct to Pharmacy (DTP)

Some pharmacies require a separate commercial order after they receive the e-prescription. Direct to Pharmacy (DTP) is how MDI takes that order workflow off your plate — for a select set of pharmacies, MDI manages it on your behalf.

You keep your own commercial relationship with the pharmacy; MDI simply handles order submission, refills, and tracking retrieval underneath it. This is especially valuable if you work with multiple pharmacies, since MDI abstracts the entire management layer behind the same APIs and interfaces regardless of which pharmacy is actually fulfilling the order.

### When to use DTP

Reach for DTP when your pharmacy requires explicit orders but you'd rather not build and operate that integration yourself.

| Fulfillment approach | Who manages the order workflow?                              |
| -------------------- | ------------------------------------------------------------ |
| Prescription-driven  | The pharmacy fills from the e-prescription.                  |
| Order-driven         | Your team integrates directly with the pharmacy.             |
| Direct to Pharmacy   | MDI manages the workflow through the Clinicians App and API. |

{% hint style="info" %}
DTP is available only for select pharmacies. Confirm availability with your MDI account team before setup.
{% endhint %}

### Manage orders in the Clinicians App

Once DTP is enabled for a pharmacy, orders for it start appearing under **Rx Orders** in the Clinicians App, where your staff can:

* View order details for an Encounter.
* Approve and schedule initial orders and refills.
* Check shipment tracking.

MDI handles all of the underlying pharmacy communication behind the scenes.

### Setting up DTP

{% stepper %}
{% step %}

#### Contract with the pharmacy

Establish a commercial agreement directly with the pharmacy yourself — MDI does not broker or replace this relationship.
{% endstep %}

{% step %}

#### Enable the pharmacy

Add the pharmacy's API credentials to your MDI partner account, then enable that pharmacy for DTP.
{% endstep %}

{% step %}

#### Configure Offerings

Configure the Offering itself to use the DTP-enabled pharmacy. Encounters prescribing those Offerings then use the managed order workflow automatically.
{% endstep %}
{% endstepper %}

### Connecting a pharmacy in the Partner Portal

That "Enable the pharmacy" step happens in the Partner Portal, specifically from the **Tech** page's **Pharmacy** tab:

1. Go to the **Tech** page and switch to the **Pharmacy** tab.
2. Click **Add New**.
3. Select the pharmacy from MDI's pharmacy catalog.
4. Enter a **Description** to identify the connection later.
5. Fill in whichever **secret keys** that pharmacy requires — these are defined per pharmacy, so the form only shows the fields relevant to the one you selected.
6. Click **Save**.
7. Copy the generated **Webhook URL** and hand it to your pharmacy partner — they need it to send order and fulfillment updates back to MDI.

You can reopen and edit a pharmacy connection at any time from the same tab, so if a secret changes on the pharmacy's end, you simply update it there instead of tearing down and recreating the whole connection.

{% hint style="info" %}
Unlike some other pharmacy integration systems, MDI pharmacy connections don't use a "Practice ID" or "Location ID" concept. A connection is identified by the pharmacy you select plus whichever secret keys it requires — there's no separate practice/location field to look for.
{% endhint %}

### Troubleshooting DTP configuration

| Issue                                                    | Likely cause                                            | Fix                                                                                                       |
| -------------------------------------------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| Save is blocked, or webhook signature verification fails | One or more required secret keys is missing             | Fill in every secret key that pharmacy marks as required on the **Pharmacy** tab                          |
| Updates from the pharmacy never arrive                   | The Webhook URL wasn't correctly copied to the pharmacy | Confirm with your pharmacy partner that they've configured the exact Webhook URL shown on your connection |
| The pharmacy you need isn't in the catalog               | MDI hasn't added it yet                                 | Contact MDI to have the pharmacy added                                                                    |

### Sync orders to your systems

DTP doesn't confine you to working inside the Clinicians App — you can use the API or webhooks to surface order and shipment status directly within your own systems instead. You can even use the API to auto-approve orders based on order or subscription payment status, giving you a fully autonomous fulfillment flow end to end.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mdintegrations.com/partner/key-concepts/pharmacy-fulfillment/direct-to-pharmacy-dtp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
