Documentation

How to set up Relay and receive your payment provider events on your own servers.

What Relay does

Paystack and Flutterwave each let you set one webhook URL. Relay gives you a URL to put there, then passes every event it receives on to your own servers. The same URL works for both.

Paystack or Flutterwave → your Relay URL → your servers (up to 15)

  • Each event is saved, so you can look it up later.
  • It is sent on exactly as Paystack or Flutterwave sent it, with their signature.
  • If one of your servers doesn't accept it, Relay can try again.
  • Free for 14 days, then one of three paid plans.

Quick start

You need a Paystack or Flutterwave account and a server with a public address that can receive webhooks.

  1. Create a Relay account with your name, email and a password of at least 8 characters, including a letter and a number.
  2. Open Destinations, enter the address of your server and press Add.
  3. Open Overview and copy your Webhook URL.
  4. Paste the URL into your provider and save. In Paystack, go to Settings → API Keys & Webhooks. In Flutterwave, go to Settings → Webhooks, paste it into the URL field and set a secret hash. You can use both providers with the same URL.
  5. Make a test payment, then check Events in Relay.

Your webhook URL

Every account has its own URL. It ends in a long random code, which is how Relay knows the event is yours. You can find it on Overview and Settings.

Keep it private

Anyone who has this URL can send events to it. Don't put it in public code, screenshots or support chats.

Test and live mode

Paystack has separate webhook URL fields for test and live mode, and Flutterwave keeps its webhook settings separately for test and live too. Relay gives you one URL, and sends whatever arrives on it to all your active destinations. If you put it in both fields, test and live events reach the same servers. Check data.domain in each event (test or live) before acting on it.

Replacing a leaked URL

  1. Go to Settings and press Get a new URL.
  2. Confirm. The old URL stops working immediately.
  3. Paste the new URL into Paystack and Flutterwave and save, or you will miss events.

Test your setup

If your own server isn't ready, get a temporary address from webhook.site and add it as a destination. It shows you exactly what Relay sends. Use it with test data only, because anyone with the link can read what it receives.

  1. Switch your payment provider to test mode.
  2. Check your Relay URL is saved in the test webhook URL field.
  3. Create a payment page, open it and pay using a test option on the checkout.
  4. In Relay, open Events and press Refresh. Click the event to see whether it was delivered.

Saving the URL in your payment provider doesn't send anything by itself. Your payment provider only sends an event when something happens, such as a payment.

Destinations

A destination is an address on your server that Relay sends events to.

  • How many you can have depends on your plan: 2 during the trial. Paused ones count too.
  • It must start with https:// or http:// and be reachable from the internet. Use https://: plain http:// is not encrypted.
  • localhost and private network addresses are blocked. To test on your own computer, use a tunnelling tool that gives you a public address.
  • Use the final address. Relay does not follow redirects.
  • You can give each one a name, such as "Orders", and search by it.
ControlWhat it does
PauseStops sending to this destination and cancels its waiting retries.
ResumeSends new events again. Events that arrived while paused are not sent.
Auto retryTurns retrying on or off for this destination. It is on by default, and comes with Pro, Business and the free trial.
CopyCopies the address.
Bin iconRemoves the destination after you confirm. Its delivery history is kept.

Choosing what each destination gets

Routing rules are part of the Business plan. On Starter and Pro, every destination receives every event.

On Business, a destination receives every event unless you give it rules. Press Rules on its row. An event is sent to it if it matches any one rule.

A rule names an event, such as charge.success (Paystack), charge.completed (Flutterwave) or transfer.*, and can add one condition on the event's data:

To separate byConditionExample
Your own payment referencesReference starts withTKT-
A label you set when starting a paymentMetadata field isservice = store
Bank transfers into dedicated accountsPayment channel isdedicated_nuban
Subscription productsPlan name starts withPro
  • Some events, such as identity checks, have no reference or label. Use a rule without a condition, and let each server ignore what isn't its own.
  • Select Also catch events no destination accepts on one destination, so nothing goes unnoticed.
  • The editor shows how many of your recent events the rules match. Check before saving.
  • Rules apply to new events. Retries already waiting still go ahead.
  • Rules only choose where an event goes. Its body and signature are unchanged.

