postback-tester
GitHub

Postback lab: a recorded run and a signer

postback-tester sends signed test postbacks to a reward endpoint and checks what a single test postback cannot show: the retry that credits again, the reversal that is ignored, the forged request that is accepted. When this page was built, the example server of the repository ran once with a correct handler and once with a naive one, and the tool ran all 10 checks against each. The results below are the recorded ones.

Checks
10, each run on both handlers
Correct handler
10 of 10 passed, exit code 0
Naive handler
8 of 10 failed, exit code 1
Signer presets
moonetix and custom, 5 README examples
Run recorded
2026-11-16, version 1.1.0 on Node v22.23.4
Commit
f82a08d
race One new credit sent 5 times at once, as overlapping retries arrive. Open the check

Loading the recorded run

Recorded run

The same command ran against both handlers. Nothing here is typed in by hand: every status, time and balance is what the tool reported. Open a check to see what it guards against and the requests it sent.

Loading the recorded run

What a passing endpoint does

  1. Verify the signature first, with a constant-time comparison, before anything else runs.
  2. Store each transaction ID once, enforced by a unique key in the database, not by a lookup followed by an insert.
  3. On a reversal, take back what that transaction credited, once. Remember a reversal for an unknown transaction so a late credit is not paid.
  4. Answer 2xx for repeats. A 4xx or 5xx makes the network retry a postback you already processed.
  5. Answer only after the change is committed, and within a few seconds.

Both handlers are in examples/echo-server.js. The balance column works because the server exposes the balance of the test user, which is how the tool tells a duplicate credit from a correct one when both answer 200. Handlers in PHP, Node.js, Python and Java that pass every check: offerwall-postback-handlers.

Signer

Paste the postback URL you gave the network and a test key to get the signed request the tool would send, the exact string that was signed, and curl commands for a credit, its retry and its reversal. The page runs the same code as the command line tool, in this tab. Nothing is sent anywhere.

Preset

Use a key from staging. A live key does not belong in a web page, including this one.

Values

Other macro values

With the custom preset a value may use other macros, for example amount={reward}.

Options for the full test

The credit

Signed string
-
Signature
-
Signed URL
-

Send it with curl

Run the three in this order against staging, and read the balance of the test user after each.

1. Credit: expect 2xx, balance up by the reward
-
2. Duplicate, the same request again: expect 2xx, balance unchanged
-
3. Reversal: expect 2xx, the reward taken back
-
4. Forged request: expect a rejection
-

Or let the tool run all 10 checks

The same settings as a command. It needs Node.js 22 and nothing else.

In a terminal
-

Point it at staging, never at production: the checks credit and reverse real balances.

Run it

The commands below are the ones in the README. The exit code is 0 when every check passes and 1 when one fails, so the same line works in a terminal and in CI.

With the URL you saved on the Postback page
export MOONETIX_POSTBACK_KEY=...   # Postback page of your Moonetix dashboard
npx @moonetix/postback-tester --preset moonetix \
  'https://staging.example.com/postback?user={user_id}&tx={transaction_id}&event={event_id}&status={status}&reward={reward}&payout={payout}&hash={hash}'

The moonetix preset reproduces a Moonetix postback byte for byte: the documented macros, values encoded like PHP rawurlencode(), and {hash} as lowercase hex HMAC-SHA256 of transaction_id:user_id:reward:status.

Maintained by Moonetix, an affiliate network.