Pay-Per-Event Apify Actor Starter Kit
A small, working Node.js template for a paid Apify Actor that charges users only for results they actually got. Copy it, swap in your own logic, set one event price, publish.
$9 one-time · MIT licence · instant download (zip, about 9 KB)Buy for $9 →See Actors built on this patternBy Siftwright · checkout by Polar · the same charging pattern runs in our 9 live Apify Store Actors
What it is
The example Actor takes a list of URLs and returns each page's title and meta description. Every page that loads is one charged result event. Invalid URLs, timeouts and HTTP errors are still written to the dataset so the user can see what went wrong, but they are not charged. Replace the fetch and the parser with your own work and keep the rule: charge after success, never before.
What's inside
.actor/
actor.json metadata; links input, dataset and output schemas
input_schema.json Console input form (urls, maxResults, timeoutSecs)
dataset_schema.json table view for the results
output_schema.json Output tab; Apify requires it before you can publish
src/
main.js run loop with charge-on-success logic
extract.js pure parsing helpers (swap in your own)
test/
extract.test.js unit tests (node --test)
Dockerfile apify/actor-node:22 base image
package.json apify ^3.7.2, Node 20+
LICENSE MIT
README.md setup, pricing steps and a publish checklist
The charging pattern
Actor.pushData(item, eventName) stores the row and charges the event in one call, so a row is never charged without being saved. maxResults caps charged rows, and the loop stops when the user's own max-cost-per-run is reached.
const CHARGE_EVENT = 'result';
// success: save the row AND charge one event
const r = await Actor.pushData(item, CHARGE_EVENT);
if (r?.eventChargeLimitReached) break; // user's max cost per run reached
// failure: save the row, no charge
await Actor.pushData({ ...base, status: 'failed', error });
Real output
A local run of the unmodified template (Node 22, apify 3.7.2) on 16 November 2026 with 4 inputs. The 2 pages that loaded are the rows that would be charged on the Apify platform; the 404 and the invalid URL are saved but free. Nothing is billed in a local run. The 3 bundled unit tests pass.
$ node src/main.js
INFO Done. 2 successful (charged) result(s) out of 4 URL(s).
| url | status | httpStatus | title | error |
|---|---|---|---|---|
| https://example.com | ok | 200 | Example Domain | – |
| https://www.iana.org/help/example-domains | ok | 200 | Example Domains | – |
| https://example.com/this-page-does-not-exist-404 | failed | 404 | – | HTTP 404 |
| not-a-url | failed | – | – | Invalid URL |
From zip to Store listing
- Unzip,
npm install,npm test, thenapify run -i '{"urls":["https://example.com"]}'(needs the freeapify-cli). apify pushto build it on Apify.- Console → your Actor → Publication → Monetization → Pay per event: add an event named exactly
resultand set its price. - Rename it, rewrite the README for your users, run the included checklist, publish.
Good to know
| Price | $9 one-time, paid through Polar; no subscription |
|---|---|
| Licence | MIT: personal or commercial Actors, attribution appreciated but not required |
| Needs | Node 20+, a free Apify account; the kit ships as JavaScript (no TypeScript, no browser crawler) |
| Not included | Support for your own scraping logic, proxies or Store marketing; it is a template, not a service |
Why pay-per-result pricing: pay-per-result vs subscription API pricing on the Siftwright blog.