Paystack's transfer approval URL is different

If you use transfer or inbound-transfer approval, Paystack waits for your server to accept or reject there. Keep that setting pointed at your own server, not at Relay.

What your server must do

Relay sends each event as a POST request with a JSON body. To count as delivered, your server must reply with a 2xx status within 10 seconds.

HeaderMeaning
x-paystack-signaturePaystack's signature, passed on unchanged.
paystack-signaturePaystack's newer signature, passed on when Paystack sends it.
verif-hashFlutterwave's secret hash, passed on unchanged.
flutterwave-signatureFlutterwave's newer signature, passed on when Flutterwave sends it.
x-relay-event-idThe same for every try and destination of one event.
x-relay-attempt1 for the first try, 2 for the first retry, and so on.

Always check the signature on your server

Relay passes events on but does not verify that they came from your payment provider. Your server must do that before giving value for a payment.

Example (Node.js with Express)

webhook.js
const crypto = require("crypto");
const express = require("express");
const app = express();

// express.raw keeps the body exactly as received, which the signature check needs.
app.post("/webhooks/paystack", express.raw({ type: "application/json" }), async (req, res) => {
  const expected = crypto
    .createHmac("sha512", process.env.PAYSTACK_SECRET_KEY)
    .update(req.body)
    .digest("hex");

  if (expected !== req.headers["x-paystack-signature"]) {
    return res.sendStatus(401);
  }

  const event = JSON.parse(req.body);

  // Your code: store the event, and ignore it if you've stored it before.
  await saveOnce(req.headers["x-relay-event-id"], event);

  // Reply quickly. Do slow work after this, not before.
  res.sendStatus(200);
});

Use the secret key for the same mode as the event: test key for test events, live key for live ones. If your account receives only paystack-signature, follow your payment provider's documentation for checking it.

Checking Flutterwave events

Flutterwave sends the secret hash you set in its dashboard in the verif-hash header. Compare it with your own copy of that hash and reject the request if they differ. Accounts that receive flutterwave-signature instead should follow Flutterwave's documentation for that header. Amounts in Flutterwave events are in the main currency unit (naira), not kobo.

flutterwave-webhook.js
app.post("/webhooks/flutterwave", express.raw({ type: "application/json" }), async (req, res) => {
  if (req.headers["verif-hash"] !== process.env.FLUTTERWAVE_SECRET_HASH) {
    return res.sendStatus(401);
  }

  const event = JSON.parse(req.body);

  // Your code: store the event, and ignore it if you've stored it before.
  await saveOnce(req.headers["x-relay-event-id"], event);

  res.sendStatus(200);
});

Expect repeats

The same event can arrive more than once, for example when your server handled it but replied too late. Record what you have processed, using x-relay-event-id or the payment provider reference, so you never give value twice.

If you restrict IP addresses

Requests come from Relay, not from your payment provider. A firewall that only allows your payment provider's addresses will block them, so rely on the signature check instead.

Retries

Automatic retries come with Pro, Business and the free trial.

With Auto retry on, a failed delivery is tried again on this schedule. Each wait counts from the previous try.

TryWhen
1As soon as the event arrives
21 minute later
35 minutes later
430 minutes later
52 hours later
66 hours later
712 hours later
824 hours later
  • Retrying stops as soon as one try succeeds. Retries can run up to a minute late.
  • Only the destination that failed is retried.
  • After the 8th try, about 45 hours after the first, Relay stops. There is no button to send an event again.
  • Pausing, removing or switching off Auto retry cancels waiting retries. Turning it back on does not bring them back.

Using the dashboard

Overview

Shows events received, payment volume, successful payments, and failures and disputes, with charts of when events arrive and what type they are. Choose 7, 30 or 90 days.

Until your first event arrives, the figures show zero and the lists are empty.

Events

  • Filter by date range or event type.
  • The Failures filter shows events about something going wrong, such as a failed transfer, a dispute or a Flutterwave charge that failed. It is not about delivery to your servers.
  • The Delivery column shows how each event reached your servers, judged by the latest try to each destination: Delivered, Partly delivered (some destinations failed), Retrying (a retry is still waiting), Failed (every destination rejected it) or Not sent (no active destination accepted it).
  • Events from Paystack and Flutterwave appear together. Amounts are shown in the same currency units for both.
  • Click a row to see the full event, each delivery try with its time and result, and when the next retry is due.
  • Press Refresh for new events. The page does not update by itself.
  • Export CSV downloads the time, type, amount and currency of events in the chosen range and type. Times in the file are in UTC.

