Fetch Customer's Transactions
Fetch data for a customer from our many data sources
Fetch data for a customer from our many data sources
post
{BASE_URL}/customer/fetch-transactions
The following parameters are valid for this route
The ones with asterik * are required
- idempotency_ref * : An ID used to fetch the same response twice without incuring costs on the second request.
- 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.
If both are supplied, the customer Id takes precedence over the tracking code
DATA REQUEST
- transactions:
- include: must be equal to true
- options:
- duration
- from : A valid date string of any format, date must be at least one month ago. Defaults to 6 months ago
- to : A valid date string of any format, date must be at most one day ago. Defaults to today's date.
- max_sources : The max sources where the customer's data should be pulled from. Defaults to the total amount of data sources on oystr and determines the price of the request which is charged at $oystr_price * successful_data_sources.
CODE SAMPLES
HTTP
POST /v1/customer/fetch-transactions HTTP/1.1
Host: {{BASE_URL}}
Content-Length: 398
{
"idempotency_ref": "et-earum-et",
"customer_id": "cd989813-9852-40f6-bca7-ea0233d48cb9",
"data_request":{
"identity": {
"include": true,
"options": ["phone", "bvn", "nin"]
},
"transactions": {
"include": true,
"options": {
"duration": {
"from": "2019-09-21T22:01:15.581Z",
"to": "2021-09-21T22:01:15.581Z"
}
}
}
}
}
Nodejs Axios
var axios = require('axios');
var data = '{\r\n "idempotency_ref": "et-earum-et",\r\n "customer_id": "cd989813-9852-40f6-bca7-ea0233d48cb9",\r\n "data_request":{\r\n "identity": {\r\n\t\t\t"include": true,\r\n\t\t\t"options": ["phone", "bvn", "nin"]\r\n\t\t},\r\n\t\t"transactions": {\r\n\t\t\t"include": true,\r\n\t\t\t"options": {\r\n\t\t\t\t"duration": {\r\n\t\t\t\t\t"from": "2019-09-21T22:01:15.581Z",\r\n\t\t\t\t\t"to": "2021-09-21T22:01:15.581Z"\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n }\r\n}\r\n';
var config = {
method: 'post',
url: '{{BASE_URL}}/v1/customer/fetch-transactions',
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 => '{{BASE_URL}}/v1/customer/fetch-transactions',
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 =>'{
"idempotency_ref": "et-earum-et",
"customer_id": "cd989813-9852-40f6-bca7-ea0233d48cb9",
"data_request":{
"identity": {
"include": true,
"options": ["phone", "bvn", "nin"]
},
"transactions": {
"include": true,
"options": {
"duration": {
"from": "2019-09-21T22:01:15.581Z",
"to": "2021-09-21T22:01:15.581Z"
}
}
}
}
}
',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Python -Requests
import requests
url = "{{BASE_URL}}/v1/customer/fetch-transactions"
payload = "{\r\n \"idempotency_ref\": \"et-earum-et\",\r\n \"customer_id\": \"cd989813-9852-40f6-bca7-ea0233d48cb9\",\r\n \"data_request\":{\r\n \"identity\": {\r\n\t\t\t\"include\": true,\r\n\t\t\t\"options\": [\"phone\", \"bvn\", \"nin\"]\r\n\t\t},\r\n\t\t\"transactions\": {\r\n\t\t\t\"include\": true,\r\n\t\t\t\"options\": {\r\n\t\t\t\t\"duration\": {\r\n\t\t\t\t\t\"from\": \"2019-09-21T22:01:15.581Z\",\r\n\t\t\t\t\t\"to\": \"2021-09-21T22:01:15.581Z\"\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n }\r\n}\r\n"
headers = {}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Java Unirest
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("{{BASE_URL}}/v1/customer/fetch-transactions")
.body("{\r\n \"idempotency_ref\": \"et-earum-et\",\r\n \"customer_id\": \"cd989813-9852-40f6-bca7-ea0233d48cb9\",\r\n \"data_request\":{\r\n \"identity\": {\r\n\t\t\t\"include\": true,\r\n\t\t\t\"options\": [\"phone\", \"bvn\", \"nin\"]\r\n\t\t},\r\n\t\t\"transactions\": {\r\n\t\t\t\"include\": true,\r\n\t\t\t\"options\": {\r\n\t\t\t\t\"duration\": {\r\n\t\t\t\t\t\"from\": \"2019-09-21T22:01:15.581Z\",\r\n\t\t\t\t\t\"to\": \"2021-09-21T22:01:15.581Z\"\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n }\r\n}\r\n")
.asString();
Go Native
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "{{BASE_URL}}/v1/customer/fetch-transactions"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"idempotency_ref": "et-earum-et",`+"
"+`
"customer_id": "cd989813-9852-40f6-bca7-ea0233d48cb9",`+"
"+`
"data_request":{`+"
"+`
"identity": {`+"
"+`
"include": true,`+"
"+`
"options": ["phone", "bvn", "nin"]`+"
"+`
},`+"
"+`
"transactions": {`+"
"+`
"include": true,`+"
"+`
"options": {`+"
"+`
"duration": {`+"
"+`
"from": "2019-09-21T22:01:15.581Z",`+"
"+`
"to": "2021-09-21T22:01:15.581Z"`+"
"+`
}`+"
"+`
}`+"
"+`
}`+"
"+`
}`+"
"+`
}`+"
"+`
`)
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))
}
Last modified 9mo ago