Payment API
Track revenue from any payment provider using attribu.tech's server-side API.
If you use Stripe, Shopify, or WooCommerce, you don't need this. Payments from those providers are tracked automatically when you connect them in your dashboard settings. This API is for custom or unsupported payment providers.
Endpoint
POST https://attribu.tech/api/v1/payments
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"amount": 4900,
"currency": "usd",
"transaction_id": "txn_abc123",
"attribu_visitor_id": "av_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}Parameters
- amount (required) - Payment amount in the smallest currency unit (e.g. cents for USD).
4900= $49.00. - currency (required) - Three-letter ISO currency code.
"usd","eur","gbp", etc. - transaction_id (required) - Your unique identifier for this payment. Used for deduplication.
- attribu_visitor_id (required) - The visitor ID from the
attribu_visitor_idcookie.
How to use it
The flow has three steps:
- Capture the cookie during checkout. When the visitor starts the payment flow, read the
attribu_visitor_idcookie from the request and store it alongside the order in your database or pass it to your payment provider as metadata. - Store the visitor ID with the order. Save it in your orders table, or pass it through your payment provider's metadata/custom fields so it comes back when the payment succeeds.
- Send the payment to attribu.tech. When you receive a payment confirmation (webhook, callback, or polling), POST the payment data to the API with the stored visitor ID.
Example: Node.js
// When payment succeeds (e.g. in a webhook handler)
const res = await fetch("https://attribu.tech/api/v1/payments", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
amount: order.amount_cents,
currency: order.currency,
transaction_id: order.id,
attribu_visitor_id: order.attribu_visitor_id,
}),
});
if (!res.ok) {
console.error("attribu.tech payment tracking failed:", await res.text());
}Example: PHP
$response = Http::withToken(env('ATTRIBU_API_KEY'))
->post('https://attribu.tech/api/v1/payments', [
'amount' => $order->amount_cents,
'currency' => $order->currency,
'transaction_id' => $order->id,
'attribu_visitor_id' => $order->attribu_visitor_id,
]);API key
You need an API key to authenticate requests. Go to Settings > API in your attribu.tech dashboard to create one. Keep this key secret and never expose it in client-side code.
Deduplication
If you send the same transaction_id more than once, attribu.tech ignores the duplicate. This makes it safe to retry failed requests or send from both a webhook and a polling job without double-counting revenue.
What's next
- Revenue attribution overview - How attribution works end to end.
- Email-based attribution - Track payments using customer email when cookies aren't available.
- Connect Stripe - Automatic revenue tracking with no API calls.