Mantissa Hooksnode is a Mantissa product A Mantissa product mantissatech.xyz

Flutterwave redirect_url vs webhook: which one should give value?

Author:
hooksnode
Published:
Updated:
  • flutterwave
  • webhooks

The customer paid, the browser never came back, and the order is still unpaid. The redirect URL, the verify call, and the webhook are three different things. Only one of them should be the path that gives value.

The redirect also carries a status query parameter. That value came back through the browser. Do not give value from it.

The Flutterwave facts below come from Checkout, Transaction Verification, and Webhooks, as published on 2026-11-20. Each page is marked Last updated 13 September 2026.

The three things and what each is for

redirect_url. This is the page Flutterwave sends the customer back to. Checkout says that after the customer pays, or cancels, Flutterwave redirects them back to your site. After payment is complete, that redirect includes status, tx_ref, and transaction_id query parameters. The same page says to handle the redirect on your server and always verify the final state of the transaction.

Verify endpoint. This is GET https://api.flutterwave.com/v3/transactions/:id/verify. Transaction Verification says to pass the transaction ID in the URL. That page says you can get the ID from data.id in the webhook payload. The Checkout sample reads transaction_id from the redirect and passes it to verify. The secret key stays in FLW_SECRET_KEY.

Webhook. Flutterwave POSTs the event to your endpoint. The successful payment sample on the webhooks page uses the event charge.completed. That page says webhooks are especially useful for things outside your application's control: getting paid via mobile money or USSD, a customer being charged for their subscription, and a pending payment transitioning to successful.

The redirect status trap

The status query parameter is carried back by the browser. Read tx_ref and transaction_id, then call verify from your server. Never give value from status.

The redirect is not only the success path. Checkout says that after the customer pays, or cancels, Flutterwave redirects them back. If the attempt fails and the customer cancels, the redirect includes tx_ref and a status of failed. The redirect page has to handle "not paid" cleanly.

session_duration does the same kind of redirect. Checkout says that when the time is up, Flutterwave closes the payment page, redirects the customer to redirect_url, and marks the unfinished transaction as failed.

What to check on verify

These come from the transaction verification page.

The transaction status is data.status. In the sample response, the top-level status is success and data.status is successful. Check data.status.

Before you give value:

  • data.tx_ref matches the reference you generated.
  • data.status is successful.
  • data.currency is what you expected.
  • The amount paid is greater or equal to the amount you expect. The sample checks data.amount. If the amount was greater, you can give the customer value and refund the rest.

The same page says data.charged_amount is how much the customer was charged, and data.amount_settled is how much you will be receiving. Those are not the fields that decide whether to give value.

Recommended pattern

Use the webhook as the path that gives value, and verify on the redirect so the customer sees the right status. Both paths call one fulfil function.

Webhook. Verify the signature first. v3 sends your secret hash as is in verif-hash. Compare it in constant time. v4 sends the base64 HMAC-SHA256 of the raw body, keyed with the secret hash, in flutterwave-signature. Compute that HMAC on the raw bytes and compare it in constant time. The samples are in How to verify a Flutterwave webhook signature (v3 verif-hash and v4 flutterwave-signature). Answer 200, then verify the transaction and call fulfil in a background job. The webhooks page says your endpoint must return a 200 HTTP status code. Any other response codes, including 3xx codes, will be treated as a failure. Webhook requests time out after 60 seconds. The same page says to re-query the API before giving value from a webhook.

Redirect page. Call verify so you can show the customer the right status. Do not fulfil here unless the same idempotent fulfil function guards it. Do not read status as the decision.

One fulfil function. Key it on tx_ref, with a unique constraint, and call it from both the webhook job and the redirect. The same guard is in Why your payment webhook arrived twice.

Confirm the transaction from your server. This is the curl from the transaction verification page. The secret stays in FLW_SECRET_KEY:

curl --request GET "https://api.flutterwave.com/v3/transactions/123456/verify" \
  --header "Authorization: Bearer $FLW_SECRET_KEY"

Node.js (Express)

EXPECTED_AMOUNT and EXPECTED_CURRENCY are the amount and currency you charged. expectedTxRef is the reference you generated. fulfil inserts that reference and does the work only when the insert wins.

import express from "express";

