Diagnose Google Play Billing incidents locally, with evidence. Not affiliated with Google.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
One-click editor setup isn’t available for this listing yet — we don’t have a confirmed install command, and we’d rather show nothing than point your editor at the wrong package or host. Follow the project’s own setup instructions, linked above.
Billing Doctor reads what happened to a Google Play purchase and tells you where it broke. It runs on your machine, calls nothing, changes nothing at Google, and shows its evidence. Not affiliated with Google.
It is for developers who run their own Google Play Billing backend, in Node, Python, PHP, Go or Java, with Capacitor, Flutter, React Native or native Android in front, and did not choose a subscription platform. It is the tool you run at 11 pm when a subscription broke.
The fixture below ships in the repository, so start from a checkout:
(The same fixtures ship inside the npm package: after npm install -g billing-doctor they are under $(npm root -g)/billing-doctor/fixtures/.)
Every finding carries the events it rests on, the mechanism, Google's rule quoted with a dated link, a confidence (certain, likely, possible) and the next thing to check. Exit code 1 means a high finding exists, so the command can gate CI.
You give it a timeline: one JSON file with what happened to one purchase, assembled from your logs, your database, the Cloud Console and the support ticket. The notifications Google sent, the API answers, what your backend wrote, what the user said. Tokens are pseudonyms; nothing real goes in the file.
It checks the timeline against 97 rules in eleven groups. Every one of them rests on a sentence from Google's own documentation, quoted verbatim with the URL and the date it was read:
| Group | What it catches |
|---|---|
| A. Configuration and permissions | no notifications at all, 401/403, the topic in another project, negative acks, an unauthenticated endpoint, a release below Billing Library 8 after the 2026-08-31 gate, one-time notifications never switched on |
| B. Purchase and acknowledgement | unacknowledged purchases Google refunded, acknowledging or granting while PENDING, consumables acknowledged not consumed, grants before verification, double grants, acknowledgement failures the client never heard about, prepaid windows, multi-quantity purchases granted as one, plan changes blocked by an unacknowledged subscription, purchases never acknowledged with no refund in the file yet |
| C. Notifications | the same message applied twice, out-of-order notifications, writes without re-fetching, revoking on a message with no id, unhandled types, chargeback reviews treated as refunds, test notifications applied, messages never acknowledged and never applied |
| D. State interpretation | expiry from the wrong source, CANCELED and grace period treated as no access, hold and pause treated as access, EXPIRED still granting, line items ignored, the deprecated v1 resource, test purchases counted, prepaid treated as renewing, tokens used past the sixty-day window |
| E. Lifecycle events | RECOVERED with no re-grant, RESTARTED as a new token, DEFERRED with the old expiry, hard-coded grace and hold, scheduled cancellations and scheduled pauses treated as immediate, the deprecated type 8, churn that was really an unaccepted price rise |
| F. Upgrades and linked tokens | the old token still granting, DEFERRED replacements granted early, re-signups bound to the wrong token, expiry not re-read after proration, out-of-app resubscribes left unlinked, upgrades that drop the obfuscated account id, the prorated-charge mode used for a plan that is cheaper per unit of time |
| G. Refunds and voided purchases | REVOKED still granting, the void that the state read disagrees with, partial refunds handled as full, no voided-purchases sweep, refunds without revoke, cancel where revoke was meant, refunds of an order that is not the latest |
| H. Account binding and restore | unmappable notifications, raw account ids, findOne on a shared token, no queryPurchasesAsync on resume, suspended subscriptions not asked for, a different Google account |
| I. Testing and Console | test renewals minutes apart, test rows in production, approved but not published, the 12-tester rule, verified but nothing written, tester purchases refunded after three minutes |
| J. Ledger integrity | grants without an idempotency key, tokens kept after expiry, real data in the timeline, expiry in local time, rows keyed on the order id |
| K. The device and the Play Billing Library | an empty catalogue, calls made while disconnected, already-owned purchases nobody investigated, recoverable failures never retried, unrecoverable ones retried anyway, DEVELOPER_ERROR, stale product details, duplicate callbacks, overlapping queries, the base plan id used as the product id, purchases that never reached the server, failures reported as success, cancellations treated as errors, the product refused as unavailable at purchase time, restores that rely on the device for consumed purchases after Billing Library 8 |
billing-doctor rules lists them; billing-doctor rule B1 prints one in full.
Node 20 or later.
Or run it without installing: npx billing-doctor <command>.
| Command | What it does |
|---|---|
billing-doctor init | writes an empty timeline.json with the policy block filled from a few questions |
billing-doctor validate timeline.json | checks the file against the schema; warns when a token, user id or email looks real |
billing-doctor diagnose timeline.json | runs every rule; --json for machines, --rules B1,C3 to run some, --kit <path> for the runbook |
billing-doctor state sub.json | explains a purchases.subscriptionsv2 resource in plain words; --policy timeline.json says where your policy disagrees with Google |
billing-doctor rtdn message.json | decodes a Pub/Sub push body: the type name for the integer, the token, and the next step |
billing-doctor redact < logs.txt | replaces purchase tokens with stable tok_ pseudonyms, removes emails, masks order ids, cuts out private keys and bearer tokens |
billing-doctor rules and billing-doctor rule <id> | the catalogue, and one rule with Google's quote and the runbook entry when the kit is present |
billing-doctor mcp | serves the same as six MCP tools over stdio |
Exit codes: 0 nothing to report, 1 a high finding (or an input that could not be decoded), 2 a usage or file error.
docs/timeline-format.md is the contract. Six event kinds: app (what the device reported), api (a call to the Play Developer API and its answer), ledger (what the backend wrote), rtdn (a notification as received), support (what the user said), console (releases and config changes). A policy block says what your backend is supposed to do, so a rule can tell your policy from a bug.
The fixtures/ folder holds one minimal timeline per rule, three realistic weeks, and five correct lifecycles that must produce nothing. They are the test suite and the best way to learn the format: fixtures/README.md.
The same engine is an MCP server over stdio, so Claude Code, Codex, Gemini CLI or Cursor can call it while you fix the bug. Tools: diagnose_timeline, explain_subscription_state, decode_rtdn, redact_text, list_rules, get_rule.
Configure it as command npx, args ["-y", "billing-doctor", "mcp"]. For Claude Code, this repository is also a plugin (claude --plugin-dir . from a checkout, with the skill /billing-doctor:diagnose); for Gemini CLI, gemini extensions install https://github.com/lazytitan30/billing-doctor.
No reviews yet — be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/billing-doctor)<a href="https://allmcps.com/mcp/billing-doctor"><img src="https://allmcps.com/api/badge/billing-doctor?style=directory" alt="Billing Doctor on AllMCPs" /></a>