Amplitude server-side events

Send verified subscription events from SubHero to an Amplitude project in the US or EU region.

Create an Amplitude project and obtain its HTTP API key. Select region: "eu" for an EU-resident project; otherwise requests use the US endpoint. The project region is an explicit setting and is never inferred from the subscriber's country.

An admin configures PUT /console/projects/{projectId}/integrations/amplitude:

json code
{
  "enabled": true,
  "forwardSandbox": false,
  "revenueMode": "gross",
  "region": "us",
  "credentials": { "api_key": "YOUR_PROJECT_API_KEY" }
}

All taxonomy event names are forwarded verbatim, including INITIAL_PURCHASE, TRIAL_STARTED, TRIAL_CONVERTED, RENEWAL, PRODUCT_CHANGE, CANCELLATION, UNCANCELLATION, BILLING_ISSUE, EXPIRATION, REFUND, family-access events, ONE_TIME_PURCHASE, PAUSED, and RESUMED. user_id is the partner's app user id; an event without one is explicitly skipped as no_user. insert_id is the stable SubHero event id and survives retries, allowing Amplitude's deduplication window to suppress duplicate delivery.

Requests contain up to 100 events. A full batch is runnable immediately; a smaller batch flushes once its oldest event has waited 30 seconds. A persistent outbox survives worker restarts. The worker polls each second, and separate destination queues keep another vendor's failures from blocking Amplitude.

Revenue events include revenue, price, quantity: 1, productId for revenue charts, and revenueType equal to the taxonomy event type. Refund revenue remains negative. Money is held as decimal text/bigint internally and converted to a JSON number only while constructing the vendor request, because Amplitude requires numeric JSON revenue fields. This boundary inherits the precision limits of Amplitude's numeric contract; all calculations remain exact upstream. Lifecycle events carry no revenue fields. proceeds mode requires an available proceeds estimate.

Short partner user ids are supported with the HTTP API's options.min_id_length: 1. Each successful batch must return an acknowledgement for its full event count; incomplete or malformed acknowledgements are retried with the same insert ids. Sandbox forwarding is disabled by default.

Use GET /console/projects/{projectId}/integrations and GET /console/projects/{projectId}/integrations/amplitude/deliveries to inspect configuration and safe delivery logs. Credentials are encrypted, write-only, and omitted from those responses. HTTP response bodies and request URLs/credentials are never logged. Failures retry after 1 minute, 10 minutes, 1 hour and 6 hours, then raise a dead-delivery alert.

Live verification requires owner credentials: enable sandbox on staging, run a purchase/renewal/cancel cycle, and inspect the user's Amplitude timeline and revenue. Automated tests do not claim vendor-dashboard verification or screenshots.

Sources: Amplitude HTTP V2 API and HTTP quickstart and regional endpoints. Amplitude plan-specific throughput limits still apply; the 100-event batch cap stays below the API's request-size/event-count ceilings.

Disabling pauses pending work and lease recovery. Re-enabling resumes those same deliveries; events created while disabled are not backfilled. Already running requests can finish. Event-time subscriber snapshots are immutable. Deleting the integration deletes its delivery history.

Missing gross prices are skipped_missing_price; missing estimates in proceeds mode are skipped_missing_proceeds. Invalid local payloads (invalid_payload) or unreadable credentials (invalid_config) immediately become dead and raise an alert. Single-event 400/413/422 responses are permanent; 401/403, 429, server errors and network failures use the retry schedule so corrected settings can recover. Logs store only fixed outcome codes and status numbers, never raw exception messages, request URLs or vendor bodies.

A rejected 400/413 or locally oversized batch is immediately retried one event at a time. Only individual results count toward event attempts, so one malformed event cannot dead-letter valid neighbors. Rate-limited batches keep their normal backoff.