Docs menu
Docs/Paystack

Paystack integration setup

Use signed Paystack webhooks to send successful charges, subscription failures and refunds into Metrivo. Payment attribution stays confidence-labeled and does not invent matches.

Paystack revenue is signed-webhook evidence only. Metrivo does not request a charge-capable key beyond the secret Paystack uses to sign webhooks, and a payment is never marked connected until a signed event is accepted.

Signed inbound webhooks

Paystack signs every webhook with your secret key (sk_test_… or sk_live_…), so that key is the secret Metrivo needs. It is encrypted before storage and never rendered back after save. Metrivo verifies the HMAC-SHA512 in the x-paystack-signature header against the raw body before recording anything.

Setup steps

  1. 1. Open Metrivo Data Connections and generate the Paystack webhook URL.
  2. 2. In the Paystack dashboard, open Settings → API Keys & Webhooks and paste the Metrivo URL as the test or live webhook URL.
  3. 3. Save the matching Paystack secret key in Metrivo, and set the integration to the same test or live mode.
  4. 4. Complete a test-mode transaction. Metrivo marks the provider active only after a signed charge.success event is accepted.

Paystack retries live deliveries every three minutes for the first four attempts, then hourly for up to 72 hours. A retry never creates a second payment because the transaction reference is the payment identity.

Metadata for attribution

Pass Metrivo visitor and session identifiers in metadata when you initialize the transaction. Paystack returns them on charge.success under data.metadata. Without them Metrivo may fall back to customer email or leave the payment unattributed.

// Client: send this object to your checkout endpoint
const metadata = window.Metrivo.getAttributionMetadata()

// Server
await fetch("https://api.paystack.co/transaction/initialize", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PAYSTACK_SECRET_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ email: "customer@example.com", amount: 500000, currency: "NGN", metadata }),
})

How Metrivo reads Paystack events

  • charge.success is the only event that records revenue. amount is an integer in the currency's subunit and is converted with the currency's real exponent.
  • refund.processed updates the existing payment instead of creating a new row. It is recorded as refunded when the refund covers the stored amount, otherwise partially refunded.
  • invoice.payment_failed is recorded as a failed payment so it appears in recovery reporting.
  • Other events such as subscription.create and subscription.disable are stored as lifecycle evidence and carry no money.

Contract read from the Paystack documentation, checked 2026-10-28.