Introduction
This documentation aims to provide all the information you need to work with our API.
Base URL
https://development.zanifu.com/Authenticating requests
To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".
All authenticated endpoints are marked with a requires authentication badge in the documentation below.
You can retrieve the token from the response of a valid login.
Authentication
Api for authenticating users.
Validate user credentials
Example request:
const url = new URL(
"https://development.zanifu.com/api/login"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"key": "labore",
"email": "omnis",
"phone": "quia",
"password": "harum",
"secret": "et"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/login',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'key' => 'labore',
'email' => 'omnis',
'phone' => 'quia',
'password' => 'harum',
'secret' => 'et',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Register new distributor
Example request:
const url = new URL(
"https://development.zanifu.com/api/sign-up"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"account_type": 12,
"name": "illum",
"phone": "voluptatibus",
"email": "temporibus"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/sign-up',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'account_type' => 12,
'name' => 'illum',
'phone' => 'voluptatibus',
'email' => 'temporibus',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Initiate a password reset request
Example request:
const url = new URL(
"https://development.zanifu.com/api/password-reset"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "aut"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/password-reset',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'email' => 'aut',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Complete password reset
Example request:
const url = new URL(
"https://development.zanifu.com/api/reset-password"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "dolorum",
"token": "nihil",
"new_password": "rerum"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/reset-password',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'email' => 'dolorum',
'token' => 'nihil',
'new_password' => 'rerum',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Change the current user password
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/change-password"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"current_password": "qui",
"new_password": "et"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/change-password',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'current_password' => 'qui',
'new_password' => 'et',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Log out the distributor.
requires authentication
Remove current distributor token
Example request:
const url = new URL(
"https://development.zanifu.com/api/logout"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/logout',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Cart
List carts
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/carts"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/carts',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Get single cart details
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/carts/3"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/carts/3',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Categories
List of categories
Example request:
const url = new URL(
"https://development.zanifu.com/api/categories"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/categories',
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 1,
"name": "Bakeries"
},
{
"id": 2,
"name": "Barber and Beauty Shops"
},
{
"id": 3,
"name": "Butchery and Meat supplies"
},
{
"id": 4,
"name": "Book Stores"
},
{
"id": 5,
"name": "Carwash and Dry Cleaners"
},
{
"id": 6,
"name": "Chemicals and Allied Products"
},
{
"id": 7,
"name": "Children’s and Infant’s Wear Stores"
},
{
"id": 8,
"name": "Cigar Stores and suppliers"
},
{
"id": 9,
"name": "Commercial Footwear"
},
{
"id": 10,
"name": "Computers, Computer Peripheral Equipment, Software"
},
{
"id": 11,
"name": "Dairy Products Stores"
},
{
"id": 12,
"name": "Drinking Places (Alcoholic Beverages), Bars, Taverns, Cocktail lounges, Nightclubs and Discotheques"
},
{
"id": 13,
"name": "Drug Stores and Pharmacies"
},
{
"id": 14,
"name": "Eating places and Restaurants"
},
{
"id": 15,
"name": "Electrical Parts and Equipment"
},
{
"id": 16,
"name": "Fast Food Restaurants"
},
{
"id": 17,
"name": "Florists’ Supplies, Nursery Stock and Flowers"
},
{
"id": 18,
"name": "Glassware\/Crystal Stores"
},
{
"id": 19,
"name": "Hardware Stores"
},
{
"id": 20,
"name": "Health and Beauty Shops"
},
{
"id": 21,
"name": "Household Appliance Stores"
},
{
"id": 22,
"name": "Industrial Supplies"
},
{
"id": 23,
"name": "Medical, Dental Ophthalmic, Hospital Equipment and Supplies"
},
{
"id": 24,
"name": "Men’s Women’s and Children’s Uniforms and Commercial Clothing"
},
{
"id": 25,
"name": "Misc. General Merchandise"
},
{
"id": 26,
"name": "Motorcycle Dealers"
},
{
"id": 27,
"name": "Motor vehicle supplies and new parts"
},
{
"id": 28,
"name": "Package Stores - Beer, Wine, and Liquor"
},
{
"id": 29,
"name": "Paints, Varnishes, and Supplies"
},
{
"id": 30,
"name": "Petroleum and Petroleum Products"
},
{
"id": 31,
"name": "Phones and Electronic Sales"
},
{
"id": 32,
"name": "Plumbing and Heating Equipment and Supplies"
},
{
"id": 33,
"name": "Sports Apparel Stores"
},
{
"id": 34,
"name": "Stationery, Office Supplies, Printing, and Writing Paper"
},
{
"id": 35,
"name": "Supermarkets"
},
{
"id": 36,
"name": "Welding and Repair"
}
]
}
Received response:
Request failed with error:
Checkout
Get till details
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/tills/6"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/tills/6',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Checkout
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/checkout"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"payment_method": "mpesa",
"till": 12345,
"phone_number": "+254123456789",
"products": [
{
"id": 13,
"quantity": 5
},
{
"id": 13,
"quantity": 5
}
]
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/checkout',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'payment_method' => 'mpesa',
'till' => 12345,
'phone_number' => '+254123456789',
'products' => [
[
'id' => 13,
'quantity' => 5,
],
[
'id' => 13,
'quantity' => 5,
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Customers
Customer summary per region
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/customers"
);
let params = {
"page[number]": "18",
"page[size]": "19",
"filter[search]": "velit",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/customers',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '18',
'page[size]'=> '19',
'filter[search]'=> 'velit',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Customer transactions
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/customers/19/transactions"
);
let params = {
"page[number]": "12",
"page[size]": "18",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/customers/19/transactions',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '12',
'page[size]'=> '18',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Customers in a region
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/customers/1"
);
let params = {
"page[number]": "5",
"page[size]": "18",
"filter[search]": "quam",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/customers/1',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '5',
'page[size]'=> '18',
'filter[search]'=> 'quam',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Endpoints
Distributor dashboard
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/dashboard"
);
let params = {
"filters[period]": "monthly",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/dashboard',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'filters[period]'=> 'monthly',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Sales summary
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/sales"
);
let params = {
"filters[period]": "monthly",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/sales',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'filters[period]'=> 'monthly',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Stock credit summary
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/stock-credit"
);
let params = {
"filters[period]": "monthly",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/stock-credit',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'filters[period]'=> 'monthly',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Stock credit details
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/finance/stock-credit"
);
let params = {
"page[number]": "12",
"page[size]": "18",
"filter[start_date]": "2021-06-01",
"filter[end_date]": "2021-06-30",
"filter[search]": "rerum",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/finance/stock-credit',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '12',
'page[size]'=> '18',
'filter[start_date]'=> '2021-06-01',
'filter[end_date]'=> '2021-06-30',
'filter[search]'=> 'rerum',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Export credit sales
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/finance/stock-credit/export"
);
let params = {
"filter[start_date]": "2021-06-01",
"filter[end_date]": "2021-06-30",
"filter[search]": "illo",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/finance/stock-credit/export',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'filter[start_date]'=> '2021-06-01',
'filter[end_date]'=> '2021-06-30',
'filter[search]'=> 'illo',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Sales details
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/finance/sales"
);
let params = {
"page[number]": "17",
"page[size]": "10",
"filter[start_date]": "2021-06-01",
"filter[end_date]": "2021-06-30",
"filter[search]": "aut",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/finance/sales',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '17',
'page[size]'=> '10',
'filter[start_date]'=> '2021-06-01',
'filter[end_date]'=> '2021-06-30',
'filter[search]'=> 'aut',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
List of orders
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/orders"
);
let params = {
"page[number]": "12",
"page[size]": "6",
"filter[start_date]": "2021-06-01",
"filter[end_date]": "2021-06-30",
"filter[search]": "et",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/orders',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '12',
'page[size]'=> '6',
'filter[start_date]'=> '2021-06-01',
'filter[end_date]'=> '2021-06-30',
'filter[search]'=> 'et',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
api/orders/{order}
Example request:
const url = new URL(
"https://development.zanifu.com/api/orders/et"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PATCH",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->patch(
'https://development.zanifu.com/api/orders/et',
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Loans
All user loans
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/loans"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/loans',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Make Loan Payment
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/loans"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": "2",
"phone_number": "+254123456789"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/loans',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'amount' => '2',
'phone_number' => '+254123456789',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Check loan limit
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/loans/limit"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/loans/limit',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Merchants
Api for managing merchants.
Register a new merchant.
Example request:
const url = new URL(
"https://development.zanifu.com/api/merchants"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"phone_number": "vel",
"pin": "rerum",
"category_id": "explicabo"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/merchants',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'phone_number' => 'vel',
'pin' => 'rerum',
'category_id' => 'explicabo',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Update merchant details.
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/merchants15"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"merchant_name": "omnis",
"business_name": "aut",
"email": "eligendi",
"location": "cupiditate"
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://development.zanifu.com/api/merchants15',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'merchant_name' => 'omnis',
'business_name' => 'aut',
'email' => 'eligendi',
'location' => 'cupiditate',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Get application status.
Example request:
const url = new URL(
"https://development.zanifu.com/api/merchants/6/application"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/merchants/6/application',
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Upload merchant ID
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/merchants/10/national-id"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('front', document.querySelector('input[name="front"]').files[0]);
body.append('back', document.querySelector('input[name="back"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/merchants/10/national-id',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'multipart' => [
[
'name' => 'front',
'contents' => fopen('/tmp/phpBvOiJy', 'r')
],
[
'name' => 'back',
'contents' => fopen('/tmp/phpDYfKgz', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Upload business permit
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/merchants/4/business-permit"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('business_permit', document.querySelector('input[name="business_permit"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/merchants/4/business-permit',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'multipart' => [
[
'name' => 'business_permit',
'contents' => fopen('/tmp/phpRvs76y', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Upload mpesa statement
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/merchants/14/mpesa-statement"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('business_permit', document.querySelector('input[name="business_permit"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/merchants/14/mpesa-statement',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'multipart' => [
[
'name' => 'business_permit',
'contents' => fopen('/tmp/phpaCjTGz', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Upload other files
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/merchants/18/other-documents"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('files[]', document.querySelector('input[name="files[]"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/merchants/18/other-documents',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'multipart' => [
[
'name' => 'files[]',
'contents' => fopen('/tmp/phpRpgAny', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Products
Api for managing products.
List of products
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/products"
);
let params = {
"filter[category]": "4",
"filter[distributor]": "2",
"page[number]": "19",
"page[size]": "20",
"filter[search]": "rerum",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/products',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'filter[category]'=> '4',
'filter[distributor]'=> '2',
'page[number]'=> '19',
'page[size]'=> '20',
'filter[search]'=> 'rerum',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Add a new product
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/products"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"title": "nam",
"description": "fugit",
"price": 11,
"distributor_id": 1,
"category_id": 13
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/products',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'title' => 'nam',
'description' => 'fugit',
'price' => 11,
'distributor_id' => 1,
'category_id' => 13,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Get single product details
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/products/5"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/products/5',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Update a product
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/products/quas"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"title": "sit",
"description": "facere",
"price": 6,
"distributor_id": 3,
"category_id": 4
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://development.zanifu.com/api/products/quas',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'title' => 'sit',
'description' => 'facere',
'price' => 6,
'distributor_id' => 3,
'category_id' => 4,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Delete a product
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/products/16"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://development.zanifu.com/api/products/16',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Users
Api for managing users.
Show all users
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/users"
);
let params = {
"page[number]": "9",
"page[size]": "6",
"filter[search]": "et",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/users',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '9',
'page[size]'=> '6',
'filter[search]'=> 'et',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Create a new user
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/users"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"first_name": "autem",
"last_name": "labore",
"email": "aut",
"phone_number": "adipisci",
"is_admin": false,
"permissions": "['sales','orders']"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://development.zanifu.com/api/users',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'first_name' => 'autem',
'last_name' => 'labore',
'email' => 'aut',
'phone_number' => 'adipisci',
'is_admin' => false,
'permissions' => '[\'sales\',\'orders\']',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Get single user details
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/users/3"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://development.zanifu.com/api/users/3',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Update user details.
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/users/quidem"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"first_name": "aperiam",
"last_name": "delectus",
"phone_number": "consequuntur",
"is_admin": false,
"permissions": "['sales','orders']",
"email": "impedit"
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://development.zanifu.com/api/users/quidem',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'first_name' => 'aperiam',
'last_name' => 'delectus',
'phone_number' => 'consequuntur',
'is_admin' => false,
'permissions' => '[\'sales\',\'orders\']',
'email' => 'impedit',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Deactivate a user
requires authentication
Example request:
const url = new URL(
"https://development.zanifu.com/api/users/17"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://development.zanifu.com/api/users/17',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error: