Log in with PIN
curl --request POST \
--url https://api.cloudpay.africa/cloudpay/v1/auth/login \
--header 'Content-Type: application/json' \
--header 'X-Tenant-ID: <api-key>' \
--data '
{
"msisdn": 712345678,
"pin": "4821",
"device_id": "<string>",
"otp": "<string>"
}
'import requests
url = "https://api.cloudpay.africa/cloudpay/v1/auth/login"
payload = {
"msisdn": 712345678,
"pin": "4821",
"device_id": "<string>",
"otp": "<string>"
}
headers = {
"X-Tenant-ID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Tenant-ID': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({msisdn: 712345678, pin: '4821', device_id: '<string>', otp: '<string>'})
};
fetch('https://api.cloudpay.africa/cloudpay/v1/auth/login', 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/v1/auth/login",
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([
'msisdn' => 712345678,
'pin' => '4821',
'device_id' => '<string>',
'otp' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Tenant-ID: <api-key>"
],
]);
$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.cloudpay.africa/cloudpay/v1/auth/login"
payload := strings.NewReader("{\n \"msisdn\": 712345678,\n \"pin\": \"4821\",\n \"device_id\": \"<string>\",\n \"otp\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant-ID", "<api-key>")
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.cloudpay.africa/cloudpay/v1/auth/login")
.header("X-Tenant-ID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"msisdn\": 712345678,\n \"pin\": \"4821\",\n \"device_id\": \"<string>\",\n \"otp\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudpay.africa/cloudpay/v1/auth/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"msisdn\": 712345678,\n \"pin\": \"4821\",\n \"device_id\": \"<string>\",\n \"otp\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": {
"ok": true,
"code": 123,
"desc": "<string>"
},
"data": {
"access_token": "<string>",
"token_type": "Bearer",
"expires_at": "2023-11-07T05:31:56Z",
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"party": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "person",
"msisdn": "254712345678",
"display_name": "<string>",
"kyc_tier": 1,
"status": "active",
"created_at": "2023-11-07T05:31:56Z"
}
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}Auth
Log in with PIN
Checks the PIN (5 wrong attempts lock it for 30 minutes). If the device is not bound
to the customer yet, the response is 403 device_verification_required; send a login
OTP and retry with otp. A successful login ends every other session of the customer.
POST
/
v1
/
auth
/
login
Log in with PIN
curl --request POST \
--url https://api.cloudpay.africa/cloudpay/v1/auth/login \
--header 'Content-Type: application/json' \
--header 'X-Tenant-ID: <api-key>' \
--data '
{
"msisdn": 712345678,
"pin": "4821",
"device_id": "<string>",
"otp": "<string>"
}
'import requests
url = "https://api.cloudpay.africa/cloudpay/v1/auth/login"
payload = {
"msisdn": 712345678,
"pin": "4821",
"device_id": "<string>",
"otp": "<string>"
}
headers = {
"X-Tenant-ID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Tenant-ID': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({msisdn: 712345678, pin: '4821', device_id: '<string>', otp: '<string>'})
};
fetch('https://api.cloudpay.africa/cloudpay/v1/auth/login', 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/v1/auth/login",
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([
'msisdn' => 712345678,
'pin' => '4821',
'device_id' => '<string>',
'otp' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Tenant-ID: <api-key>"
],
]);
$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.cloudpay.africa/cloudpay/v1/auth/login"
payload := strings.NewReader("{\n \"msisdn\": 712345678,\n \"pin\": \"4821\",\n \"device_id\": \"<string>\",\n \"otp\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant-ID", "<api-key>")
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.cloudpay.africa/cloudpay/v1/auth/login")
.header("X-Tenant-ID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"msisdn\": 712345678,\n \"pin\": \"4821\",\n \"device_id\": \"<string>\",\n \"otp\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudpay.africa/cloudpay/v1/auth/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"msisdn\": 712345678,\n \"pin\": \"4821\",\n \"device_id\": \"<string>\",\n \"otp\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": {
"ok": true,
"code": 123,
"desc": "<string>"
},
"data": {
"access_token": "<string>",
"token_type": "Bearer",
"expires_at": "2023-11-07T05:31:56Z",
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"party": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "person",
"msisdn": "254712345678",
"display_name": "<string>",
"kyc_tier": 1,
"status": "active",
"created_at": "2023-11-07T05:31:56Z"
}
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}Authorizations
Body
application/json