eCOD is a solution that allows your delivery executives to accept digital payments instead of cash.
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.
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.
- 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:
- Delivery executive shows the wallet list to the customer on their own phone.
- Customer selects a wallet and enters their phone number.
- Customer receives an SMS from the wallet provider.
- Customer inputs the OTP on the delivery executive’s phone.
- Payment is complete!
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:
- Delivery executive selects UPI on their phone.
- Customer provides their VPA (Virtual payment address).
- Customer receives a collect request on their own phone that has been configured for UPI.
- Customer approves the collect request using MPIN.
- Payment is complete!
This payment method requires the customer to have VPA configured and working internet as UPI doesn’t work without internet.
Link based methods include:
- Debit/Credit Cards
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:
- Customer notifies the delivery executive that they want to make a payment on their own device.
- Delivery executive selects Link Payments on their device.
- 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.
- Customer opens the link on a computer or mobile.
- 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.
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.
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:
- Create an Invoice on your server
- Pass the
invoice_idto Razorpay’s Android SDK
That’s it! Razorpay’s Android SDK handles everything else. The overall flow is explained below:
- Delivery executive selects an order in the merchant’s app.
- Delivery executive clicks on Initiate Payment.
- The merchant app makes a request to merchant server.
- Merchant server calls the create invoice request on Razorpay’s API.
- Razorpay’s API returns an
invoice_id. This is passed on to the merchant app by the merchant server.
- Merchant app invokes Razorpay’s Android SDK and passes the
- Razorpay’s SDK displays a UI for selecting payment mode.
- Customer selects a payment mode.
- Once the payment is completed, Razorpay’s Android SDK passes back the control to merchant app with the result, success or failure.
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.
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:
- ecod: true
Without these parameters, the eCOD checkout form will not be shown.
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
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.