Chapter 1

Vendor Integration Guide

Everything you need to connect your vendor system with the MedGrid Marketplace — from first authentication to live order tracking.

What is Vendor Integration?

Vendor integration means linking your business (pharmacy, fulfillment company, or product supplier) to the MedGrid platform so that orders, inventory, and shipment data flow automatically between your systems and MedGrid. Once connected, you no longer need to manually copy orders or update tracking numbers — it all happens in real time.

What Can Be Synchronized

Data You Push to MedGrid
  • Product catalog (items, SKUs, descriptions)
  • Real-time inventory quantities
  • Pricing and discount rules
  • Order fulfillment status
  • Shipment tracking numbers
Data You Receive from MedGrid
  • New order notifications
  • Order line items (products, quantities, pricing)
  • Customer shipping addresses
  • Order cancellations and updates
  • Payment confirmation status

Integration Types

Managed Integration
The MedGrid team configures the connection on your behalf. You provide your API credentials securely and MedGrid handles the technical wiring. Ideal for complex pharmacy connectors.
Managed
Self-Service Integration
Connect your own ShipStation account or Shopify store directly from the Vendor Integrations Portal at /portal/integrations. No admin involvement required.
Self-Service
SMS Integration
Verify your phone number to receive AI-powered MedGrid helpdesk support via SMS/iMessage — order updates and answers delivered directly to your phone.
Self-Service

Complete Integration Workflow

1
Apply & Get Approved

Submit your vendor application via the MedGrid portal. The MedGrid team reviews and approves your account. You receive login credentials automatically.

2
Authenticate with MedGrid

Generate your API Key and Secret from User Settings, or log in via the vendor portal. All subsequent API calls use your credentials.

3
Sync Your Product Catalog

Upload your products (items, SKUs, descriptions, pricing). Products are reviewed by MedGrid before becoming available in the marketplace.

4
Connect Your Fulfillment System

Connect your ShipStation account or Shopify store from the Integrations Portal. MedGrid will automatically push new orders to your system.

5
Receive & Fulfill Orders

New MedGrid orders appear in your ShipStation queue (or Shopify admin). Process them normally — ship the items to the customer.

6
Tracking Numbers Sync Back

MedGrid automatically pulls tracking numbers from ShipStation and updates the customer's order. No manual entry required.

Chapter 2

Vendor Onboarding

How a new vendor account is created and what happens at each stage.

Account Lifecycle

StageStatusWhat Happens
ApplicationDraftYou submit your vendor registration. Your profile is created in MedGrid in Draft state.
Under ReviewPending ApprovalThe MedGrid team reviews your business information, compliance documents, and product catalog.
ApprovedActiveYour account is activated. A User account, Supplier record, and Vendor Profile are automatically created. You receive a welcome email with login instructions.
SuspendedInactiveTemporarily suspended by MedGrid admin. Orders will not route to your account.

What Gets Created When You Are Approved

When MedGrid approves your vendor account, the following records are automatically created:

  • User Account — Login credentials for the MedGrid portal and API access.
  • Vendor Profile — Your public-facing profile on the marketplace (company name, description, logo, contact details).
  • Supplier Record — Internal record used to route orders to your fulfillment queue.
  • Contact & Address — Your primary contact and business address for invoicing.

Onboarding Checklist

  • 1Log in to the MedGrid Vendor Portal with your welcome email credentials.
  • 2Complete your Vendor Profile (logo, description, contact details, social links).
  • 3Upload your initial product catalog with descriptions, SKUs, and pricing.
  • 4Wait for MedGrid catalog review — products must be approved before they appear.
  • 5Connect your ShipStation or Shopify account from the Integrations Portal.
  • 6Optionally verify your phone for SMS helpdesk support.
  • 7Run a test sync to confirm orders and tracking flow correctly.
Chapter 3

Authentication

Every API request to MedGrid must include valid credentials. There are two methods depending on how you are connecting.

Method 1 — API Key + Secret (Recommended for Systems)

This is the correct method for automated integrations, background sync jobs, and any software-to-software communication. It works like a username and password combination but is designed for machines rather than humans.

