By MD Fozla Rabbi, SEO Specialist
Refill guarantees are one of those features everyone pays for and almost nobody uses properly.
A customer buys 1,000 followers with a 30-day refill. Two weeks later the count dips by 80. Do they ask for a refill? Usually not. They forget. Or they don't notice. Or they assume it's too late. Then day 31 arrives and the guarantee quietly expires.
If you run a small boosting shop, that's a missed chance to keep a customer happy for free.
This post builds a tiny refill tracker in Node.js. It remembers which orders still have refill coverage, asks the panel for refills when it makes sense and tracks whether each refill actually finished.
How refills work on v2-style panels
Most panels that follow the common v2 API format give you three things to work with:
- The
servicesaction tells you whether a service supports refill with arefill: trueflag. The refill period itself is usually written in the service name, like "R30" or "30 Days Refill." - The
refillaction takes anorderID (or up to 100orders) and returns a refill ID. - The
refill_statusaction takes arefillID (or up to 100refills) and returns a status like Pending, Completed or Rejected.
That's enough to build the whole thing.
The examples point at BoostingPH, a peso-priced SMM panel Philippines shops use for Facebook, TikTok and Instagram services. The endpoint is https://boostingph.com/api/v2. Swap the URL and the same code works with most v2 panels.
Step 1: a shared API helper
const API_URL = "https://boostingph.com/api/v2";
async function call(action, params = {}) {
const body = new URLSearchParams({ key: process.env.SMM_API_KEY, action, ...params });
const res = await fetch(API_URL, { method: "POST", body });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
if (data && !Array.isArray(data) && data.error) throw new Error(data.error);
return data;
}
The data.error check catches the classic trap. Panels often answer with HTTP 200 and an error in the body.
Step 2: figure out the refill window
The API tells you whether refill exists. It rarely tells you how long. So we read it from the service name, with a safe default.
function refillDays(service) {
if (!service.refill) return 0;
const m = String(service.name).match(/\b(?:R|refill\s*)(\d{1,3})\s*(?:d|days?)?\b/i)
|| String(service.name).match(/(\d{1,3})\s*days?\s*refill/i);
if (m) return Number(m[1]);
if (/lifetime/i.test(service.name)) return 365;
return 30; // conservative default when the name doesn't say
}
Is parsing names a bit hacky? Yes. Service names aren't a contract. But it beats hardcoding windows for 300 services by hand. Log anything that falls back to the default and check those once.
Step 3: remember each order with its deadline
When you place an order, save the deadline next to it. A JSON file is fine to start.
import { readFileSync, writeFileSync, existsSync } from "node:fs";
const STORE = "./refills.json";
const load = () => (existsSync(STORE) ? JSON.parse(readFileSync(STORE, "utf8")) : {});
const save = (s) => writeFileSync(STORE, JSON.stringify(s, null, 2));
export function trackOrder(orderId, service, placedAt = Date.now()) {
const days = refillDays(service);
if (!days) return;
const store = load();
store[orderId] = {
service: service.service,
expiresAt: placedAt + days * 86_400_000,
refills: [],
lastRequestAt: 0,
};
save(store);
}
Orders without refill never enter the store. Less noise, smaller file.
Step 4: request refills on a polite schedule
Here's the core loop. Run it once a day. It skips expired orders, respects a cooldown and batches requests.
const COOLDOWN = 3 * 86_400_000; // don't re-request within 3 days
export async function requestDueRefills(isDropped) {
const store = load();
const now = Date.now();
const due = Object.entries(store)
.filter(([, o]) => o.expiresAt > now && now - o.lastRequestAt > COOLDOWN)
.map(([id]) => id);
const toRefill = [];
for (const id of due) {
if (await isDropped(id)) toRefill.push(id);
}
for (let i = 0; i < toRefill.length; i += 100) {
const chunk = toRefill.slice(i, i + 100);
const result = await call("refill", { orders: chunk.join(",") });
for (const r of result) {
const o = store[r.order];
if (!o) continue;
o.lastRequestAt = now;
if (typeof r.refill === "object" && r.refill?.error) {
o.refills.push({ error: r.refill.error, at: now });
} else {
o.refills.push({ id: r.refill, status: "Pending", at: now });
}
}
}
save(store);
return toRefill.length;
}
That isDropped function is yours to supply. Maybe you compare the current follower count with the count right after delivery. Maybe a customer flagged it. Keep the decision outside this loop so the loop stays simple.
Why the cooldown? Panels don't love repeated refill requests on the same order while one is already running. Three days is a reasonable gap. Adjust to taste.
Step 5: check how refills went
export async function updateRefillStatuses() {
const store = load();
const pending = [];
for (const o of Object.values(store)) {
for (const r of o.refills) if (r.id && r.status === "Pending") pending.push(r);
}
for (let i = 0; i < pending.length; i += 100) {
const chunk = pending.slice(i, i + 100);
const result = await call("refill_status", { refills: chunk.map((r) => r.id).join(",") });
for (const row of result) {
const r = chunk.find((x) => String(x.id) === String(row.refill));
if (r && typeof row.status === "string") r.status = row.status;
}
}
save(store);
}
Completed means the panel topped the order back up. Rejected usually means the drop doesn't qualify or the window already closed on their side. Either way you now have a record, which helps when a customer asks what happened.
Step 6: clean up expired orders
Once a week, drop orders whose window closed more than a month ago. Keep the file small.
export function pruneExpired(graceDays = 30) {
const store = load();
const cutoff = Date.now() - graceDays * 86_400_000;
for (const [id, o] of Object.entries(store)) if (o.expiresAt < cutoff) delete store[id];
save(store);
}
A schedule that works
Put the three jobs on cron and forget about them:
-
Daily, morning:
requestDueRefills() -
Every 6 hours:
updateRefillStatuses() -
Weekly:
pruneExpired()
Running refill requests more often than daily rarely helps. Drops happen slowly. So do refills.
Why customers notice this
Honestly, this is a retention tool disguised as a cron job. A short "we noticed a small drop and requested a free refill" message builds more trust than any discount. And it costs you nothing, since the guarantee was already part of the price.
If you're still choosing a provider in the Philippines, read this honest guide to boosting sites in the Philippines with real prices first. It covers what to check before trusting any refill promise. The full service list, refill flags included, is at https://boostingph.com/services.
Wrapping up
Around 100 lines of Node. A JSON file. Three cron jobs.
You get refill requests sent before guarantees expire, a status history per order and happier customers who never had to ask.
Built something similar with a database or a queue? Share it in the comments. I'd love to see how others handle the refill window parsing, since that part is the messiest.

Top comments (0)