DEV Community

SEO - NT Tech Innovation
SEO - NT Tech Innovation

Posted on AI-assisted

Retry Without Double-Ordering: Idempotency Notes for SMM Panel API Scripts

If you script orders against an SMM panel API, the scariest bug is not a failed request. It is a request that succeeded on the server, timed out on your side, and then got retried. Now the customer paid once and you ordered twice.

This post is a short checklist for avoiding that, using the common /api/v2 pattern (key, action, service, link, quantity) that most panels share. I tested these ideas against an Indian SMM panel that follows the same layout, but nothing here is panel-specific.

The failure mode

  • Your script sends action=add.
  • The panel creates the order and starts replying.
  • Your network drops, or your HTTP client hits its timeout first.
  • Your retry loop sends action=add again.
  • Two orders now exist.

A blind retry on a write call is the root problem.

Rule 1: never auto-retry add

Retries are fine for reads like services, status and balance. For add, treat any timeout as "unknown" rather than "failed". Log it and check before you try again.

Rule 2: keep your own order key

Most panel APIs do not accept a client-side idempotency key, so build one yourself:

  • Hash service + link + quantity + your internal job id.
  • Store it with status pending before the HTTP call.
  • Write the returned panel order id next to it on success.
  • On an unknown result, do not send again until you have checked.

Rule 3: reconcile using balance and status

When a call ends in "unknown", two cheap checks usually settle it:

  • Compare balance before and after. A drop that matches the order cost suggests the order went through.
  • If you have any order ids from that window, call status on them in one batch.

Only mark the job failed when both checks say nothing happened.

Rule 4: back off politely

For read calls, use exponential backoff with jitter (1s, 2s, 4s, capped around 30s). Panels are often small teams on modest servers, and hammering them helps nobody.

Rule 5: log the raw response

Save the raw JSON for every write call. When a client says "I was charged twice", that log is the fastest way to prove what really happened.

Wrap-up

None of this is fancy. It is just treating order creation as a money operation instead of a normal GET. If you are new to how panels process an order from link to delivery, the how it works page on SMMYodha lays out the flow clearly, and it maps neatly onto the states above.

Written by MD Fozla Rabbi, SEO Specialist.

Top comments (0)