Sasio Pay API · v1

Connect your systems to Sasio Pay

Create quotes and invoices from your online shop, CRM or accounting system, record payments, and get a webhook the moment a client views, accepts or pays. It's free.

Base URL: https://pay.sasio.co.za/api/v1

Examples in curl, C# (.NET), Node.js, Python and PHP.

Quickstart

  1. Log in to Sasio Pay and open Settings → Developers.
  2. Create a test key. It starts with pm_test_. Copy it: it's only shown once.
  3. Create your first invoice:
Request
curl https://pay.sasio.co.za/api/v1/invoices \
  -H "Authorization: Bearer pm_test_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1001" \
  -d '{
    "client": { "name": "Acme Trading", "email": "accounts@acme.example", "external_id": "CUST-42" },
    "reference": "PO-1001",
    "items": [
      { "description": "Website design", "quantity": 1, "unit_price": 1500000 },
      { "description": "Hosting", "quantity": 12, "unit": "months", "unit_price": 25000 }
    ],
    "vat": true
  }'
Response (shortened)
{
  "object": "invoice",
  "id": "cmhx1...",
  "livemode": false,
  "number": "INV-0001",
  "status": "unpaid",
  "reference": "PO-1001",
  "issue_date": "2026-11-13",
  "due_date": "2026-11-20",
  "currency": "ZAR",
  "subtotal": 1800000,
  "vat": 270000,
  "total": 2070000,
  "amount_due": 2070000,
  "public_url": "https://pay.sasio.co.za/d/…",
  "pdf_url": "https://pay.sasio.co.za/d/…/pdf",
  "whatsapp_url": null
}

Then email it to the client with POST /invoices/{id}/send, or share public_url yourself. The client's page shows your payment details and lets them pay, download a PDF, or tell you they've paid.

The same in C# (.NET 6 or later, no extra packages), including recording a payment later:

C#
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

var http = new HttpClient { BaseAddress = new Uri("https://pay.sasio.co.za/api/v1/") };
http.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("PAYME_API_KEY"));

var request = new HttpRequestMessage(HttpMethod.Post, "invoices")
{
    Content = JsonContent.Create(new
    {
        client = new { name = "Acme Trading", email = "accounts@acme.example", external_id = "CUST-42" },
        reference = "PO-1001",
        items = new object[]
        {
            new { description = "Website design", quantity = 1, unit_price = 1500000 },
            new { description = "Hosting", quantity = 12, unit = "months", unit_price = 25000 },
        },
        vat = true,
    }),
};
request.Headers.Add("Idempotency-Key", "order-1001"); // safe to retry

var response = await http.SendAsync(request);
var invoice = await response.Content.ReadFromJsonAsync<JsonElement>();
if (!response.IsSuccessStatusCode)
    throw new Exception(invoice.GetProperty("error").GetProperty("message").GetString());

var invoiceId = invoice.GetProperty("id").GetString();
Console.WriteLine($"{invoice.GetProperty("number")}: {invoice.GetProperty("public_url")}");

// later, when the money is in your bank:
var paid = await http.PostAsJsonAsync($"invoices/{invoiceId}/payments",
    new { amount = 1000000, paid_on = DateTime.Today.ToString("yyyy-MM-dd"), method = "eft", note = "FNB ref 8812" });
paid.EnsureSuccessStatusCode();

Keys and test mode

Send your key in the Authorization header on every request: Bearer pm_live_… or Bearer pm_test_…. Keep keys on your server; never put one in a website or mobile app. You can revoke a key at any time in Settings.

  • Test keys work on a separate test copy of your business. Test quotes and invoices never appear in your real app, reports or numbering, emails are not actually sent, and their links and PDFs are clearly marked TEST. Webhooks still fire, with "livemode": false.
  • Live keys work on your real quotes and invoices, exactly as if you'd made them in the app.
  • Read only keys can only use GET endpoints.

Amounts, dates and lists

  • Money is in cents, as whole numbers, always in rand (ZAR): 150000 is R1 500.00. Prices are excluding VAT; set "vat": true to add 15% (your VAT number must be in Settings).
  • Dates are YYYY-MM-DD, in South African time. Timestamps (like viewed_at) are ISO 8601 in UTC.
  • Lists come newest first as { "data": [...], "has_more": true }. Get the next page with ?starting_after=<last id>; limit is 1 to 100 (default 25).
  • Retries are safe with an Idempotency-Key header on any POST (your order number works well). Sending the same key and body again within 24 hours returns the first response instead of making a second invoice.
  • Your ids: give clients an external_id (your customer number) and documents a reference (your order or PO number, printed on the invoice).

