Merchant QR code (PNG)
curl --request GET \
--url https://api.cloudpay.africa/cloudpay/pay/{code}/qr.pngimport requests
url = "https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png', 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.cloudpay.africa/cloudpay/pay/{code}/qr.png",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}Merchant pay
Merchant QR code (PNG)
QR encoding the pay page URL (also returned in the X-Pay-URL header), with the Cloudpay mark in the middle.
Works for a till code and a pay-link code. A pay-link’s QR carries its fixed amount and reference, so the payer
types nothing but their M-Pesa PIN. Print it, show it on a till screen, or put it on an invoice.
Highest error correction keeps it readable at every size (128-1024 px, ?size=, default 512).
GET
/
pay
/
{code}
/
qr.png
Merchant QR code (PNG)
curl --request GET \
--url https://api.cloudpay.africa/cloudpay/pay/{code}/qr.pngimport requests
url = "https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png', 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.cloudpay.africa/cloudpay/pay/{code}/qr.png",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudpay.africa/cloudpay/pay/{code}/qr.png")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}