const app = express();
const EXPECTED_AMOUNT = 7500;
const EXPECTED_CURRENCY = "NGN";

async function verifyTransaction(transactionId, expectedTxRef) {
  const response = await fetch(
    `https://api.flutterwave.com/v3/transactions/${encodeURIComponent(transactionId)}/verify`,
    {
      headers: { Authorization: `Bearer ${process.env.FLW_SECRET_KEY}` }
    }
  );
  const body = await response.json();
  const data = body.data ?? {};
  const ok =
    expectedTxRef !== "" &&
    data.status === "successful" &&
    data.tx_ref === expectedTxRef &&
    data.currency === EXPECTED_CURRENCY &&
    Number(data.amount) >= EXPECTED_AMOUNT;
  return { ok, data };
}

async function fulfil(db, txRef, work) {
  return db.tx(async (t) => {
    const row = await t.oneOrNone(
      `INSERT INTO fulfilled_payments (tx_ref) VALUES ($1)
       ON CONFLICT (tx_ref) DO NOTHING
       RETURNING tx_ref`,
      [txRef]
    );
    if (!row) return false;
    await work(t);
    return true;
  });
}

async function onChargeCompleted(db, event) {
  const data = event.data ?? {};
  const verified = await verifyTransaction(String(data.id ?? ""), String(data.tx_ref ?? ""));
  if (!verified.ok) return;
  await fulfil(db, verified.data.tx_ref, (t) =>
    t.none(
      `INSERT INTO ledger_entries (tx_ref, amount, currency)
       VALUES ($1, $2, $3)`,
      [verified.data.tx_ref, verified.data.amount, verified.data.currency]
    )
  );
}

app.get("/flutterwave/redirect", async (req, res) => {
  const txRef = String(req.query.tx_ref || "");
  const transactionId = String(req.query.transaction_id || "");
  const verified = await verifyTransaction(transactionId, txRef);
  if (verified.ok) {
    await fulfil(req.app.get("db"), txRef, (t) =>
      t.none(
        `INSERT INTO ledger_entries (tx_ref, amount, currency)
         VALUES ($1, $2, $3)`,
        [txRef, verified.data.amount, verified.data.currency]
      )
    );
  }
  res.status(200).send(verified.ok ? "Payment confirmed" : "Payment not confirmed");
});

app.post("/webhooks/flutterwave", express.raw({ type: "application/json" }), (req, res) => {
  // Verify verif-hash or flutterwave-signature on the raw body before this runs.
  // verify and fulfil run after the 200, in the background.
  const event = JSON.parse(req.body.toString("utf8"));
  res.sendStatus(200);
  if (event.event === "charge.completed") {
    onChargeCompleted(req.app.get("db"), event);
  }
});

PHP

Same two paths. fulfil is the only function that writes the ledger row. getenv("FLW_SECRET_KEY") is the only place the secret is read.

<?php
function flw_secret() {
    $secret = getenv("FLW_SECRET_KEY");
    if ($secret === false || $secret === "") {
        throw new RuntimeException("FLW_SECRET_KEY is not set");
    }
    return $secret;
}

function verify_transaction($transactionId, $expectedTxRef) {
    $url = "https://api.flutterwave.com/v3/transactions/" . rawurlencode($transactionId) . "/verify";
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_HTTPHEADER => ["Authorization: Bearer " . flw_secret()],
        CURLOPT_RETURNTRANSFER => true,
    ]);
    $raw = curl_exec($ch);
    curl_close($ch);
    $body = json_decode($raw, true);
    $data = is_array($body) ? ($body["data"] ?? []) : [];
    $ok = $expectedTxRef !== ""
        && is_array($body)
        && ($data["status"] ?? "") === "successful"
        && ($data["tx_ref"] ?? "") === $expectedTxRef
        && ($data["currency"] ?? "") === "NGN"
        && (float) ($data["amount"] ?? 0) >= 7500;
    return ["ok" => $ok, "data" => $data];
}

