E-commerce

Cash on Delivery Order Confirmation on WhatsApp: Cut Fake and Returned Orders

Any statistics or percentages in this article are general industry figures or illustrations, not QuackAPI measurements or promises. Results depend on your audience, consent and sending patterns. QuackAPI connects to WhatsApp as a linked device (an unofficial method), so read our risk and acceptable use policy before sending.

December 2, 20268 min read

Why COD orders need a confirmation message

Cash on delivery is how a large share of online orders are paid in Pakistan, India, Bangladesh, the Gulf and much of Africa. It lowers the barrier to buy, but it also means nobody has paid anything yet. Some orders are typos, some are pranks, and some customers change their mind before the courier arrives. Each one that comes back costs you shipping both ways and a day of the courier's time.

A short WhatsApp message right after checkout fixes most of this. It repeats the order, asks for one reply, and gives you a clean yes or no before you pack anything. Customers already have WhatsApp open, so a reply takes seconds, which is why this works better than a call that nobody answers.

Only message people who have agreed to hear from you. QuackAPI is a linked-device service, not Meta's official Cloud API, so WhatsApp can restrict a number it considers abusive. Read the acceptable use policy before you automate anything.

The flow in four steps

Keep the flow short enough that the customer finishes it without thinking.

StepWhat happensWhat your system does
1. Order placedCustomer checks out with COD.Save the order as pending confirmation.
2. Message sentCustomer gets the summary and "Reply 1 to confirm, 2 to cancel".Call POST /v1/messages/chat and store the phone number against the order.
3. Customer repliesCustomer sends 1 or 2 (or something else).Your webhook receives message.received and finds the pending order for that number.
4. Order updatedCustomer gets a short thank-you or cancellation note.Mark the order confirmed or cancelled, then send the next message.

Step 1 and 2: send the confirmation

Use the international number without a plus sign or spaces, for example 923001234567 for a Pakistani mobile. The country code lookup tool turns local formats such as 0300 1234567 into the right form. Keep the message plain and put the details people care about first: items, total and delivery city.

javascript
async function askToConfirm(order) {
  const body =
    `Hello ${order.name}, we received your order #${order.id}.\n` +
    `${order.items}\nTotal to pay on delivery: ${order.total}\n\n` +
    `Reply 1 to confirm or 2 to cancel.`;

  const res = await fetch("https://quackapi.com/v1/messages/chat", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": process.env.QUACKAPI_KEY,
    },
    body: JSON.stringify({ deviceId: 1, to: order.phone, body }),
  });
  if (!res.ok) throw new Error((await res.json()).message);
  await markPending(order.id, order.phone); // remember who we asked
}

Step 3 and 4: read the reply

Set your device webhook to a URL on your server. QuackAPI posts a message.received event with the sender in from and the text in content. Answer 200 straight away, then do the work, and ignore events you have already handled because the same event can arrive more than once. The webhook guide has the full payload.

javascript
import express from "express";
const app = express();
app.use(express.json());
const seen = new Set();

app.post("/hooks/whatsapp", async (req, res) => {
  res.sendStatus(200);
  const e = req.body;
  if (e.event !== "message.received" || seen.has(e.messageId)) return;
  seen.add(e.messageId);

  const order = await findPendingOrderByPhone(e.from);
  if (!order) return;

  const answer = String(e.content).trim();
  if (answer === "1") {
    await confirmOrder(order.id);
    await sendText(e.from, "Thank you, your order is confirmed and will ship soon.");
  } else if (answer === "2") {
    await cancelOrder(order.id);
    await sendText(e.from, "Your order has been cancelled. You can order again any time.");
  } else {
    await sendText(e.from, "Please reply 1 to confirm or 2 to cancel.");
  }
});

Details that make it work in practice

Accept more than the digit. Customers type "yes", "confirm", "ok" or the same words in their own language, so match a small list and fall back to asking again. Match the reply to the newest pending order for that number, because one customer can place two orders in an hour.

Set a deadline. If nobody answers in, say, three hours, send one reminder, and after that let a person call. Do not send a third message. Also send during normal waking hours in the customer's time zone, since a confirmation at 3 am looks like spam.

Keep the volume natural. These are replies to a purchase the person just made, which is the safest kind of automated message, but a brand-new number that suddenly sends hundreds of messages can still be restricted. Warm the number up and follow the advice in how to avoid a WhatsApp number ban.

Once confirmation works, the same webhook can power the next messages: a dispatch notice, a courier tracking link and a delivery reminder. See order updates over WhatsApp for the pattern.

Is a confirmation message allowed without opt-in?
The customer just gave you their number to place an order, and the message is about that order, so it is expected. Keep it to the order, do not add promotions, and stop messaging anyone who asks you to.
What if the customer never replies?
Send one reminder, then hand the order to a person to phone. Do not ship an unconfirmed order if returns are your main cost.
Can I do this with Shopify or WooCommerce?
Yes. Trigger the send from the order-created event. See the Shopify and WooCommerce guides.
Do I need the official WhatsApp Business API?
Not to run this flow with QuackAPI. The official API suits very large volumes with approved templates, but it has its own approval process and per-message fees. See Cloud API vs linked-device APIs.

Ready to get started?

Send WhatsApp Messages via API — Free

No Meta Business verification. No credit card. Connect your WhatsApp in under 2 minutes and start sending messages through the REST API.

Related Articles