Reditus
Server-side delivery to Reditus, the affiliate and referral platform: a sign-up or demo of a referred visitor becomes a referral conversion, and a referred customer's payment is credited to the partner.
Reditus is a server destination in the walkerOS flow:
Sends one request per event to the Reditus API with the API token as Bearer token, using raw HTTP (no SDK): a conversion or a payment, chosen per rule.
Installation
npm install @walkeros/collector @walkeros/server-destination-reditus- Integrated
- Bundled
import { startFlow } from '@walkeros/collector';
import destinationReditus from '@walkeros/server-destination-reditus';
await startFlow({
destinations: {
reditus: {
code: destinationReditus,
config: {
settings: {
apiKey: process.env.REDITUS_API_KEY,
},
},
},
},
});
A complete flow.json with this destination:
{
"version": 4,
"flows": {
"default": {
"config": {
"platform": "server"
},
"destinations": {
"reditus": {
"package": "@walkeros/server-destination-reditus",
"config": {
"settings": {
"apiKey": "$secret.REDITUS_API_KEY"
}
}
}
}
}
}
}Configuration
This destination uses the standard destination config wrapper (consent, data, env, id, ...). For the shared fields see destination configuration. Package-specific fields live under config.settings and are listed below.
Settings
| Property | Type | Description | More |
|---|---|---|---|
apiKey | string | Reditus API token, sent as Bearer token | |
type | 'conversion' | 'payment' | Call made when the rule sets no type: conversion or payment. Default: conversion | |
url | string | Reditus API base URL |
Mapping
Per-event rules under config.mapping. For the standard rule fields (consent, condition, data, batch, name, policy) see mapping.
| Property | Type | Description | More |
|---|---|---|---|
type | 'conversion' | 'payment' | Reditus call for this rule: conversion (POST /v2/tracking/conversion) or payment (POST /v1/payments). Default: settings.type, else conversion |
Examples
Conversion by affiliate slug
A demo request with the affiliate slug kept from the landing URL is sent as a conversion.
{
"name": "form submit",
"data": {
"type": "demo",
"email": "jane@example.com",
"ref": "partner-x"
},
"context": {
"dev": [
"test",
1
]
},
"globals": {
"lang": "elb"
},
"custom": {
"completely": "random"
},
"user": {
"id": "us3r",
"device": "c00k13",
"session": "s3ss10n"
},
"nested": [
{
"entity": "child",
"data": {
"is": "subordinated"
}
}
],
"consent": {
"functional": true
},
"id": "ev-1700000901",
"trigger": "test",
"entity": "form",
"action": "submit",
"timestamp": 1700000901000,
"timing": 3.14,
"source": {
"count": 1,
"trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
"type": "collector",
"schema": "4"
}
}{
"data": {
"map": {
"email": "data.email",
"affiliate_slug": "data.ref"
}
}
}sendServer("https://api.getreditus.com/api/v2/tracking/conversion", "{\"affiliate_slug\":\"partner-x\",\"email\":\"jane@example.com\"}", {
"headers": {
"Authorization": "Bearer s3cr3t",
"Content-Type": "application/json"
}
})Payment
A first subscription payment of a referred customer is sent as a Reditus payment: the amount in cents as the event carries it, keyed by the payment processor's payment id.
{
"name": "subscription start",
"data": {
"customer": "cus_42",
"subscription": "sub_9",
"payment": "pay_7c1d",
"amount": 9900,
"currency": "EUR",
"interval": "year"
},
"context": {
"dev": [
"test",
1
]
},
"globals": {
"lang": "elb"
},
"custom": {
"completely": "random"
},
"user": {
"id": "us3r",
"device": "c00k13",
"session": "s3ss10n"
},
"nested": [
{
"entity": "child",
"data": {
"is": "subordinated"
}
}
],
"consent": {
"functional": true
},
"id": "ev-1700000902",
"trigger": "test",
"entity": "subscription",
"action": "start",
"timestamp": 1700000902000,
"timing": 3.14,
"source": {
"count": 1,
"trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
"type": "collector",
"schema": "4"
}
}{
"settings": {
"type": "payment"
},
"data": {
"map": {
"uid": "data.customer",
"idempotency_key": "data.payment",
"amount": "data.amount",
"currency": "data.currency",
"subscription_id": "data.subscription",
"interval": "data.interval",
"interval_count": {
"value": 1
}
}
}
}sendServer("https://api.getreditus.com/api/v1/payments", "{\"idempotency_key\":\"pay_7c1d\",\"amount\":9900,\"currency\":\"eur\",\"referral_uid\":\"cus_42\",\"subscription_id\":\"sub_9\",\"interval\":\"year\",\"interval_count\":1}", {
"headers": {
"Authorization": "Bearer s3cr3t",
"Content-Type": "application/json"
}
})Referred sign-up
A sign-up of a visitor who came through a partner link is sent as a conversion with the affiliate slug from the link, the gr_id from the Reditus cookie and your own customer id instead of the email.
{
"name": "user register",
"data": {
"id": "cus_42",
"affiliate": "john",
"gr_id": "gr_7f3a"
},
"context": {
"dev": [
"test",
1
]
},
"globals": {
"lang": "elb"
},
"custom": {
"completely": "random"
},
"user": {
"id": "us3r",
"device": "c00k13",
"session": "s3ss10n"
},
"nested": [
{
"entity": "child",
"data": {
"is": "subordinated"
}
}
],
"consent": {
"functional": true
},
"id": "ev-1700000900",
"trigger": "test",
"entity": "user",
"action": "register",
"timestamp": 1700000900000,
"timing": 3.14,
"source": {
"count": 1,
"trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
"type": "collector",
"schema": "4"
}
}{
"data": {
"map": {
"uid": "data.id",
"affiliate_slug": "data.affiliate",
"gr_id": "data.gr_id"
}
}
}sendServer("https://api.getreditus.com/api/v2/tracking/conversion", "{\"affiliate_slug\":\"john\",\"uid\":\"cus_42\",\"gr_id\":\"gr_7f3a\"}", {
"headers": {
"Authorization": "Bearer s3cr3t",
"Content-Type": "application/json"
}
})When it fails
- Demo request without uid or email: A demo request whose rule resolves neither a uid nor an email fails with missing-input, and nothing is sent. Reported as
failedwith codemissing-input. - Other 409: A conversion answered 409 without the body "Referral already exists" fails with transport, not retryable, and the event goes to the dead-letter queue. Reported as
failedwith codetransport. - Payment amount not in minor units: Reditus takes the amount as an integer in minor units (cents): an amount such as 99.9 fails with missing-input instead of being rounded or converted. Reported as
failedwith codemissing-input. - Payment answered 404 by something else: A payment answered 404 without the body "Referral not found", for example from a url without /api, fails with transport, not retryable, and the event goes to the dead-letter queue. Reported as
failedwith codetransport. - Payment refused: Reditus answers 400 to a payment with a validation error, for a rejected or expired referral, or for a terminated partnership: the payment fails with transport, not retryable, and the event goes to the dead-letter queue. Reported as
failedwith codetransport. - Payment without currency: Reditus needs the currency of a payment and has no default: a payment without one fails with missing-input, and nothing is sent. Reported as
failedwith codemissing-input. - Payment without uid or email: Reditus needs a uid or an email to find the referral of a payment: a payment whose rule resolves neither fails with missing-input, and nothing is sent. Reported as
failedwith codemissing-input. - Payment without idempotency_key: Reditus needs an idempotency_key for every payment, to never credit it twice and to match a refund later: a payment without one fails with missing-input. Map your payment processor's payment id. Reported as
failedwith codemissing-input. - Sign-up without uid or email: Reditus needs a uid or an email for a conversion: a sign-up whose rule resolves neither fails with missing-input, and nothing is sent. Reported as
failedwith codemissing-input. - Conversion without a slug: Reditus needs the partner's affiliate_slug or advocate_slug for a conversion: a sign-up with only the gr_id cookie fails with missing-input, and nothing is sent. Reported as
failedwith codemissing-input.
Calls
Each rule picks its call with settings.type; without it, settings.type of the destination applies, else conversion.
| Type | Reditus call | Mapped data |
|---|---|---|
conversion | POST /v2/tracking/conversion | uid or email, affiliate_slug (the partner's slug from the link: ?red=john gives john) or advocate_slug, optional gr_id (the Reditus script's cookie, which matches the exact click) |
payment | POST /v1/payments | uid or email (sent as referral_uid, referral_email), idempotency_key, amount as an integer in minor units (cents: 99.00 EUR is 9900), currency (lowercased), optional subscription_id, interval (month or year), interval_count |
An event without what its call needs fails with missing-input, and nothing is sent. Without apiKey, or with a type other than conversion or payment, the destination does not start, and every push fails with config.
Map idempotency_key to your payment processor's payment id: Reditus uses it to never credit a payment twice, and a refund in Reditus names the payment by it. If your event carries a decimal price, convert it to minor units in the mapping, for example with fn.
"mapping": {
"user": { "register": { "data": { "map": {
"uid": "data.id",
"affiliate_slug": "globals.red",
"gr_id": "globals.gr_id"
} } } },
"subscription": { "start": {
"settings": { "type": "payment" },
"data": { "map": {
"uid": "data.customer",
"idempotency_key": "data.payment",
"amount": "data.amount",
"currency": "data.currency",
"subscription_id": "data.id"
} }
} },
"*": { "*": { "ignore": true } }
}The gr_id cookie and the affiliate slug from the landing URL live in the browser: carry them to the server event (as globals, or from your app) so the conversion can be attributed. A visitor who came without a Reditus link has no slug: filter such events with a mapping condition instead of letting them fail.
Personal data
A conversion sends email, and a payment referral_email, to Reditus in clear, together with uid and the gr_id cookie value. Reditus matches them as sent and takes no hashed values. To keep emails away from Reditus, map only uid, your own customer or account id, as the snippet above does, and use Reditus's UID tracking (see the Reditus API guide).
Rate limit
Reditus allows 100 requests every 5 minutes across its API, and each event is one request. The destination does not slow down or hold back requests: a request over the limit fails with the status Reditus answers. Map only the events Reditus needs (the catch-all ignore above keeps the rest out), and send payments only for referred customers where you know them.
Answers that count as delivered
Some Reditus answers outside 2xx mean that nothing needs to be sent. The destination tells them apart by the body Reditus documents for them, so the same status with another body, for example from a wrong url, fails:
409"Referral already exists" to a conversion: the referral is there already.400"idempotency_key has already been taken" to a payment: Reditus has this payment already, for example after a resend from the dead-letter queue.404"Referral not found" to a payment: Reditus has no referral for this customer and ignores the payment. With the logger atWARNor lower, the log reports these payments, because auidoremailmapped from the wrong field gets the same answer.
Consent
The quickstart sets no config.consent, so Reditus receives every event, whatever consent the event carries. To send only events with consent, add consent: { marketing: true } to config, next to settings. An event without that consent is skipped or queued, depending on the collector's consentDenied. Server flows built by the CLI skip it and count it in skipped. With startFlow it waits in the destination's queue by default: a later event that carries consent does not release it, and only a walker consent command does, which then sends the waiting events of every user at once. Pass consentDenied: 'skip' to startFlow to skip such events instead (see Gate a destination with consent and consent-denied events on a server).