How to Generate Your Credentials

  1. Log in to the MedGrid Vendor Portal.
  2. Navigate to User Settings > API Access.
  3. Click Generate Keys to create your API Key and API Secret.
  4. Copy both values and store them securely (treat them like passwords).

Authorization Header

Include the following header in every API request:

Authorization: token YOUR_API_KEY:YOUR_API_SECRET
Content-Type: application/json
Accept: application/json

Example API Request

curl -X POST "https://app.medgrid.com/api/method/medgrid.integrations.list_connections" \
  -H "Authorization: token abc123key:xyz789secret" \
  -H "Content-Type: application/json"
Security Warning: Never embed your API Key and Secret in client-side (browser) code or mobile apps. They should only be used on a secure server where end users cannot access them.

Method 2 — Session Cookie (Browser Portal)

When you log in to the MedGrid Vendor Portal in a browser, MedGrid issues a session cookie (sid) that is automatically sent with every request. This method is only for browser-based portal access — not for automated systems.

POST/api/method/login
{
  "usr": "vendor@yourcompany.com",
  "pwd": "your-portal-password"
}

On success, a session cookie is set automatically. The browser includes it on every subsequent request for the duration of the session.

Base URL

Production
https://app.medgrid.com
Sandbox
https://sandbox.medgrid.com
Use the Sandbox for testing. The Sandbox environment is a safe space to test your integration without affecting real orders or inventory. Always complete testing in Sandbox before going live.
Chapter 4

Vendor Profile

Your Vendor Profile is your public identity on the MedGrid marketplace. Customers and sales reps see your profile when browsing products.

Profile Fields

FieldDescriptionRequired
vendor_nameYour company or business name as it appears publicly on MedGrid.Required
vendor_userThe MedGrid user account associated with this vendor profile.Required
supplierInternal link to the Supplier record used for order routing.Required
descriptionShort bio or company description shown on your marketplace profile.Optional
logoYour company logo (image file). Displayed on product listings and your profile page.Optional
websiteYour company website URL.Optional
emailPrimary business contact email.Optional
phonePrimary business phone number.Optional
addressYour business mailing/billing address.Optional

Social Profile

Optionally link your social media accounts to enhance your marketplace profile visibility. Supported platforms: LinkedIn, Instagram, Twitter/X, Facebook.

Profile Review: Changes to your Vendor Profile may be reviewed by MedGrid admins before they appear publicly. Keep your profile accurate and professional.
Chapter 5

Product Synchronization

How vendors upload, update, and maintain their product catalog on MedGrid.

Product Lifecycle

Every product in MedGrid follows an approval workflow before it can be sold on the marketplace:

StageStatusMeaning
New ProductDraftCreated but not yet submitted for review. Only visible to the vendor and MedGrid admins.
SubmittedPending ApprovalSubmitted to MedGrid catalog team for review. Visible to admins only.
ApprovedActiveApproved and live in the MedGrid catalog. Customers and sales reps can browse and order it.
RejectedRejectedReturned with rejection reason. Vendor must update and resubmit.

Product Data Fields

When creating or syncing a product, include the following fields:

FieldTypeDescriptionRequired
item_codestringYour unique SKU or product identifier. Used as the primary key for matching across systems.Required
item_namestringHuman-readable product name as it appears in the catalog (e.g. "Vitamin D3 5000 IU").Required
descriptionstring (HTML)Full product description. Supports basic HTML formatting for bold, lists, etc.Required
item_groupstringProduct category (e.g. "Supplements", "Peptides", "Compounded Medications").Required
brandstringManufacturer or brand name.Optional
stock_uomstringUnit of measure for stock (e.g. "Nos", "Vial", "Box", "mg").Required
standard_ratedecimalYour base / list price for this product in USD.Required
imageURL/filePrimary product image. JPEG or PNG, minimum 600×600px recommended.Optional
is_stock_itembooleanSet true if MedGrid should track physical inventory for this product.Required
default_supplierstringYour Supplier record name. Links this product to your vendor account for order routing.Required

Example Product Payload

{
  "item_code": "VD3-5000-120",
  "item_name": "Vitamin D3 5000 IU (120 Softgels)",
  "description": "<p>High-potency Vitamin D3 to support immune function, bone health, and mood.</p>",
  "item_group": "Supplements",
  "brand": "NutriCore Labs",
  "stock_uom": "Box",
  "standard_rate": 28.50,
  "is_stock_item": true,
  "default_supplier": "NutriCore-001",
  "image": "https://cdn.yourcompany.com/products/vd3-5000.jpg"
}