function fulfil(PDO $db, $txRef, $amount, $currency) {
    $db->beginTransaction();
    try {
        $insert = $db->prepare(
            "INSERT INTO fulfilled_payments (tx_ref) VALUES (:tx_ref)
             ON CONFLICT (tx_ref) DO NOTHING
             RETURNING tx_ref"
        );
        $insert->execute([":tx_ref" => $txRef]);
        if ($insert->fetch(PDO::FETCH_ASSOC) === false) {
            $db->commit();
            return false;
        }
        $ledger = $db->prepare(
            "INSERT INTO ledger_entries (tx_ref, amount, currency)
             VALUES (:tx_ref, :amount, :currency)"
        );
        $ledger->execute([
            ":tx_ref" => $txRef,
            ":amount" => $amount,
            ":currency" => $currency,
        ]);
        $db->commit();
        return true;
    } catch (Throwable $e) {
        $db->rollBack();
        throw $e;
    }
}

function on_redirect(PDO $db, $txRef, $transactionId) {
    $verified = verify_transaction($transactionId, $txRef);
    if ($verified["ok"]) {
        fulfil($db, $txRef, $verified["data"]["amount"], $verified["data"]["currency"]);
    }
    return $verified["ok"];
}

function on_charge_completed(PDO $db, $event) {
    $data = $event["data"] ?? [];
    $verified = verify_transaction((string) ($data["id"] ?? ""), (string) ($data["tx_ref"] ?? ""));
    if (!$verified["ok"]) {
        return;
    }
    fulfil($db, $verified["data"]["tx_ref"], $verified["data"]["amount"], $verified["data"]["currency"]);
}

7500 and NGN in these samples are the amount and currency you charged. They are the values in Flutterwave's Checkout example. They are not a Hooksnode limit.

What the webhook will and won't do

Flutterwave's webhooks page says it sends a webhook for a successful payment or a failed transaction. Checkout says that if webhooks are enabled, Flutterwave sends a notification for each failed payment attempt. The handler has to check data.status. Do not treat every charge.completed as paid. The successful payment sample uses that event name with data.status of successful.

Retries happen only if webhook retries are enabled. The webhooks page says to enable webhook retries on your dashboard. If Flutterwave does not get a 200, it retries the webhook call 3 times, with a 30-minute interval between each attempt. Recovery when those attempts are missed is in Why your Flutterwave webhook is not arriving (and how to fix it).

A pending payment can still complete later. The webhooks page says you will not know unless Flutterwave notifies you or you check later. Pending orders need a scheduled verify sweep, not a wait for a webhook.

Where Hooksnode fits

Point Flutterwave at one Hooksnode URL with the Flutterwave preset. The setup is in Send one Flutterwave webhook to several services. Hooksnode checks the signature at ingress, saves the event, and fans it out to your app, ledger, Slack or Sheets. Each destination retries on its own, up to 25 delivery attempts in total. Dead deliveries can be batch retried from Needs retry.

Delivery is at least once, never exactly once. The idempotent fulfil function above is still required.

Hooksnode does not replace the verify call on the redirect page or the pending-order sweep.

When the workspace has no credits left, Hooksnode stores the event as held and answers 202, until the hold limits. For project Free, with no paid project in the workspace, those limits are 1,000 held events, 50 MB stored, and a body larger than 64 KB is not held. A paid project Pro plan raises the event and byte caps. Workspace Pro ($50 a month) does too. Past a limit, the answer is 402. Flutterwave retries a 402 only if retries are on, and only 3 times, so watch your usage.

Plans

The project Free plan is $0 and includes 100,000 credits a month, with a hard cap.

The project Pro plan is $10/month and includes 1,000,000 credits, with a hard cap.

Checked against the public plans API on 2026-11-20. See pricing.

FAQ

Should the redirect URL be the only way I give value?

No. Flutterwave's Checkout page says to handle the redirect on your server and always verify the final state of the transaction.

What should verify confirm before I give value?

Match data.tx_ref to the reference you generated, check that data.status is successful, and check that data.currency is what you expected. The amount paid (data.amount) must be greater or equal to the amount you expect. If the amount was greater, you can give the customer value and refund the rest.

Does Flutterwave send a webhook for a failed payment?

Yes. Flutterwave's Checkout page says that if webhooks are enabled, it sends a notification for each failed payment attempt. Check data.status before you give value.

Does Hooksnode replace the verify call?

No. Hooksnode does not replace the verify call on the redirect page or the pending-order sweep.

Further reading