Times on screen are shown in your own time zone.

Settings

Change your name, company, theme and password, copy or replace your webhook URL, and log out on this device or all devices.

Plans and billing

PlanDestinationsPrice per month
Starter2₦7,000
Pro10₦15,000
Business15₦30,000

Every plan includes the event log and delivery history.

What each plan includes

StarterProBusiness
Event log and delivery historyYesYesYes
Every event sent to every destinationYesYesYes
Automatic retriesNoYesYes
Routing rules and a fallback destinationNoNoYes
  • Starter and Pro send every event to every destination. Choosing which events go where is a Business feature.
  • The free trial includes automatic retries, but not routing rules.
  • If a plan ends or you move down, your saved settings are kept but stop applying until you are back on a plan that includes them.
  • Need more? Ask for a custom plan on the Billing page or the pricing section of the home page, and we will put one together for you.

Free trial

  • A new account can use 2 destinations free for 14 days, counted from the day you register. No card is needed to start.
  • When the trial ends, your destinations are paused within an hour. Events are still received and saved, but not forwarded, and they are not sent later.
  • Before it ends, choose a plan, or point your payment provider back at your own server so you don't miss events.
  • Subscribing during the trial starts your paid month straight away.
  • Paying after it ends switches your destinations back on.

Subscribing

  1. Log in and open Billing.
  2. Choose Starter, Pro or Business.
  3. Pay by card on our secure payment page. You are brought back to Relay afterwards.
  4. Your new limit usually appears within a minute. Press Refresh if it hasn't.

Renewing, changing and cancelling

  • Paid plans renew every month until you cancel.
  • To change your card, use Change card on Billing. To stop renewals, use Cancel subscription and confirm. After cancelling, you keep the plan until the end of the period you paid for.
  • Moving to a bigger plan charges the new price straight away, with no credit for unused days. The old subscription is cancelled.
  • To move to a smaller plan, cancel, then choose the smaller one when the current plan ends.

When a plan ends

  • If a plan ends or a renewal fails, all your destinations are paused within an hour. Keep your card up to date.
  • Nothing is deleted. Events are still saved, but not forwarded.
  • When you pay, the destinations Relay paused are switched back on automatically, oldest first, as many as your plan allows. Ones you paused yourself stay paused.
  • Events received while paused are not sent afterwards.

Paid but not upgraded?

  • Press Refresh after a minute or two.
  • Check you paid while logged in to the account you are looking at: the plan is matched to that account's email address.
  • Don't pay again. Keep your payment reference so the payment can be traced.

Troubleshooting

No events appear

  • Check the URL in your payment provider matches the one in Relay, and that you saved it.
  • Check you saved it for the mode you are testing in (test or live).
  • Make a payment: your payment provider sends nothing until something happens.
  • Press Refresh and choose a longer date range.

A delivery failed

MessageWhat to do
Responded with 401 or 403Your server refused it. Check the signature code, your secret key and any firewall.
Responded with 404The path is wrong. Remove the destination and add the correct address.
Responded with 500Your code raised an error. Check your server's logs.
No response within 10 secondsReply first and do slow work afterwards.
Couldn't connectCheck the server is running, reachable from the internet, and its certificate is valid.
Redirected. Use the final URL as the destinationAdd the address you are redirected to, watching for http vs https and a trailing slash.
Private network addresses aren't allowedUse a public address.

The signature check fails

  • Check the body exactly as received, before turning it into JSON.
  • Use the secret key that matches test or live mode.

Your payment provider resent an event but it only shows once

If your payment provider sends an identical event again, Relay recognises it and does not save or forward it a second time.

Limits and your data

  • Events larger than 256 KB, or without an event name, are refused.
  • Relay stores the full content of each event, which can include your customers' details. The dashboard has no button to delete events.
  • Events that arrive before you add a destination are saved but not sent later.