Get started

Quickstart

From an API key to a paid payment link and a verified webhook in about ten minutes.

By the end of this page your server will have created a payment link, a client will have paid it, and you will have received and verified the message that says so. It takes about ten minutes.

Before you start

  • An account. Create one if you have not; it is free.
  • A server you can run code on and reach from the internet over HTTPS. A tunnel to your laptop is fine while testing.

The four steps

  1. Create an API key

    In the app, open Settings, then Integrations, and create a key with the permissions paylinks.create and paylinks.read. Copy it when it is shown; it is shown once.

    Keep it in your environment
    export RADIPAY_API_KEY="rtk_XXXXXXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  2. Create a payment link

    Amounts are in minor units, so KES 1,500.00 is 150000. The Idempotency-Key makes the request safe to send again if the connection drops.

    curl -X POST https://prod.pay.radingtechnologies.co.ke/payment-links \
      -H "Authorization: Bearer $RADIPAY_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: order-1182-link" \
      -d '{
        "title": "Order 1182",
        "amountMinor": 150000,
        "customerName": "Amina Wanjiru"
      }'
    201 answer
    {
      "data": {
        "id": "0d6f4c1e-8a57-4c3b-9f0e-2f1c7a9d5b11",
        "reference": "PLABCD2345",
        "title": "Order 1182",
        "amountMinor": 150000,
        "currency": "KES",
        "status": "open",
        "url": "https://…/p/DW9MHoqFTDufDi8cep1bEQ.q0bX2n5J8wVtYc3LrZ7m"
      }
    }

    Store id against your order. Send url to your client, or open it yourself to see what they will see.

  3. Add a webhook endpoint

    In Settings, Integrations, Webhooks, add the HTTPS address of your server and tick payment.succeeded. Copy the signing secret, which starts with whsec_. Use Send test there to check your server answers.

    cURL
    export RADIPAY_WEBHOOK_SECRET="whsec_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  4. Receive and verify the payment

    When the money is confirmed, RadiPay sends your server a signed POST. Check the signature against the raw body before you believe it, answer 2xx quickly, and do the work once per webhook-id.

    import express from 'express';
    import { createHmac, timingSafeEqual } from 'node:crypto';
    
    const app = express();
    const seen = new Set();                       // use your database in production
    
    function isGenuine(secret, headers, rawBody) {
      const id = headers['webhook-id'], ts = headers['webhook-timestamp'];
      const sent = String(headers['webhook-signature'] || '').replace(/^v1,/, '');
      if (!id || !ts || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;   // too old: could be a replay
      const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');
      const want = createHmac('sha256', key).update(id + '.' + ts + '.' + rawBody).digest('base64');
      const a = Buffer.from(sent), b = Buffer.from(want);
      return a.length === b.length && timingSafeEqual(a, b);
    }
    
    // express.raw keeps the body exactly as it was sent, which the signature needs.
    app.post('/webhooks/radipay', express.raw({ type: 'application/json' }), (req, res) => {
      const raw = req.body.toString('utf8');
      if (!isGenuine(process.env.RADIPAY_WEBHOOK_SECRET, req.headers, raw)) return res.status(400).end();
      res.status(200).end();                      // answer first, work after
    
      const id = req.headers['webhook-id'];
      if (seen.has(id)) return;                   // a repeat: already handled
      seen.add(id);
    
      const event = JSON.parse(raw);
      if (event.type === 'payment.succeeded' && event.data.subjectType === 'payment_link') {
        const linkId = event.data.subjectId.split(':')[0];
        // mark the order for linkId as paid
      }
    });
    
    app.listen(3000);
    What arrives
    {
      "id": "evt_5f0c2a9e-3b1d-4c6e-9a77-2d1f8e4b6c01",
      "type": "payment.succeeded",
      "apiVersion": "2026-11-24",
      "createdAt": "2026-12-03T09:15:02.418Z",
      "tenantId": "0d6e1c1e-…",
      "data": {
        "intentId": "0b3e7c52-…",
        "reference": "RT-261203-4F9A1C2B",
        "subjectType": "payment_link",
        "subjectId": "0d6f4c1e-8a57-4c3b-9f0e-2f1c7a9d5b11:9f1c2ab34d5e",
        "amountMinor": 150000,
        "currency": "KES",
        "paidMinor": 150000,
        "receipt": "TKL4QZ8X1P"
      }
    }

    For a payment link, subjectId is the link's id, a colon, then twelve characters that identify this payment. Take the part before the colon to find your order.

Where next

© 2026 Rading Technologies Limited. RadiPay never asks for your M-Pesa PIN, by email, SMS or through the API. Terms · Privacy