Oystr
Search
⌃K

Create Customer

A customer is a person whose data is to be fetched by Oystr. Here are some useful links to maintaining customers on oystr
post
https://{{BASE_URL}}/customer
After a customer is successfully created, we send an OTP to the phone number used in creating the customer.
This OTP has to be sent to the verify-customer route
The following parameters are valid for this route. the ones with asterik are required
  • phone_number * : A phone number with a valid country code or phone number without country code, eg +2348090000001 or 08090000001
  • full_name * : Whitespace separated string containing the full name of the customer whose data is to be fetched
  • bvn: A valid Bank verification number for Nigerian customers. not required.
  • nin: A valid National Identification number for Nigerians, not required.
  • tracking_code: a valid string with length 0<n<50
  • country: One of the following
    • NG for Nigeria
    • RW for Rwanda

Code Samples

HTTP
POST /v1/customer HTTP/1.1
Host: https://{{BASE_URL}}
Content-Length: 280
{
"phone_number": "09000000000",
"full_name": "Ciroma Chukwuma Adekunle",
"bvn": "000000000000",
"nin": "00000000000",
"tracking_code": "b7f2a9ef-aace-44a1-ab79-54a4e5a1cb67",
"regno": "37a8209d-6ac6-4f75-98a2-e83873274719'",
"country" : "NG"
}
nodejs axios
var axios = require('axios');
var data = '{\r\n "phone_number": "09000000000",\r\n "full_name": "Ciroma Chukwuma Adekunle",\r\n "bvn": "000000000000",\r\n "nin": "00000000000",\r\n "tracking_code": "b7f2a9ef-aace-44a1-ab79-54a4e5a1cb67",\r\n "regno": "37a8209d-6ac6-4f75-98a2-e83873274719\'",\r\n "country" : "NG"\r\n}';
var config = {
method: 'post',
url: 'https://{{BASE_URL}}/v1/customer',
headers: { },
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
PHP - cURL
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://{{BASE_URL}}/v1/customer',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"phone_number": "09000000000",
"full_name": "Ciroma Chukwuma Adekunle",
"bvn": "000000000000",
"nin": "00000000000",
"tracking_code": "b7f2a9ef-aace-44a1-ab79-54a4e5a1cb67",
"regno": "37a8209d-6ac6-4f75-98a2-e83873274719\'",
"country" : "NG"
}',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
JAVA - Unirest
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://{{BASE_URL}}/v1/customer")
.body("{\r\n \"phone_number\": \"09000000000\",\r\n \"full_name\": \"Ciroma Chukwuma Adekunle\",\r\n \"bvn\": \"000000000000\",\r\n \"nin\": \"00000000000\",\r\n \"tracking_code\": \"b7f2a9ef-aace-44a1-ab79-54a4e5a1cb67\",\r\n \"regno\": \"37a8209d-6ac6-4f75-98a2-e83873274719'\",\r\n \"country\" : \"NG\"\r\n}")
.asString();
Python Requests
import requests
url = "https://{{BASE_URL}}/v1/customer"
payload = "{\r\n \"phone_number\": \"09000000000\",\r\n \"full_name\": \"Ciroma Chukwuma Adekunle\",\r\n \"bvn\": \"000000000000\",\r\n \"nin\": \"00000000000\",\r\n \"tracking_code\": \"b7f2a9ef-aace-44a1-ab79-54a4e5a1cb67\",\r\n \"regno\": \"37a8209d-6ac6-4f75-98a2-e83873274719'\",\r\n \"country\" : \"NG\"\r\n}"
headers = {}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Go native
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://{{BASE_URL}}/v1/customer"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"phone_number": "09000000000",`+"
"+`
"full_name": "Ciroma Chukwuma Adekunle",`+"
"+`
"bvn": "000000000000",`+"
"+`
"nin": "00000000000",`+"
"+`
"tracking_code": "b7f2a9ef-aace-44a1-ab79-54a4e5a1cb67",`+"
"+`
"regno": "37a8209d-6ac6-4f75-98a2-e83873274719'",`+"
"+`
"country" : "NG"`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}