Bank list
Introduction
The Bank List API provides a list of banks along with their corresponding bank codes. This documentation outlines how to access the API endpoint and understand the structure of the response.
Endpoint
https://api.mypayd.app/v1/sasapay/banks
Code Examples
Below are code examples in different programming languages demonstrating how to send money to a mobile number using HTTP POST requests.
- Curl
- Go
- Nodejs
- Python
- PHP
curl --location --request GET 'https://api.mypayd.app/v1/sasapay/banks'
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.mypayd.app/v1/sasapay/banks"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error:", err)
return
}
res, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Println(string(body))
}
const axios = require('axios');
axios.get('https://api.mypayd.app/v1/sasapay/banks')
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});
import requests
url = "https://api.mypayd.app/v1/sasapay/banks"
response = requests.get(url)
if response.status_code == 200:
print(response.json())
else:
print("Error:", response.status_code)
<?php
$url = 'https://api.mypayd.app/v1/sasapay/banks';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if($response === false) {
echo 'Error: ' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
Response Format
The API response is a JSON array containing objects for each bank. Each object includes the following attributes:
bank_name: The name of the bank. bank_code: The unique bank code assigned to the bank.
Example of a successful response
[
{
"bank_name": "ABC Bank",
"bank_code": "35"
},
{
"bank_name": "Absa Bank Kenya Plc",
"bank_code": "03"
},
{
"bank_name": "Bank of Africa",
"bank_code": "19"
}
]
Conclusion
The Bank List API simplifies the process of retrieving a comprehensive list of banks and their corresponding bank codes. By integrating this API into your applications, you can enhance the user experience and streamline banking-related processes.