SKU Mapping

MedGrid uses your item_code as the primary SKU. When integrating with ShipStation or Shopify, the SKU is used to map products across systems:

External SystemMedGrid FieldWhat It Stores
ShipStationshipstation_product_idYour SKU as it appears in ShipStation for this product.
Shopify (self-serve)exoceuticals_variant_idShopify ProductVariant GID for catalog-matched items.
Catalog Curation Policy: MedGrid does not auto-import products. Every product must be submitted and approved by the MedGrid catalog team. This ensures quality and compliance across the marketplace.
Chapter 6

Inventory Management

Keep your product availability up to date so customers always see accurate stock levels.

How Inventory Works in MedGrid

MedGrid tracks inventory per product per warehouse. Each warehouse represents a physical or virtual fulfillment location. When a customer browses your products, they see real-time available quantities from the relevant warehouse.

Inventory Data Fields

FieldDescription
item_codeThe product SKU to update inventory for.
warehouseThe warehouse this inventory belongs to (e.g. "ShipStation Warehouse - SM").
actual_qtyCurrent physical quantity available for sale. Updated automatically via integrations.
reserved_qtyQuantity reserved for pending orders (managed automatically by MedGrid).

Inventory Update Methods

Via ShipStation Sync
When ShipStation is connected, MedGrid pushes orders to ShipStation. Inventory is tracked through ShipStation's fulfilment queue and reflected back.
Automatic
Via Shopify Sync
When Shopify is connected and a sync is triggered, MedGrid pulls your current Shopify inventory quantities and updates the corresponding MedGrid Item records.
On Demand
Via Stock Update
Vendors can submit stock updates directly through the MedGrid vendor portal to adjust quantities manually for any product in their catalog.
Manual
Best Practice: Use the ShipStation integration for continuous, automated inventory tracking. Manual stock updates should only be used for corrections or initial setup.
Chapter 7

Pricing & Discounts

MedGrid supports flexible, multi-tier pricing so vendors can set different prices for different customer segments.

Price Lists

MedGrid uses named Price Lists to manage pricing. A Price List is a named set of prices that applies to a specific customer group or sales channel. When a customer views your product, MedGrid automatically applies the Price List assigned to their account.

Price ListWho Sees ItExample
Standard SellingAll customers (default)Your regular catalog price
WholesaleHigh-volume buyers / distribution partners10–20% below standard
Contract PricingCustomers with a signed pricing agreementNegotiated per-customer rate
Custom / Channel-SpecificSpecific customers or sales channelsSales rep-specific promotions

Pricing Data Fields

FieldTypeDescription
item_codestringThe SKU this price applies to.
price_liststringThe Price List this price entry belongs to (e.g. "Standard Selling", "Wholesale").
price_list_ratedecimalThe price for this item in this Price List, in USD.
valid_fromdateOptional start date for a promotional price. Leave blank for a permanent price.
valid_uptodateOptional expiry date for a promotional price. Leave blank for no expiry.
min_qtyintegerOptional minimum quantity required to apply this price (volume pricing).

Price Allowance (Rate Tolerance)

MedGrid may define a price rate allowance on your vendor account. This sets the maximum percentage by which a sales rep can adjust your catalog price during order creation. For example, a ±5% allowance means a rep can apply up to 5% discount or markup. This prevents pricing inconsistencies in the marketplace.

Promotional Pricing

To set a promotional price for a limited time, create an Item Price record with valid_from and valid_upto dates. The system automatically switches back to the standard price when the promotion expires. You do not need to manually revert it.

Price Updates: Price changes take effect immediately for all new orders. Existing submitted orders retain the price at the time they were placed.
Chapter 8

Order & Fulfillment

How vendors receive orders, confirm them, fulfill them, and update MedGrid with shipping information.

How Vendors Receive Orders

When a customer places an order on MedGrid that includes your products, a Sales Order is created and your items are automatically routed to your fulfillment system based on your integration setup:

  • If you use ShipStation: The order is pushed directly into your ShipStation queue. You process it in ShipStation normally.
  • If you use Shopify: A new order is created in your connected Shopify store automatically.
  • If you use Direct (Portal): The order appears in your Vendor Dashboard under pending fulfillments.

