Use case · E-commerce
E-commerce SMS notifications for online and Facebook shops
OTP at checkout, cash-on-delivery confirmation, order updates and promotions — every SMS an online store sends, through one API. Built into BitCommerz and works with any platform.
The problem
Online shops in Bangladesh run on cash on delivery, and fake or careless orders are expensive: the courier fee is lost and stock sits in a van for days. Customers want to know where their parcel is, and they trust a shop that keeps them informed.
Many shops end up with one SMS service for OTP, another for promotions, and manual messages for everything else. Costs are hard to track and nobody can say which messages actually arrived.
How BitSMS solves it
OTP at checkout and sign-up
COD confirmation and order updates
Promotions to past customers
BitCommerz built-in, any platform welcome
In your code
One API for every store message
If your store is not on BitCommerz, sending an order SMS is a single HTTPS request from your backend. Use OTP endpoints for checkout codes and the bulk endpoint for promotions.
- Give each app its own API key with only the permissions it needs.
- Idempotency keys stop a retried request from sending the same update twice.
- Facebook shops without a website can send from the dashboard instead.
curl https://sms-api.bitcommerz.com/v1/messages \
-H "Authorization: Bearer $BITSMS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-5521-shipped" \
-d '{"to": "01712345678", "text": "Your order #5521 has shipped."}'// Node.js 18+ (built-in fetch)
const res = await fetch("https://sms-api.bitcommerz.com/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BITSMS_API_KEY}`,
"Content-Type": "application/json",
// Same key on a retry = no duplicate SMS, no double charge.
"Idempotency-Key": "order-5521-shipped",
},
body: JSON.stringify({ to: "01712345678", text: "Your order #5521 has shipped." }),
});
const msg = await res.json();
console.log(res.status, msg.id, msg.status); // 202 "0192…" "queued"<?php
$ch = curl_init("https://sms-api.bitcommerz.com/v1/messages");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("BITSMS_API_KEY"),
"Content-Type: application/json",
"Idempotency-Key: order-5521-shipped",
],
CURLOPT_POSTFIELDS => json_encode([
"to" => "01712345678",
"text" => "আপনার অর্ডার #5521 পাঠানো হয়েছে।",
]),
]);
$body = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE); // 202
echo $body["id"], " ", $body["parts"], " part(s)\n";import os, requests
res = requests.post(
"https://sms-api.bitcommerz.com/v1/messages",
headers={
"Authorization": f"Bearer {os.environ['BITSMS_API_KEY']}",
"Idempotency-Key": "order-5521-shipped",
},
json={"to": "01712345678", "text": "Your order #5521 has shipped."},
timeout=10,
)
msg = res.json()
print(res.status_code, msg["id"], msg["status"]) # 202 ... queuedbody, _ := json.Marshal(map[string]string{
"to": "01712345678",
"text": "Your order #5521 has shipped.",
})
req, _ := http.NewRequest("POST", "https://sms-api.bitcommerz.com/v1/messages", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("BITSMS_API_KEY"))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "order-5521-shipped")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err) // safe to retry with the same Idempotency-Key
}
defer res.Body.Close()
var msg struct{ ID, Status string }
json.NewDecoder(res.Body).Decode(&msg)
fmt.Println(res.StatusCode, msg.ID, msg.Status) // 202 ... queuedFrequently asked questions
How do I connect BitSMS to my BitCommerz store?
Sign up at BitSMS and create an API key. In your BitCommerz dashboard, choose BitSMS as the SMS gateway and paste the key. Your store's order and OTP messages then go through BitSMS.
Does BitSMS work with WooCommerce or a custom website?
Yes. Any platform that can make an HTTPS request can send through the BitSMS REST API. The Developers page has samples in cURL, Node.js, PHP, Python and Go.
Can SMS help reduce fake cash-on-delivery orders?
Verifying the buyer's number with an OTP at checkout, or sending a COD confirmation SMS, makes sure the order comes from a real, reachable phone number before you hand it to a courier.