Generic Payment API revenue tracking
Send normalized revenue events to AttribIQ when you use a custom checkout or a payment provider that is not connected natively yet.
Quick answer
The generic Payment API is for teams that do not use Stripe or need custom revenue ingestion. Send stable transaction IDs, event types, amounts, currency, timestamps, and AttribIQ visitor or session identifiers so revenue can be attributed.
On this page
What you’ll learn
- Understand when to use the generic Payment API
- Send idempotent revenue events
- Choose supported event types for purchases, renewals, refunds, and churn
- Connect custom payments to AttribIQ visitor and session data
The generic Payment API lets any backend send revenue events into AttribIQ.
Use it when you do not use Stripe, when your payment provider is not supported yet, or when your billing system already normalizes payment activity internally.
Event shape
The event should describe what happened, when it happened, how much money changed, and which AttribIQ visitor or session should receive attribution context.
POST /v1/revenue
Authorization: Bearer sk_project_...
Idempotency-Key: txn_123
Content-Type: application/json
{
"provider": "custom",
"transaction_id": "txn_123",
"event_type": "purchase",
"amount": 2900,
"currency": "EUR",
"occurred_at": "2026-05-20T10:30:00Z",
"visitor_id": "v_abc",
"session_id": "s_def",
"customer_id_hash": "hash_123",
"metadata": {
"plan": "builder",
"product": "monthly_subscription"
}
}
Amounts should be sent in minor units. For EUR and USD, 2900 means 29.00.
Supported event types
Start with a small vocabulary:
purchasesubscription_startedrenewalupgradedowngraderefundcancellationchurn
Keep event names stable. If every integration invents new names, the dashboard becomes hard to compare.
Idempotency
Payment systems retry. Your backend may retry too. AttribIQ should receive a stable transaction ID and an idempotency key so duplicate submissions do not create duplicate revenue.
Good transaction IDs are provider object IDs, invoice IDs, charge IDs, or your own durable billing event IDs.
Avoid generated random IDs for every retry. They defeat idempotency.
Attribution identifiers
The browser tracker exposes an attribution object. Your app should pass it to your backend when a checkout, upgrade, or purchase begins.
At minimum, send:
visitor_idsession_idcustomer_id_hashwhen an authenticated customer exists
The customer hash should be a stable one-way identifier, not raw email. That keeps reporting useful without turning analytics into a customer database.
Processing rules
A robust receiver should:
- Validate the project API key.
- Validate the event type, amount, currency, and timestamp.
- Enforce idempotency with provider plus transaction ID.
- Store accepted events for debugging.
- Write normalized revenue events into analytics storage.
- Join the event to prior visitor and session data.
If attribution fields are missing, accept the revenue as unattributed. Totals must stay correct even when attribution is incomplete.
Next steps
Read what revenue attribution is for the model, or use Stripe revenue attribution if Stripe is your payment provider.
Frequently asked questions
- When should I use the generic Payment API?
- Use it when your payment provider is not connected natively, when you run custom billing, or when you want to send normalized revenue events from your own backend.
- What is the most important field?
- transaction_id is critical for idempotency. It lets AttribIQ reject duplicates when the same payment event is retried.
- Can I send negative amounts for refunds?
- Prefer a refund event type with the refunded amount as a positive integer in minor units. The reporting layer can subtract it consistently.
- Do I need both visitor_id and session_id?
- Send both when you have them. Visitor ID helps connect long journeys. Session ID helps connect the payment to the active checkout session.
Continue learning
How to track Stripe revenue by source and campaign
Connect Stripe Checkout, subscriptions, invoices, refunds, and webhooks to source, campaign, landing page, and session reports.
Read guide Stripe & PaymentsWhat is a Stripe webhook?
A Stripe webhook is an HTTP notification Stripe sends to your backend when payments, subscriptions, invoices, refunds, and customer events happen.
Read guide Stripe & PaymentsWhat is checkout attribution?
Checkout attribution connects the visit, campaign, landing page, and session before checkout to the payment event that happens after checkout.
Read guide Stripe & PaymentsHow to connect Stripe Checkout to Google Analytics 4
Connect Stripe Checkout to GA4 using client IDs, verified payment webhooks and Measurement Protocol. Handle purchases, renewals, refunds and duplicates.
Read guidePut it into practice
See traffic and revenue in the same dashboard
Explore traffic sources, campaigns, goals and matched payments in the demo, then connect your own site.