Order Fields You Will Receive

FieldDescription
order_numberMedGrid Sales Order ID (e.g. SAL-2026-00123). Use this as your reference.
order_dateDate the order was placed.
customer_nameName of the customer or practice placing the order.
contact_emailCustomer contact email for delivery notifications.
itemsArray of line items — each containing SKU, item name, quantity, and agreed price.
shipping_addressFull ship-to address including street, city, state, zip, and country.
grand_totalTotal order value in USD.
statusCurrent order status: To Deliver, In Transit, Delivered, Cancelled.

Order Status Flow

StatusMeaning
DraftOrder is being prepared by the sales rep. Not yet confirmed.
Submitted / To DeliverOrder confirmed. Items need to be picked, packed, and shipped.
In TransitShipment has been dispatched. Tracking number has been recorded in MedGrid.
Delivered / CompletedCustomer has received the order.
CancelledOrder was cancelled. No fulfillment required.

Shipment Tracking Updates

Tracking numbers flow back to MedGrid automatically when using the ShipStation integration. MedGrid polls ShipStation for shipment data on your pushed orders and writes the tracking number and carrier to the Delivery Note record.

For Shopify-fulfilled orders, Shopify sends a webhook when the order is fulfilled, which MedGrid processes to update the order status and tracking information in real time.

Multi-Vendor Orders: A single customer order may contain products from multiple vendors. MedGrid automatically splits the order and routes each vendor's items separately. Each vendor only sees and fulfills their own line items.
Chapter 9

Integrations Portal

The Integrations Portal at /portal/integrations is your self-service hub for connecting your third-party accounts to MedGrid. No admin involvement needed.

Available Integrations

ShipStation
Connect your ShipStation account to automatically receive MedGrid orders and sync tracking numbers back.
API Key + Secret
Shopify
Connect your Shopify store via OAuth. MedGrid syncs your product catalog and pushes new orders to your store automatically.
OAuth 2.0
SMS / iMessage
Verify your mobile phone to receive AI-powered helpdesk answers and order updates via SMS or iMessage.
Phone OTP

Integration Status

Each integration shows a real-time status pill in the portal:

StatusMeaning
ConnectedCredentials verified. Sync is active.
Not ConnectedNo credentials saved yet. Click Connect to set up.
ErrorCredentials saved but last connection test failed. Re-enter credentials or contact support.
SyncingA sync operation is currently in progress.

Integration Permissions

Each integration requests specific permissions (scopes) that describe exactly what data MedGrid can read or write. These are shown before you connect:

IntegrationPermissions Requested
ShipStationorders.write — push orders; tracking.read — pull tracking numbers.
Shopifyread_products, write_products, read_orders, write_orders
SMS (Sendblue)chat.identify — link your phone to your account; chat.reply — receive and send messages.
Chapter 10

ShipStation Integration

Connect your own ShipStation account to push MedGrid orders directly into your shipping queue and pull tracking numbers back automatically.

What ShipStation Does in MedGrid

  • MedGrid Sales Orders assigned to your products are pushed to your ShipStation account as new orders.
  • You process and ship them normally inside ShipStation.
  • MedGrid periodically pulls tracking numbers and carrier information from ShipStation and stamps them on the Delivery Note.
  • Customers receive automatic shipping notifications via MedGrid.

Connecting ShipStation

  1. Log in to ShipStation and go to Account Settings > API Settings.
  2. Copy your API Key and API Secret.
  3. In the MedGrid Vendor Portal, go to Integrations.
  4. Click Connect next to ShipStation.
  5. Enter your API Key and API Secret, then click Connect.
  6. MedGrid tests the credentials immediately — you'll see a success confirmation.

Connect via API

POST/api/method/medgrid.integrations.connect_shipstation
{
  "api_key": "your-shipstation-api-key",
  "api_secret": "your-shipstation-api-secret"
}

Response on success:

{
  "message": {
    "ok": true,
    "integration": "shipstation",
    "status": "connected"
  }
}

Response on invalid credentials:

