Skip to content
Payment providers

Revenue attribution for custom billing with the Payments API

2 min read · Updated · By the Reveata team

Short answerIf your provider is not one Reveata connects to, or you bill customers yourself, post each payment to the Reveata Payments API with a website key. Include the visitor id, a user id or an email, and the payment is attributed like any connected provider's.

Reveata connects directly to Stripe, Polar and Dodo Payments. Everything else, from in-house invoicing to App Store purchases recorded on your server, goes through the Payments API.

What you get

The same reports as a connected provider: revenue, customers, conversion rate and revenue per visitor on every channel, source, campaign and page, plus the built-in goals billing:trial_started, billing:paid, billing:renewed and billing:refunded. The API sends payments, not subscriptions, so plan changes and cancellations are not produced (subscription goals).

How it works

  1. Create a website API key in Settings → Developer. Keys start with dt_site_ and only work for their website. Keep it on your server.
  2. When a payment succeeds in your system, post it:
bash
curl -X POST https://reveata.com/api/v1/payments \
  -H "Authorization: Bearer $REVEATA_SITE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"transactionId":"inv_1042","amount":49,"currency":"USD","email":"[email protected]","visitorId":"…"}'
  1. Send refunds the same way with type: "refund" and the originalTransactionId.

The fields that matter for attribution

Field Why it matters
visitorId, sessionId From window.reveata.visitorId() / sessionId() at checkout: the strongest match
userId The id you pass to identify
email Matches visitors you identified with the same email
subscriptionId Renewals of the same subscription inherit the first payment's attribution
type new (default), renewal, refund or trial

transactionId is required and idempotent: sending the same id again does nothing, so retries are safe. amount is in major units, without tax. Unknown fields are rejected, so typos fail loudly. The full schema is in the API reference.

When to use it, and when not

  • Use it for your own billing, a provider without an integration, or store purchases you verify on your server.
  • Do not use it for payments a connected provider already sends. Two routes for the same sale count it twice.
  • For checkouts you cannot change, a thank-you page call such as reveata('payment', { email }) can link a payment from the browser instead (thank-you page payments).

Frequently asked questions

What if I don't have the visitor id on my server?

Send the buyer's email, or the user id you identify signed-in users with. Reveata matches it against identified visitors, and retries unmatched payments every hour for 90 days.

Can I send amounts in another currency?

Yes. Use the three-letter ISO code. Reveata converts it to your website currency at the rate of the payment day.

Do Zapier or Make send payments?

No. Reveata's Zapier and Make apps watch payments and send goals, but have no payment action. Post to the Payments API from a server function, or any tool that can send an HTTP request with custom headers.

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?
IntegrationDodo Payments analytics with revenue by sourceReveata connects to Dodo Payments with an API key and a webhook you add in Dodo, imports payments, refunds, disputes and subscriptions, and credits each payment to a visit through reveata_visitor_id in the checkout or payment metadata.IntegrationPolar analytics with revenue attributionReveata imports Polar orders, refunds and subscriptions and receives new ones through a Polar webhook. Put the Reveata visitor id in the checkout metadata, which Polar copies onto orders and subscriptions, and each sale is credited to the visit that led to it.IntegrationStripe Checkout analytics and attributionAdd the Reveata visitor and session ids to the metadata of each Stripe Checkout Session your server creates. When Stripe reports the payment, Reveata reads the ids and credits the money to the exact visit that started the checkout.IntegrationStripe Elements and PaymentIntent analyticsWhen your server creates a Stripe PaymentIntent for Elements, the Payment Element or a mobile app, put reveata_visitor_id and reveata_session_id in its metadata. Reveata reads them when payment_intent.succeeded arrives and credits the payment to that visit.IntegrationStripe Payment Links analytics without codeThe Reveata script adds the visitor and session ids to every Stripe Payment Link, Buy Button and Pricing Table on your pages as a client_reference_id. Stripe stores it on the payment, and Reveata uses it to credit the sale to the visit, with no code to write.IntegrationStripe revenue analytics by traffic sourceReveata reads your Stripe payments, invoices, subscriptions, refunds and lost disputes through a read-only connection, then credits each payment to the visit that brought the buyer, so revenue sits next to traffic in every report.