Verify Customer
Supply the OTP token sent to the user as confirmation to Oystr.
post
https://{{BASE_URL}}/v1/customer/verify
Route to verify a customer
The customer has to give consent for his/her data to be fetched before we can do anything
The following parameters are valid for this route
The ones with asterik * are required
- otp * : A 6 digit numeric string sent to the user's phone number
- customer_id * : The ID of the customer created.
- tracking_code * : The tracking code used to create the user.
The customer Id is required when the tracking code is not provided and vice versa for the tracking code.
For requests made to the sandbox url, any 6 digit otp will verify the customer
If both are supplied, the customer Id takes precedence over the tracking code
HTTP
POST /v1/customer/verify HTTP/1.1
Host: https://{{BASE_URL}}
Content-Length: 136
{
"customer_id":"cd989813-9852-40f6-bca7-ea0233d48cb9",
"otp": "983707",
"tracking_code" : "customer_id_on_my_website"
}
Nodejs Axios
var axios = require('axios');
var data = '{\r\n "customer_id":"cd989813-9852-40f6-bca7-ea0233d48cb9",\r\n "otp": "983707",\r\n "tracking_code" : "customer_id_on_my_website"\r\n}';
var config = {
method: 'post',
url: 'https://{{BASE_URL}}/v1/customer/verify',
headers: { },
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
})
Python Requests
import requests
url = "https://{{BASE_URL}}/v1/customer/verify"
payload = "{\r\n \"customer_id\":\"cd989813-9852-40f6-bca7-ea0233d48cb9\",\r\n \"otp\": \"983707\",\r\n \"tracking_code\" : \"customer_id_on_my_website\"\r\n}"
headers = {}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
PHP curl
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://{{BASE_URL}}/v1/customer/verify",
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 =>'{
"customer_id":"cd989813-9852-40f6-bca7-ea0233d48cb9",
"otp": "983707",
"tracking_code" : "customer_id_on_my_website"
}',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Go Native
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://{{BASE_URL}}/v1/customer/verify"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"customer_id":"cd989813-9852-40f6-bca7-ea0233d48cb9",`+"
"+`
"otp": "983707",`+"
"+`
"tracking_code" : "customer_id_on_my_website"`+"
"+`
}`)
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))
}
JAVA - Unirest
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://{{BASE_URL}}/v1/customer/verify")
.body("{\r\n \"customer_id\":\"cd989813-9852-40f6-bca7-ea0233d48cb9\",\r\n \"otp\": \"983707\",\r\n \"tracking_code\" : \"customer_id_on_my_website\"\r\n}")
.asString();
Last modified 10mo ago