{
  "message": {
    "ok": false,
    "error": "Invalid API Key or Secret — ShipStation rejected the credentials.",
    "status": "error"
  }
}

Manual Sync

You can trigger a manual sync at any time — either from the portal or via API. This pushes all unfulfilled MedGrid orders to ShipStation and pulls tracking numbers for previously pushed orders.

POST/api/method/medgrid.integrations.sync_now
{
  "integration_type": "shipstation"
}

Response:

{
  "message": {
    "ok": true,
    "stats": {
      "orders_pushed": 3,
      "tracking_pulled": 5,
      "round_trip_ok": true
    }
  }
}

Test Connection

POST/api/method/medgrid.integrations.test_connection
{
  "integration_type": "shipstation"
}

Response:

{
  "message": {
    "ok": true,
    "error": null
  }
}

Disconnect

POST/api/method/medgrid.integrations.disconnect
{
  "integration_type": "shipstation"
}

Order Payload Sent to ShipStation

When MedGrid pushes an order to ShipStation, the following data is included:

FieldDescription
orderNumberMedGrid Sales Order ID (e.g. SAL-2026-00123)
orderDateDate the order was placed in MedGrid
orderStatusAlways awaiting_shipment on creation
customerEmailCustomer contact email for ShipStation notifications
amountPaidTotal order value in USD
items[].skuMedGrid item_code (your SKU)
items[].nameItem name
items[].quantityQuantity ordered
items[].unitPriceUnit price at time of order
Rate Limit: ShipStation limits API calls to 40 requests per minute. MedGrid handles retries automatically using exponential backoff if this limit is hit.
Chapter 11

Shopify Integration

Connect your own Shopify store to MedGrid. Sync your product catalog bidirectionally and receive MedGrid orders as Shopify orders.

What the Shopify Integration Does

  • MedGrid imports your Shopify product catalog and links each variant to its matching MedGrid Item via SKU.
  • New MedGrid Sales Orders for your products are created as orders in your Shopify store.
  • When Shopify marks an order as fulfilled, MedGrid receives the tracking information via webhook and updates the customer's order status.

OAuth Connection Flow

Shopify uses the industry-standard OAuth 2.0 protocol. You do not share your Shopify admin password — instead you grant MedGrid specific read/write permissions on your store.

Step 1 — Start the Install

POST/api/method/medgrid.integrations.shopify_start_install
{
  "shop_domain": "your-store.myshopify.com"
}

Response:

{
  "message": {
    "ok": true,
    "authorize_url": "https://your-store.myshopify.com/admin/oauth/authorize?client_id=...",
    "state": "abc123nonce"
  }
}

Open the authorize_url in a browser (or a popup). You will be taken to Shopify's permission approval screen.

Step 2 — Approve Permissions in Shopify

Shopify shows you a screen listing the permissions MedGrid is requesting:

  • Read and write your products
  • Read and write your orders

Click Install app to approve. Shopify will redirect back to MedGrid automatically.

Step 3 — OAuth Callback (Automatic)

Shopify redirects to MedGrid's callback URL with a temporary code. MedGrid exchanges this code for a permanent access token and saves it to your integration. The popup closes and your Integrations Portal shows "Connected".

Manual Sync

POST/api/method/medgrid.integrations.sync_now
{
  "integration_type": "shopify"
}

Response:

{
  "message": {
    "ok": true,
    "stats": {
      "products_pulled": 47,
      "round_trip_ok": true,
      "sample_titles": ["Product A", "Product B", "Product C"]
    }
  }
}

Permissions Requested

ScopeWhy MedGrid Needs It
read_productsImport your Shopify product catalog to match with MedGrid items via SKU.
write_productsUpdate product availability status if MedGrid catalog changes.
read_ordersRead existing order status and fulfillment data.
write_ordersCreate new orders in your Shopify store when customers order on MedGrid.
Chapter 12

SMS / iMessage Integration

Verify your mobile phone number to get AI-powered MedGrid support via SMS or iMessage — on demand, from your phone.

What You Get

  • Text the MedGrid helpdesk number at any time to ask questions about your orders, account, or catalog.
  • The AI assistant knows your account — no need to re-explain who you are.
  • Receive order status updates and tracking notifications on demand.