Creating invoices and quotes

POST /invoices and POST /quotes take the same fields:

  • client_id, or a client object. Sasio Pay finds the client by external_id, then phone number, then email, and creates them if they're new. A client needs an email or a WhatsApp number.
  • items: 1 to 50 lines of description, quantity (up to 3 decimals), optional unit, and unit_price in cents.
  • Optional: issue_date, due_date (invoices; defaults to your payment terms) or valid_until (quotes; 14 days), vat, discount ({ "type": "percent", "value": 10 } or an amount in cents), deposit_percent, notes, reference.

Invoice numbers come from your Sasio Pay numbering and never repeat. Invoices can't be deleted, only cancelled, so your records stay complete. When a client accepts a quote on its link, Sasio Pay turns it into an invoice straight away (you get quote.accepted and quote.converted).

WhatsApp: messages go from your own phone, so the API doesn't send them. When the client has a phone number, whatsapp_url opens WhatsApp with the message ready to send.

Getting paid

Money never passes through Sasio Pay: clients pay you by EFT, PayShap or your own payment link. When money arrives, record it so the invoice shows what's still due:

curl https://pay.sasio.co.za/api/v1/invoices/{id}/payments \
  -H "Authorization: Bearer pm_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "amount": 1000000, "paid_on": "2026-11-12", "method": "eft", "note": "FNB ref 8812" }'

The invoice's status becomes partially_paid or paid. Paying more than is due is refused. Invoice statuses: unpaid, partially_paid, overdue, paid, cancelled, credited. Quote statuses: open, accepted, declined, expired, invoiced.

Webhooks

Add your address in Settings → Developers (https only). Sasio Pay sends a POST with a JSON event; reply with any 2xx within 10 seconds. If it fails, Sasio Pay tries again after 1 minute, 5 minutes, 30 minutes, 2, 6 and 12 hours. The same event can arrive twice, so use its id to ignore repeats.

EventWhen
invoice.sentThe invoice was sent (by the API, or from the app)
invoice.viewedThe client opened the invoice link for the first time
invoice.paidThe invoice is paid in full
invoice.partially_paidA payment was recorded and money is still due
invoice.overdueThe due date passed yesterday and money is still due (sent once, in the morning)
invoice.cancelledThe invoice was cancelled
payment.recordedA payment was recorded (data.object is the payment)
payment_claim.createdThe client tapped "I've paid" and attached proof of payment. Check your bank, then record the payment
quote.sentThe quote was sent
quote.viewedThe client opened the quote link for the first time
quote.acceptedThe client accepted the quote
quote.declinedThe client declined the quote
quote.convertedThe quote became an invoice (data.object is the quote; invoice_id points to the invoice)
Event
{
  "id": "evt_...",
  "object": "event",
  "type": "invoice.paid",
  "created": 1763030400,
  "livemode": true,
  "data": { "object": { "object": "invoice", "id": "...", "status": "paid", ... } }
}

Check the signature so nobody else can fake events. Each request has a PayMe-Signature header like t=1763030400,v1=5f8a…: an HMAC-SHA256 of <t>.<raw body> using your endpoint's signing secret (whsec_…). Compare it, and refuse timestamps older than 5 minutes.

Node.js
import crypto from "node:crypto";

function verify(rawBody, header, secret) {
  const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
  const want = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return want.length === v1.length && crypto.timingSafeEqual(Buffer.from(want), Buffer.from(v1));
}
Python
import hmac, hashlib, time

