API ReferenceIntegrationsKnowledge Base


What is eCOD?#

eCOD is a solution that allows your delivery executives to accept digital payments instead of cash.

How to Integrate eCOD#

The prerequisites for integrating eCOD are given below:

  • Merchant must have an app for delivery executives.
  • Delivery executives should have internet access on their device.
  • eCOD is available as an Android SDK that can be embedded in the delivery app of the merchant. The SDK handles the entire user interface for collecting payments through the various payment modes.

Supported Payment Methods#

eCOD allows all payment modes: card, netbanking, wallets and UPI. These modes can be divided into two categories:

  • On Delivery App Methods The customer need not open any link.

  • Link Based Methods The customer can use these payments modes on their own device only, through a special link.

On Delivery App Methods#

These include:

  • Wallets
  • UPI
  • Wallet Payments For wallet payments, if a customer has enough balance in the wallet, the payment can be made through just an OTP.

The flow is explained below:

  1. Delivery executive shows the wallet list to the customer on their own phone.
  2. Customer selects a wallet and enters their phone number.
  3. Customer receives an SMS from the wallet provider.
  4. Customer inputs the OTP on the delivery executive’s phone.
  5. Payment is complete!

No Internet Connectivity Required:
This payment method does not require internet on the customer’s side.

UPI Payments UPI payments work through Collect request. Here’s the flow for it:

  1. Delivery executive selects UPI on their phone.
  2. Customer provides their VPA (Virtual payment address).
  3. Customer receives a collect request on their own phone that has been configured for UPI.
  4. Customer approves the collect request using MPIN.
  5. Payment is complete!

UPI requires Internet Connectivity:
This payment method requires the customer to have VPA configured and working internet as UPI doesn’t work without internet.

Link Based Methods#

Link based methods include:

  • Debit/Credit Cards
  • Netbanking
  • Wallets
  • UPI

While Wallets and UPI based payments can also be made through the delivery executive’s device, card and netbanking methods are only available via a special link.

The flow for link based payment is as follows:

  1. Customer notifies the delivery executive that they want to make a payment on their own device.
  2. Delivery executive selects Link Payments on their device.
  3. Customer receives an SMS with a link. This link is a short link and is also visible on the delivery executive’s device in text as well as QR format.
  4. Customer opens the link on a computer or mobile.
  5. The standard Razorpay Checkout form opens up through which customer can pay using Card, Netbanking etc. Once the payment is complete, the delivery executive’s phone automatically receives notification on this.

Razorpay SDK Includes the UI:
In all of the above payment methods, link based as well as delivery device, the delivery executive is interacting with a UI developed by Razorpay. This will drastically reduce the integration time.

Integration Process#

eCOD runs on top of Razorpay’s Invoices system. An eCOD payment is basically made against an invoice. This requires only two steps of integration:

  1. Create an Invoice on your server
  2. Pass the invoice_id to Razorpay’s Android SDK

That’s it! Razorpay’s Android SDK handles everything else. The overall flow is explained below:

  1. Delivery executive selects an order in the merchant’s app.
  2. Delivery executive clicks on Initiate Payment.
  3. The merchant app makes a request to merchant server.
  4. Merchant server calls the create invoice request on Razorpay’s API.
  5. Razorpay’s API returns an invoice_id. This is passed on to the merchant app by the merchant server.
  6. Merchant app invokes Razorpay’s Android SDK and passes the invoice_id.
  7. Razorpay’s SDK displays a UI for selecting payment mode.
  8. Customer selects a payment mode.
  9. Once the payment is completed, Razorpay’s Android SDK passes back the control to merchant app with the result, success or failure.

Create an Invoice (Server Side)#

Step 4 described above involves creating an Invoice through Razorpay’s API. All you need for creating an invoice is the amount and the contact number of the customer.

The API details are covered in depth in the document on invoices available here.

Mandatory Fields for eCOD
For eCOD, you need to pass the following fields mandatorily in the create invoice API:

  • type: ecod
  • view_less: 1 Without these fields, there's no guarantee of the functionality working as described.

Once this step is completed, you will have an invoice_id. This needs to be passed to merchant's mobile application.

Invoke Razorpay's Android SDK#

Step 6 involves invoking Razorpay's Android SDK. The standard documentation for integration the android SDK apply here too and is available here. You can use the latest SDK available.

In the JSONO bject options that you will pass to the SDK, you need to necessarily pass the following fields:

  • invoice_id:
  • ecod: true

Without these parameters, the eCOD checkout form will not be shown.

Complete the Payment#

The delivery executive and the customer need to interact with the special eCOD checkout form displayed by the SDK. The customer has various options for completing the payment. In all the cases, once the payment is completed, the android SDK will call merchant's onPaymentSuccess method and pass over the payment_id.

Handle Link Based Payment#

If the customer chooses link based payment, an SMS is automatically sent to the customer's phone. The customer can open this link on their phone or computer. Once the payment is completed on their device, the SDK will automatically detect that the payment has been completed and call merchant's onPaymentSuccess method.


In case you have any issue integrating Payment Links, you can raise a ticket on our Support Portal.