How to Connect

  1. In the Vendor Portal, go to Integrations and find the SMS / iMessage card.
  2. Enter your US mobile phone number.
  3. Click Send Verification Code. You'll receive a 6-digit OTP via SMS.
  4. Enter the code to confirm. Your phone is now verified and linked to your MedGrid account.
Note: Only US phone numbers are supported. Your phone number is only used to identify you for helpdesk purposes — it is never shared with third parties or used for marketing.
Chapter 13

Webhooks

Webhooks allow external systems to push real-time updates to MedGrid as events happen — no polling required.

How Webhooks Work

A webhook is an HTTP POST request that an external system (Shopify, ShipStation) sends to MedGrid when something happens — for example, when a Shopify order is fulfilled. MedGrid receives the event, verifies its authenticity, and updates the relevant order or delivery record automatically.

Inbound Webhook Endpoints

EndpointSourcePurpose
/api/method/medgrid.exoceuticals.webhook Shopify (Exoceuticals) Receives order fulfillment and cancellation events. Updates order status and tracking in MedGrid.

Webhook Security — HMAC Verification

MedGrid verifies every inbound webhook using HMAC-SHA256 to ensure the request is genuine and has not been tampered with.

Each webhook must include an X-Shopify-Hmac-Sha256 header containing a Base64-encoded HMAC signature of the raw request body, signed with your shared webhook secret.

X-Shopify-Hmac-Sha256: BASE64(HMAC_SHA256(webhook_secret, raw_request_body))
Security: Any webhook request that fails HMAC verification is immediately rejected with HTTP 401. Never skip HMAC verification when testing.

Webhook Event Payload (Shopify Order Fulfilled)

{
  "id": 4567890123,
  "fulfillment_status": "fulfilled",
  "cancelled_at": null,
  "fulfillments": [
    {
      "tracking_number": "1Z999AA10123456784",
      "tracking_company": "UPS",
      "tracking_urls": ["https://ups.com/track?number=1Z999AA10123456784"]
    }
  ]
}

Webhook Topics Supported

TopicWhen It FiresMedGrid Action
orders/updatedAny change to an order in ShopifyPolls order status and updates Sales Order fields.
orders/fulfilledOrder is marked fulfilled in ShopifySets order status to Fulfilled; stamps tracking number.
orders/cancelledOrder is cancelled in ShopifySets order status to Cancelled in MedGrid.
Chapter 14

Error Handling

What to do when an API call or integration fails.

Standard Error Response

When a MedGrid API call fails, the response includes a server message describing what went wrong:

{
  "exc_type": "ValidationError",
  "_server_messages": "[{\"message\": \"Both API Key and API Secret are required.\"}]"
}

HTTP Status Codes

CodeMeaningWhat To Do
200SuccessRequest completed. Check message.ok for integration-specific success flags.
400Bad RequestA required field is missing or invalid. Check _server_messages for details.
401Authentication FailedYour API Key/Secret is wrong or missing. Verify the Authorization header format.
403Permission DeniedYour account does not have permission for this action. Contact MedGrid support.
409Already SyncedThis order was already pushed to the external system. Do not resubmit — check the existing order.
417Business Logic ErrorThe order is not in the correct state (e.g., still Draft). Ensure all required fields are filled and the order is submitted.
429Rate LimitedToo many requests. MedGrid retries automatically; implement exponential backoff in your own code.
500Server ErrorUnexpected error on MedGrid's side. Contact MedGrid support with the error details.

Integration-Specific Errors

IntegrationCommon ErrorResolution
ShipStationHTTP 401 from ShipStationInvalid API Key/Secret. Regenerate credentials in ShipStation and reconnect.
ShipStationHTTP 429 from ShipStationRate limit hit (40 req/min). MedGrid retries automatically — no action needed.
Shopify"Shop domain must end in .myshopify.com"Ensure you enter the full domain (e.g. your-store.myshopify.com).
Shopify"OAuth state expired"The OAuth flow timed out (10-minute window). Start the connection flow again.
ShopifyHTTP 401 on testAccess token has been revoked in Shopify. Disconnect and reconnect to get a new token.
Support: If an error persists, email integrations@medgrid.com with the error message, timestamp, and your vendor account name. Our team responds within 1 business day.