def verify(raw_body: bytes, header: str, secret: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    if abs(time.time() - int(parts["t"])) > 300:
        return False
    want = hmac.new(secret.encode(), f"{parts['t']}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(want, parts["v1"])
PHP
function verify(string $rawBody, string $header, string $secret): bool {
    parse_str(str_replace(',', '&', $header), $p);
    if (abs(time() - (int) $p['t']) > 300) return false;
    $want = hash_hmac('sha256', $p['t'] . '.' . $rawBody, $secret);
    return hash_equals($want, $p['v1']);
}
C# (ASP.NET Core)
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;

app.MapPost("/payme/webhook", async (HttpRequest req, IConfiguration config) =>
{
    // read the raw body: parsing and re-encoding the JSON would change it and break the signature
    using var reader = new StreamReader(req.Body, Encoding.UTF8);
    var rawBody = await reader.ReadToEndAsync();
    var header = req.Headers["PayMe-Signature"].ToString();
    var secret = config["PayMe:WebhookSecret"]!; // whsec_... from Settings -> Developers

    if (!PayMeSignature.Verify(rawBody, header, secret)) return Results.Unauthorized();

    using var doc = JsonDocument.Parse(rawBody);
    var eventId = doc.RootElement.GetProperty("id").GetString(); // store it to ignore repeats
    var type = doc.RootElement.GetProperty("type").GetString();
    var obj = doc.RootElement.GetProperty("data").GetProperty("object");

    if (type == "invoice.paid")
    {
        var reference = obj.GetProperty("reference").GetString(); // your order / PO number
        // mark the order as paid in your system
    }
    return Results.Ok();
});

static class PayMeSignature
{
    public static bool Verify(string rawBody, string header, string secret, int toleranceSeconds = 300)
    {
        var parts = header.Split(',')
            .Select(p => p.Split('=', 2))
            .Where(p => p.Length == 2)
            .ToDictionary(p => p[0], p => p[1]);
        if (!parts.TryGetValue("t", out var t) || !parts.TryGetValue("v1", out var v1) || !long.TryParse(t, out var ts))
            return false;
        if (Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - ts) > toleranceSeconds)
            return false;

        using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
        var want = Convert.ToHexString(hmac.ComputeHash(Encoding.UTF8.GetBytes($"{t}.{rawBody}"))).ToLowerInvariant();
        return CryptographicOperations.FixedTimeEquals(Encoding.ASCII.GetBytes(want), Encoding.ASCII.GetBytes(v1));
    }
}

Use the raw request body exactly as received; parsing and re-encoding the JSON changes it and the signature won't match.

Errors and limits

Error
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_parameter",
    "message": "Only R5 000 is still due on this invoice.",
    "field": "amount"
  }
}
  • 400 bad JSON · 401 missing or revoked key · 403 read-only key or suspended account · 404 not found (or not yours) · 409 not allowed right now (e.g. paying a cancelled invoice) · 422 a field isn't right; field says which · 429 too many requests · 5xx our side: retry with the same Idempotency-Key.
  • Up to 120 requests a minute per key. When you go over, wait for the number of seconds in the Retry-After header.
  • Request bodies up to 1 MB; up to 50 lines per document.
  • Emails sent with /send: up to 200 a day per account (20 a day in an account's first week), and up to 3 a day to the same address. Over that you get 429 with code email_limit_reached; you can always share public_url yourself. Your own message text can be used once the account is a week old; until then the standard email goes out.

All endpoints

Full request and response details are in the OpenAPI file (import it into Postman, Insomnia or your code generator).

GET/meThe business your key belongs to, and whether it's live or test
POST/clientsCreate a client
GET/clientsList clients (filter by email, phone or external_id)
GET/clients/{id}Get a client
PATCH/clients/{id}Update a client
POST/invoicesCreate an invoice
GET/invoicesList invoices (filter by status, client_id, updated_since)
GET/invoices/{id}Get an invoice, with payments and amount due
POST/invoices/{id}/sendEmail the invoice to the client
POST/invoices/{id}/paymentsRecord a payment you received
POST/invoices/{id}/cancelCancel an invoice (its number is kept)
GET/invoices/{id}/pdfDownload the PDF
GET/paymentsList payments (filter by since, invoice_id)
POST/quotesCreate a quote
GET/quotesList quotes (filter by status, client_id, updated_since)
GET/quotes/{id}Get a quote
POST/quotes/{id}/sendEmail the quote to the client
POST/quotes/{id}/convertTurn a quote into an invoice (safe to repeat)
GET/quotes/{id}/pdfDownload the PDF

Coming next

Credit notes, client statements, saved items, monthly invoices and reports through the API, and managing webhooks by API.