Install
Use another billing system
For developers: connect the Custom billing API, sign requests with your signing secret, and send payments, refunds and disputes from any billing system.
How it works
This guide is for developers whose billing isn’t Stripe: Paddle, Chargebee, Lemon Squeezy, your own billing code, or anything else. Your server sends each payment, refund and dispute to an EzyPromote endpoint, signed with a secret. EzyPromote turns payments into commissions, reverses them on refunds and holds them on disputes.
EzyPromote doesn’t call your billing system. Your server is the source of truth, so send every event that matters.
Connect the Custom billing API
Test and live are separate connections. Each one has its own endpoint and signing secret. Connect test mode first.
- In Setup, go to step 3, Connect payments, and choose Not on Stripe? Use another billing system. You can also open Settings → Tracking and payments, choose Add payment connection, then Custom billing API.
- Choose Connect test mode.
- Copy the Endpoint and the Signing secret. The signing secret starts with
ep_whsec_and is shown only once. - Store the secret on your server, for example as an environment variable, and choose Done.
- Later, choose Connect live mode under Live mode in the same step, and store that secret too.
The endpoint looks like https://api.ezypromote.com/api/v1/webhooks/custom/CONNECTION_ID. Copy yours from the app: the connection card in Settings → Tracking and payments shows it again under “Send your events to this address”. The secret is never shown again. If you lose it, choose Disconnect on the card and connect again, which gives you a new endpoint and a new secret.
Sign each request
Every request needs an EzyPromote-Signature header:
EzyPromote-Signature: t=UNIX_SECONDS,v1=HEX_SIGNATURE
tis the current time in Unix seconds.v1is the hex-encoded HMAC-SHA256 of the stringt + "." + raw body, keyed with your signing secret.- EzyPromote refuses a signature whose
tis more than 5 minutes from its clock, so sign each request when you send it. - Sign the exact bytes you send. Serialise the JSON once, sign that string, and send that string.
- Send
Content-Type: application/json.
Node.js
import crypto from 'node:crypto'
async function sendToEzyPromote(event) {
const body = JSON.stringify(event)
const t = Math.floor(Date.now() / 1000)
const v1 = crypto
.createHmac('sha256', process.env.EZYPROMOTE_SIGNING_SECRET)
.update(`${t}.${body}`)
.digest('hex')
return fetch(process.env.EZYPROMOTE_BILLING_ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'EzyPromote-Signature': `t=${t},v1=${v1}`,
},
body,
})
}
Python
import hashlib, hmac, json, os, time
import requests
def send_to_ezypromote(event):
body = json.dumps(event, separators=(",", ":"))
t = int(time.time())
v1 = hmac.new(
os.environ["EZYPROMOTE_SIGNING_SECRET"].encode(),
f"{t}.{body}".encode(),
hashlib.sha256,
).hexdigest()
return requests.post(
os.environ["EZYPROMOTE_BILLING_ENDPOINT"],
data=body,
headers={
"Content-Type": "application/json",
"EzyPromote-Signature": f"t={t},v1={v1}",
},
)
EZYPROMOTE_SIGNING_SECRET and EZYPROMOTE_BILLING_ENDPOINT are names for your own environment: use any names you like.
The request body
Every request is one event in this envelope:
{
"id": "evt_123",
"type": "transaction.paid",
"created": 1767225600,
"livemode": false,
"data": {
"transaction_id": "txn_123",
"kind": "subscription_initial",
"currency": "USD",
"amount_paid": 7900,
"amount_tax": 0,
"paid_at": 1767225600,
"user_id": "user_42"
}
}
| Field | Type | Meaning |
|---|---|---|
id |
string | Your unique ID for this event. It is the idempotency key. |
type |
string | transaction.paid, transaction.refunded, dispute.updated, customer.linked or subscription.canceled |
created |
integer | When the event happened, in Unix seconds |
livemode |
boolean | false for your test connection, true for your live connection |
data |
object | The event’s fields, below |
Rules for every field:
- Amounts are integers in minor units, such as cents:
7900is 79.00. - Times are Unix seconds.
- Numbers must be JSON numbers. A numeric string such as
"7900"is refused. - Text IDs are 1 to 255 characters.
Event types
transaction.paid
Send one for every successful charge, including each renewal.
| Field | Required | Meaning |
|---|---|---|
transaction_id |
yes | Your ID for this payment. Refunds and disputes refer to it. |
kind |
yes | subscription_initial, subscription_renewal, subscription_change or one_time |
currency |
yes | ISO 4217 code, such as USD |
amount_paid |
yes | What the customer paid, tax included |
paid_at |
yes | When it was paid |
amount_tax |
no | Tax in amount_paid. Commissions leave it out. It can’t be more than amount_paid. |
amount_discount |
no | Discount given |
amount_fee |
no | The processing fee you paid. Campaigns that pay after fees use it. It can’t be more than amount_paid. |
user_id |
no | Your user ID, the externalUserId you sent when binding the signup |
customer_id |
no | Your billing system’s customer ID |
email |
no | The customer’s email |
referral_hint |
no | The visitor’s ep_click value, up to 2,048 characters |
discount_codes |
no | Coupon codes used, up to 100 |
deal |
no | A commission rate slug of the paying campaign, like ep_deal for Stripe |
product |
no | A product slug, like ep_product for Stripe |
product_ids |
no | Your product IDs, up to 100 |
price_ids |
no | Your price IDs, up to 100 |
billing_interval |
no | Such as month or year |
payment_fingerprint |
no | A stable ID of the card, for the shared-card fraud rule |
fx_rate_to_program_currency |
no | One unit of currency in your program’s currency. Needed only when the currencies differ. Above 0, at most 1,000,000. |
transaction.refunded
| Field | Meaning |
|---|---|
transaction_id |
The refunded payment |
amount_refunded_total |
The total refunded so far, not this refund alone |
refunded_at |
When |
Because the amount is a running total, sending the same refund twice changes nothing.
dispute.updated
| Field | Meaning |
|---|---|
dispute_id |
Your ID for the dispute |
transaction_id |
The disputed payment |
amount |
The disputed amount |
status |
open, won or lost |
updated_at |
When the dispute last changed in your system |
reason |
Optional |
An open dispute holds the commission. Won releases it. Lost voids it, or claws it back if it was already paid. Send the dispute’s current state each time it changes. EzyPromote orders updates by updated_at, not by arrival, so an older update than the one already applied changes nothing.
customer.linked
Links your billing customer to a user or a click before any payment, so later payments that only carry customer_id find the affiliate. Fields: customer_id (required), user_id, email, referral_hint.
subscription.canceled
Fields: customer_id and canceled_at. EzyPromote records the cancellation on the customer’s referral timeline.
How a payment finds its affiliate
EzyPromote looks for, in any combination:
user_id: a user your server bound at signup. See Track clicks and signups on your server.customer_id: a customer already linked bycustomer.linkedor an earlier payment.referral_hint: the visitor’sep_clickvalue. The website tag adds anep_clickfield to signup forms (forms withdata-ep-signup, or any form with an email field), or your server reads it withcheckoutClickTokenfrom@ezypromote/node/referrals.discount_codes: an affiliate’s coupon code. Create each code in your billing system, then add it in EzyPromote, so redemptions credit the affiliate.
A payment for a user your server hasn’t bound yet waits up to 72 hours for the binding. A refund or dispute that arrives before its payment waits for it.
livemode
livemode must match the connection: false on your test connection, true on your live connection. A mismatch is refused with a 400. Test events never create live commissions.
Idempotency
The envelope’s id is the idempotency key. Sending the same id again is safe: EzyPromote stores the event once and answers duplicate: true. Use an ID that is the same on every retry, such as your own event ID, and never reuse one for a different event.
Responses
A stored event answers 200:
{ "data": { "received": true, "duplicate": false } }
EzyPromote processes the event after answering, so 200 means received, not credited. What happened to it (credited, unattributed, waiting for its payment, failed) shows under Billing events in Settings → Developers.
Errors answer { "errors": [{ "code": "…", "message": "…", "field": "…" }] }:
| Status | Code | Why | Retry? |
|---|---|---|---|
| 400 | E_INVALID_WEBHOOK |
The signature is missing, wrong or more than 5 minutes old; the body isn’t JSON; amount_tax or amount_fee is more than amount_paid; or livemode doesn’t match the connection |
No. Fix the request first. |
| 404 | E_WEBHOOK_NOT_FOUND |
No connection has this endpoint, or it was disconnected | No. Check the endpoint. |
| 422 | E_VALIDATION_ERROR |
A field is missing, out of range or the wrong type. field names it, such as data.amount_paid. |
No. Fix the field. |
| 429 | Too many refused requests from your network to this endpoint: over 60 in 10 minutes blocks it for 15 minutes. Signed events never count. | Yes, after the wait. | |
| 5xx | EzyPromote couldn’t store the event | Yes |
Retries
EzyPromote doesn’t retry for you: your server does. Retry network errors, 429 and 5xx with increasing waits. Keep the same id and body, and sign again with a new t on each attempt, because a signature older than 5 minutes is refused.
Test it
- Connect the Custom billing API in test mode.
- Open your test link (
https://yourstore.com/?via=test) and sign up, so your server gets a testep_clickvalue or binds a test user. - Send
transaction.paidwithlivemode: falseand thatreferral_hintoruser_id. - Check Billing events in Settings → Developers, and the test purchase checks in setup step 4.
What this connection can’t do
Compared with Stripe, EzyPromote can’t look anything up in your billing system:
- No daily reconciliation. Missed events aren’t found automatically: check Billing events.
- No product catalogue. A product shows up to pick once a payment names it.
- No existing-customer history. Only customers EzyPromote has seen pay before count as existing.
- No card-network fraud warnings. The other fraud rules still run.
Next: Test a purchase and go live.