Create hosted checkout
curl --request POST \
--url https://api.sarafa.site/v3/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "25",
"currency": "USD",
"title": "Order 100",
"description": "Payment for your order",
"reference": "order-100",
"callback_url": "https://merchant.example/payments",
"redirect_url": "https://merchant.example/orders/100"
}
'import requests
url = "https://api.sarafa.site/v3/checkout"
payload = {
"amount": "25",
"currency": "USD",
"title": "Order 100",
"description": "Payment for your order",
"reference": "order-100",
"callback_url": "https://merchant.example/payments",
"redirect_url": "https://merchant.example/orders/100"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '25',
currency: 'USD',
title: 'Order 100',
description: 'Payment for your order',
reference: 'order-100',
callback_url: 'https://merchant.example/payments',
redirect_url: 'https://merchant.example/orders/100'
})
};
fetch('https://api.sarafa.site/v3/checkout', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sarafa.site/v3/checkout",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '25',
'currency' => 'USD',
'title' => 'Order 100',
'description' => 'Payment for your order',
'reference' => 'order-100',
'callback_url' => 'https://merchant.example/payments',
'redirect_url' => 'https://merchant.example/orders/100'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sarafa.site/v3/checkout"
payload := strings.NewReader("{\n \"amount\": \"25\",\n \"currency\": \"USD\",\n \"title\": \"Order 100\",\n \"description\": \"Payment for your order\",\n \"reference\": \"order-100\",\n \"callback_url\": \"https://merchant.example/payments\",\n \"redirect_url\": \"https://merchant.example/orders/100\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sarafa.site/v3/checkout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"25\",\n \"currency\": \"USD\",\n \"title\": \"Order 100\",\n \"description\": \"Payment for your order\",\n \"reference\": \"order-100\",\n \"callback_url\": \"https://merchant.example/payments\",\n \"redirect_url\": \"https://merchant.example/orders/100\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sarafa.site/v3/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"25\",\n \"currency\": \"USD\",\n \"title\": \"Order 100\",\n \"description\": \"Payment for your order\",\n \"reference\": \"order-100\",\n \"callback_url\": \"https://merchant.example/payments\",\n \"redirect_url\": \"https://merchant.example/orders/100\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"checkout": {
"slug": "<generated-slug>",
"title": "Order 100",
"description": "Payment for your order",
"amount": "25",
"currency": "USD",
"status": "open",
"created_at": "2026-10-30T10:00:00.000Z",
"reference": "order-100",
"checkout_url": "https://checkout.sarafa.site/p/<generated-slug>",
"transactions": []
}
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}Payments
Hosted checkout
Create a fixed-amount payment link and read its payment status.
POST
/
checkout
Create hosted checkout
curl --request POST \
--url https://api.sarafa.site/v3/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "25",
"currency": "USD",
"title": "Order 100",
"description": "Payment for your order",
"reference": "order-100",
"callback_url": "https://merchant.example/payments",
"redirect_url": "https://merchant.example/orders/100"
}
'import requests
url = "https://api.sarafa.site/v3/checkout"
payload = {
"amount": "25",
"currency": "USD",
"title": "Order 100",
"description": "Payment for your order",
"reference": "order-100",
"callback_url": "https://merchant.example/payments",
"redirect_url": "https://merchant.example/orders/100"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '25',
currency: 'USD',
title: 'Order 100',
description: 'Payment for your order',
reference: 'order-100',
callback_url: 'https://merchant.example/payments',
redirect_url: 'https://merchant.example/orders/100'
})
};
fetch('https://api.sarafa.site/v3/checkout', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sarafa.site/v3/checkout",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '25',
'currency' => 'USD',
'title' => 'Order 100',
'description' => 'Payment for your order',
'reference' => 'order-100',
'callback_url' => 'https://merchant.example/payments',
'redirect_url' => 'https://merchant.example/orders/100'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sarafa.site/v3/checkout"
payload := strings.NewReader("{\n \"amount\": \"25\",\n \"currency\": \"USD\",\n \"title\": \"Order 100\",\n \"description\": \"Payment for your order\",\n \"reference\": \"order-100\",\n \"callback_url\": \"https://merchant.example/payments\",\n \"redirect_url\": \"https://merchant.example/orders/100\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sarafa.site/v3/checkout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"25\",\n \"currency\": \"USD\",\n \"title\": \"Order 100\",\n \"description\": \"Payment for your order\",\n \"reference\": \"order-100\",\n \"callback_url\": \"https://merchant.example/payments\",\n \"redirect_url\": \"https://merchant.example/orders/100\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sarafa.site/v3/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"25\",\n \"currency\": \"USD\",\n \"title\": \"Order 100\",\n \"description\": \"Payment for your order\",\n \"reference\": \"order-100\",\n \"callback_url\": \"https://merchant.example/payments\",\n \"redirect_url\": \"https://merchant.example/orders/100\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"checkout": {
"slug": "<generated-slug>",
"title": "Order 100",
"description": "Payment for your order",
"amount": "25",
"currency": "USD",
"status": "open",
"created_at": "2026-10-30T10:00:00.000Z",
"reference": "order-100",
"checkout_url": "https://checkout.sarafa.site/p/<generated-slug>",
"transactions": []
}
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}{
"status": "failed",
"error": "<string>",
"request_id": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>"
}
]
}Create a single-payment invoice priced in USD. Hosted checkout supports card, Sarafa, and KES/UGX mobile payments. Link creation itself does not move funds or produce a payment callback.
Redirect the payer to the returned
Returns HTTP
Browser redirects are not proof of payment. Confirm the outcome using this authenticated status read, payment details, or signed callbacks.
{
"amount": "25",
"currency": "USD",
"title": "Order 100",
"description": "Payment for your order",
"reference": "order-100",
"callback_url": "https://merchant.example/payments",
"redirect_url": "https://merchant.example/orders/100"
}
redirect_url is optional. It must use HTTPS without embedded credentials. All other fields above are required. Checkout creation does not accept a quote field.
Example response, HTTP 201:
{
"status": "success",
"checkout": {
"slug": "<generated-slug>",
"title": "Order 100",
"description": "Payment for your order",
"amount": "25",
"currency": "USD",
"status": "open",
"created_at": "2026-10-30T10:00:00.000Z",
"reference": "order-100",
"checkout_url": "https://checkout.sarafa.site/p/<generated-slug>",
"transactions": []
}
}
checkout_url. Successful payment closes the link to further payments; failed attempts can be retried. Each attempt has its own tx_reference while retaining your checkout reference.
Check checkout status
Use your merchant reference withGET /v3/checkout/{reference}:
curl "https://api.sarafa.site/v3/checkout/order-100" \
-H "Authorization: Bearer $SARAFA_API_KEY"
200 with the same checkout response shape, including associated transactions. An unknown checkout reference within your organization returns HTTP 404.
| Checkout status | Meaning |
|---|---|
open | Available for payment. |
paid | Successfully paid; further payments are closed. |
closed | Closed without a successful payment. |
Authorizations
Use the full key from the merchant dashboard API section. Keep it on your server.
Body
application/json
Positive decimal string, not a JSON number. Zero is invalid. Currency-specific precision and payment limits also apply.
Pattern:
^[0-9]+([.][0-9]{1,18})?$Example:
"100.00"
Available options:
USD Required string length:
1 - 160Minimum string length:
1Your idempotency reference, unique across charge, transfer, swap, and checkout creation within your organization. Reuse it with unchanged details for execution retries.
Required string length:
1 - 128HTTPS URL without embedded credentials. Required even for quotes. Receives signed payment callbacks.
Pattern:
^https://Example:
"https://merchant.example/payments"
Optional browser return URL. Must use HTTPS without embedded credentials. Redirects are not proof of payment.
Pattern:
^https://