Skip to main content

API Integration with TATA 1mg

This guide outlines the process for integrating with TATA 1mg’s APIs. With this integration, you'll be able to manage order placements, handle payments, and receive notifications for both prescription drugs and over-the-counter (OTC) products. By following the steps below, you can seamlessly integrate your system with TATA 1mg and start offering pharmacy services driven via 1mg.

Overview

API Integration allows you to directly interact with TATA 1mg’s services via RESTful APIs. This approach gives you full control over operations like order management, inventory checks, and payment processing.

Prerequisites

  1. Merchant ID: Ensure you have a valid merchant id with TATA 1mg shared from our business team.

  2. Private Key: You will need the private key provided by TATA 1mg to authenticate API requests.

  3. Access to API Specs: Review the API Documentation before proceeding with the integration.

Custom Flows

If your integration requirements differ from our standard offerings, we have two custom flows that might suit your needs:

  1. Done in One Flow:

The "Done in One" flow is a streamlined process for merchant users to order medicine. This flow is initiated with a single API call, which includes uploading a valid prescription. TATA 1mg validates the prescription and places the order without requiring any additional API calls from the merchant.

Read more here!

  1. Pay via Link Flow:

The "Pay via Link" flow offers flexibility for merchant customers ordering medicines through TATA 1mg APIs. In this flow, a unique payment link is generated by TATA 1mg, allowing customers to complete their payment on a secure page hosted by TATA 1mg, instead of handling payments directly within the merchant's application.

Read more here!

If these flows don't meet your requirements, please reach out to our business team for further assistance.

How to implement our Pharmacy APIs -

To ensure a smooth integration process, follow these steps sequentially. Each step is designed to guide you through the essential tasks needed to set up your API integration with TATA 1mg, from authentication to managing orders and handling payments.

  1. Generate JWT Token
  2. Check Service Availability
  3. Search Products
  4. Retrieve Product Details
  5. Check Inventory
  6. Manage Orders
  7. Handle Payments for COD
  8. Handle Payments for Online Orders
  9. Receive Order Status Updates
  10. Track Orders
  11. Cancel Orders

1. Generate JWT Token

To authenticate API requests, you need to generate a JWT (JSON Web Token). The token is required for authorization when interacting with TATA 1mg Order APIs.

Refer to our JWT Token Generation Guide for complete info

2. Check Service Availability

Use the City Serviceable API to verify whether 1MG services (like drug and OTC product availability) are accessible in a specific city.

3. Search Products

Implement the Search APIs to enable search and autosuggestion functionality for drug and OTC products.

4. Retrieve Product Details

Based on the SKU (Stock Keeping Unit) of the product, determine whether to call the Drug Detail API or the OTC Detail API to fetch additional product details.

  • Static Subset APIs: Contain fixed product information.
  • Dynamic Subset APIs: Include real-time price information.

5. Check Inventory

Use the Inventory Check API to verify SKU availability, apply discounts, calculate applicable charges, and return the final payable amount for the cart.

6. Manage Orders

  • Create Order: Use the Create Order API to start the order creation process.
  • Confirm Order: For online orders, call the Confirm Order API to finalize the order.
    • For payment confirmation on 1MG's end, 1MG will call merchant's payment webhook to get the order payment status.
    • More Information on Merchant Payment Solution

7. Handle Payments for COD

For Cash on Delivery (COD) orders, only the Create Order API is required. No additional transaction handling is necessary.

8. Handle Payments for Online Orders

For online payments, merchants need to collect payment at their end and inform TATA 1mg about it's status via 3 webhooks:

  • Transaction Status Check
  • Refund Initiation
  • Refund Status Check

For more details, see Merchant Payment Solution.

9. Receive Order Status Updates

All order updates are sent through an Order Status Webhook provided by the merchant's side. This webhook notifies the merchant of any order changes or updates.

For details, see Merchant Order Updates.

10. Track Orders

Use the Track Order API to fetch 1MG order details using the merchant_order_id.

1MG will also split orders for various reasons affecting the webhook updates and response in this API. Refer to What is Split Order ? for more details.

11. Cancel Orders

  • Merchants can cancel 1MG orders before the "Packaging" stage using the Cancel Order API.

  • For online orders, refunds will be processed by 1MG.