Introduction
This documentation aims to provide all the information you need to work with our API.
Base URL
https://api-staging.zanifu.com/
Authenticating requests
Authenticate requests to this API's endpoints by sending 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.
Advance
Agent advance
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/advance"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": 2000
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/advance',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'amount' => 2000,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Agent limit
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/agent-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://api-staging.zanifu.com/api/agent-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:
Authentication
Api for authenticating users.
Validate user credentials
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/login"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"key": "mollitia",
"email": "ut",
"phone": "itaque",
"password": "optio",
"secret": "molestias"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/login',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'key' => 'mollitia',
'email' => 'ut',
'phone' => 'itaque',
'password' => 'optio',
'secret' => 'molestias',
],
]
);
$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://api-staging.zanifu.com/api/sign-up"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"account_type": 6,
"name": "mollitia",
"phone": "excepturi",
"email": "quis"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/sign-up',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'account_type' => 6,
'name' => 'mollitia',
'phone' => 'excepturi',
'email' => 'quis',
],
]
);
$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://api-staging.zanifu.com/api/password-reset"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "et"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/password-reset',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'email' => 'et',
],
]
);
$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://api-staging.zanifu.com/api/reset-password"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "molestiae",
"token": "aut",
"new_password": "sed"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/reset-password',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'email' => 'molestiae',
'token' => 'aut',
'new_password' => 'sed',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Initiate a pin reset
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/pin-reset"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"phone_number": "+254712345678"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/pin-reset',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'phone_number' => '+254712345678',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Reset the pin
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/reset-pin"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"otp": "assumenda",
"phone_number": "et",
"new_pin": "reiciendis"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/reset-pin',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'otp' => 'assumenda',
'phone_number' => 'et',
'new_pin' => 'reiciendis',
],
]
);
$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://api-staging.zanifu.com/api/change-password"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"current_password": "vel",
"new_password": "tenetur"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/change-password',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'current_password' => 'vel',
'new_password' => 'tenetur',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Change the current user pin
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/change-pin"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"current_pin": "velit",
"new_pin": "facilis"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/change-pin',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'current_pin' => 'velit',
'new_pin' => 'facilis',
],
]
);
$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://api-staging.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://api-staging.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://api-staging.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://api-staging.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://api-staging.zanifu.com/api/carts/4"
);
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://api-staging.zanifu.com/api/carts/4',
[
'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://api-staging.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://api-staging.zanifu.com/api/categories',
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"id": 12,
"category_code": 5813,
"name": "Bars and Restaurants"
},
{
"id": 28,
"category_code": 5921,
"name": "Liquor Stores"
},
{
"id": 37,
"category_code": 5412,
"name": "Dukas and Mini-Marts"
},
{
"id": 38,
"category_code": 5413,
"name": "Cooking Gas"
},
{
"id": 19,
"category_code": 5251,
"name": "Hardwares"
},
{
"id": 35,
"category_code": 5411,
"name": "Supermarkets"
},
{
"id": 39,
"category_code": 5414,
"name": "Agrovets"
},
{
"id": 11,
"category_code": 5451,
"name": "Milk and other Dairy Products"
},
{
"id": 14,
"category_code": 5812,
"name": "Restaurants"
},
{
"id": 40,
"category_code": 5415,
"name": "Motorcycle Parts"
},
{
"id": 31,
"category_code": 5732,
"name": "Phones and Electronics"
},
{
"id": 4,
"category_code": 5942,
"name": "Bookshops"
},
{
"id": 41,
"category_code": 5416,
"name": "Chemists and Pharmercists Shop"
},
{
"id": 15,
"category_code": 5065,
"name": "Electricals Shop"
},
{
"id": 3,
"category_code": 5422,
"name": "Butcheries"
},
{
"id": 42,
"category_code": 5417,
"name": "Markets"
},
{
"id": 43,
"category_code": 5418,
"name": "Clothes"
},
{
"id": 44,
"category_code": 5419,
"name": "Carwash"
},
{
"id": 34,
"category_code": 5111,
"name": "Stationery shops"
},
{
"id": 33,
"category_code": 5655,
"name": "Sports Apparel Stores"
},
{
"id": 32,
"category_code": 5074,
"name": "Plumbing and Heating Equipment and Supplies"
},
{
"id": 36,
"category_code": 7692,
"name": "Welding and Repair"
},
{
"id": 30,
"category_code": 5172,
"name": "Petroleum and Petroleum Products"
},
{
"id": 29,
"category_code": 5198,
"name": "Paints, Varnishes, and Supplies"
},
{
"id": 23,
"category_code": 5047,
"name": "Medical, Dental Ophthalmic, Hospital Equipment and Supplies"
},
{
"id": 27,
"category_code": 5013,
"name": "Motor vehicle supplies and new parts"
},
{
"id": 16,
"category_code": 5814,
"name": "Fast Food Restaurants"
},
{
"id": 2,
"category_code": 7230,
"name": "Barber and Beauty Shops"
},
{
"id": 5,
"category_code": 7216,
"name": "Carwash and Dry Cleaners"
},
{
"id": 6,
"category_code": 5169,
"name": "Chemicals and Allied Products"
},
{
"id": 7,
"category_code": 5641,
"name": "Children’s and Infant’s Wear Stores"
},
{
"id": 8,
"category_code": 5993,
"name": "Cigar Stores and suppliers"
},
{
"id": 9,
"category_code": 5139,
"name": "Commercial Footwear"
},
{
"id": 10,
"category_code": 5045,
"name": "Computers, Computer Peripheral Equipment, Software"
},
{
"id": 13,
"category_code": 5912,
"name": "Drug Stores and Pharmacies"
},
{
"id": 26,
"category_code": 5571,
"name": "Motorcycle Dealers"
},
{
"id": 17,
"category_code": 5193,
"name": "Florists’ Supplies, Nursery Stock and Flowers"
},
{
"id": 18,
"category_code": 5950,
"name": "Glassware\/Crystal Stores"
},
{
"id": 20,
"category_code": 7298,
"name": "Health and Beauty Shops"
},
{
"id": 21,
"category_code": 5722,
"name": "Household Appliance Stores"
},
{
"id": 22,
"category_code": 5085,
"name": "Industrial Supplies"
},
{
"id": 1,
"category_code": 5462,
"name": "Bakeries"
},
{
"id": 24,
"category_code": 5137,
"name": "Men’s Women’s and Children’s Uniforms and Commercial Clothing"
},
{
"id": 25,
"category_code": 5399,
"name": "Misc. General Merchandise"
}
]
}
Received response:
Request failed with error:
Checkout Orders
Api for checkout.
Post checkout request
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/checkout"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"payment_method": "hic",
"till": 12345,
"account_number": "+254727123456789",
"phone_number": "+254123456789",
"amount": 4000,
"products": [
{
"id": 10,
"quantity": 10,
"distributor_id": 2
},
{
"id": 10,
"quantity": 10
}
],
"redeem_code": "mollitia"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/checkout',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'payment_method' => 'hic',
'till' => 12345,
'account_number' => '+254727123456789',
'phone_number' => '+254123456789',
'amount' => 4000,
'products' => [
[
'id' => 10,
'quantity' => 10,
'distributor_id' => 2,
],
[
'id' => 10,
'quantity' => 10,
],
],
'redeem_code' => 'mollitia',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Checkout Order
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/checkout/16"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://api-staging.zanifu.com/api/checkout/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:
Comments
Handles comments on the agents application
Stores user comment in the database
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/postcomment"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"comment": "tempore",
"commentid": "aut",
"user": "blanditiis",
"type": "veniam",
"name": "suscipit"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/postcomment',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'comment' => 'tempore',
'commentid' => 'aut',
'user' => 'blanditiis',
'type' => 'veniam',
'name' => 'suscipit',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Returns user comment in the database
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/getcomments"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"commentid": "dicta"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/getcomments',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'commentid' => 'dicta',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Depreciated but used to delete comment from db
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/removecomment"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"commentid": "dolores"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/removecomment',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'commentid' => 'dolores',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Commissions
Commission Balance
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/agent/commissions"
);
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://api-staging.zanifu.com/api/agent/commissions',
[
'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:
Withdraw Commission
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/agent/commissions"
);
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://api-staging.zanifu.com/api/agent/commissions',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$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://api-staging.zanifu.com/api/customers"
);
let params = {
"page[number]": "14",
"page[size]": "6",
"filter[search]": "qui",
};
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://api-staging.zanifu.com/api/customers',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '14',
'page[size]'=> '6',
'filter[search]'=> 'qui',
],
]
);
$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://api-staging.zanifu.com/api/customers/19/transactions"
);
let params = {
"page[number]": "14",
"page[size]": "12",
};
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://api-staging.zanifu.com/api/customers/19/transactions',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '14',
'page[size]'=> '12',
],
]
);
$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://api-staging.zanifu.com/api/customers/13"
);
let params = {
"page[number]": "13",
"page[size]": "1",
"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://api-staging.zanifu.com/api/customers/13',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '13',
'page[size]'=> '1',
'filter[search]'=> 'et',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Agent Customers
requires authentication
Get all customers assigned to an agent
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/agent/customers"
);
let params = {
"page[number]": "13",
"page[size]": "11",
"filter[search]": "debitis",
"filter[status]": "blacklisted",
};
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://api-staging.zanifu.com/api/agent/customers',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '13',
'page[size]'=> '11',
'filter[search]'=> 'debitis',
'filter[status]'=> 'blacklisted',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Geotag
requires authentication
Geotag the customer business
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/customers/geotag/3"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"latitude": 19237143.8785653,
"longitude": 20475407.08857
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://api-staging.zanifu.com/api/customers/geotag/3',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'latitude' => 19237143.8785653,
'longitude' => 20475407.08857,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Discounts
APIs to handle discount codes
Verify if redeem code works
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/redeem/asperiores/verify"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"redeem_code": "et"
}
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api-staging.zanifu.com/api/redeem/asperiores/verify',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'redeem_code' => 'et',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Distributors
List of distributors
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/distributors"
);
let params = {
"filter[category]": "13",
"page[number]": "3",
"page[size]": "18",
"filter[search]": "debitis",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
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://api-staging.zanifu.com/api/distributors',
[
'headers' => [
'Accept' => 'application/json',
],
'query' => [
'filter[category]'=> '13',
'page[number]'=> '3',
'page[size]'=> '18',
'filter[search]'=> 'debitis',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (200):
{
"data": [
{
"distributor_id": 2,
"distributor_name": "Mt Kenya Beer",
"distributor_alias": "E",
"status": 1,
"date_created": "2018-10-18 12:10:13",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254722556306",
"manager_id": 3,
"updated_at": "1970-01-01T00:33:41.000000Z",
"created_at": "2018-10-18T09:10:13.000000Z",
"last_alias": 550,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 0,
"pay_wallet_balance": 0,
"advance_limit": 0
},
{
"distributor_id": 3,
"distributor_name": "Lawrence Duncan Rift Valley",
"distributor_alias": "",
"status": 1,
"date_created": "2018-10-18 12:13:16",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254701897794",
"manager_id": 4,
"updated_at": "1970-01-01T00:33:41.000000Z",
"created_at": "2018-10-18T09:13:16.000000Z",
"last_alias": 159,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 0,
"pay_wallet_balance": 0,
"advance_limit": 0
},
{
"distributor_id": 4,
"distributor_name": "Peanco Limited",
"distributor_alias": "C",
"status": 1,
"date_created": "2018-10-18 12:14:41",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254790147214",
"manager_id": 3,
"updated_at": "1970-01-01T00:33:41.000000Z",
"created_at": "2018-10-18T09:14:41.000000Z",
"last_alias": 527,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 2,
"pay_wallet_balance": 840,
"advance_limit": 1000
},
{
"distributor_id": 5,
"distributor_name": "Erinpet Enterprises",
"distributor_alias": "P",
"status": 1,
"date_created": "2018-10-18 12:15:29",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254721424830",
"manager_id": 3,
"updated_at": "1970-01-01T00:33:41.000000Z",
"created_at": "2018-10-18T09:15:29.000000Z",
"last_alias": 437,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 0,
"pay_wallet_balance": 0,
"advance_limit": 0
},
{
"distributor_id": 6,
"distributor_name": "G K Kamuri",
"distributor_alias": "G",
"status": 1,
"date_created": "2018-10-18 12:16:25",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254726738571",
"manager_id": 3,
"updated_at": "1970-01-01T00:33:41.000000Z",
"created_at": "2018-10-18T09:16:25.000000Z",
"last_alias": 253,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 0,
"pay_wallet_balance": 0,
"advance_limit": 0
},
{
"distributor_id": 7,
"distributor_name": "Aspendos K Limited",
"distributor_alias": "A",
"status": 1,
"date_created": "2018-10-18 12:17:34",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254725080622",
"manager_id": 3,
"updated_at": "1970-01-01T00:33:41.000000Z",
"created_at": "2018-10-18T09:17:34.000000Z",
"last_alias": 317,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 0,
"pay_wallet_balance": 0,
"advance_limit": 0
},
{
"distributor_id": 8,
"distributor_name": "Ibangua Distributors",
"distributor_alias": "U",
"status": 1,
"date_created": "2018-10-18 12:18:08",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254716102372",
"manager_id": 3,
"updated_at": "1970-01-01T00:33:41.000000Z",
"created_at": "2018-10-18T09:18:08.000000Z",
"last_alias": 285,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 0,
"pay_wallet_balance": 0,
"advance_limit": 0
},
{
"distributor_id": 9,
"distributor_name": "Muranga Wholesalers",
"distributor_alias": "R",
"status": 1,
"date_created": "2018-10-18 12:18:53",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254723236591",
"manager_id": 3,
"updated_at": "1970-01-01T00:33:41.000000Z",
"created_at": "2018-10-18T09:18:53.000000Z",
"last_alias": 268,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 0,
"pay_wallet_balance": 0,
"advance_limit": 0
},
{
"distributor_id": 10,
"distributor_name": "Kinginya and Sons",
"distributor_alias": "Y",
"status": 1,
"date_created": "2018-10-18 12:26:49",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254719575653",
"manager_id": 3,
"updated_at": "1970-01-01T00:33:42.000000Z",
"created_at": "2018-10-18T09:26:49.000000Z",
"last_alias": 561,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 0,
"pay_wallet_balance": 0,
"advance_limit": 0
},
{
"distributor_id": 11,
"distributor_name": "D O Stores Eldoret",
"distributor_alias": "D",
"status": 1,
"date_created": "2018-10-18 12:28:56",
"created_by": 25,
"distributor_email": "",
"distributor_phone": "254703777902",
"manager_id": 4,
"updated_at": "1970-01-01T00:33:41.000000Z",
"created_at": "2018-10-18T09:28:56.000000Z",
"last_alias": 1196,
"loan_type": 2,
"region_id": null,
"contact_name": null,
"merchant_type": 5813,
"interest_rate": 0,
"pay_wallet_balance": 0,
"advance_limit": 0
}
],
"links": {
"first": "http:\/\/localhost\/api\/distributors?filter%5Bcategory%5D=13&page%5Bsize%5D=18&filter%5Bsearch%5D=debitis&page%5Bnumber%5D=1",
"last": "http:\/\/localhost\/api\/distributors?filter%5Bcategory%5D=13&page%5Bsize%5D=18&filter%5Bsearch%5D=debitis&page%5Bnumber%5D=23",
"prev": null,
"next": "http:\/\/localhost\/api\/distributors?filter%5Bcategory%5D=13&page%5Bsize%5D=18&filter%5Bsearch%5D=debitis&page%5Bnumber%5D=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 23,
"path": "http:\/\/localhost\/api\/distributors",
"per_page": 10,
"to": 10,
"total": 228
}
}
Received response:
Request failed with error:
Endpoints
Agent/VSM Registration
Register a new agent or VSM
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/agents"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "et",
"phone_number": "quasi",
"distributor_id": 7,
"pin": 18
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/agents',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'name' => 'et',
'phone_number' => 'quasi',
'distributor_id' => 7,
'pin' => 18,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Distributor dashboard
requires authentication
Example request:
const url = new URL(
"https://api-staging.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://api-staging.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://api-staging.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://api-staging.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://api-staging.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://api-staging.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://api-staging.zanifu.com/api/finance/stock-credit"
);
let params = {
"page[number]": "15",
"page[size]": "8",
"filter[start_date]": "2021-06-01",
"filter[end_date]": "2021-06-30",
"filter[search]": "eveniet",
};
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://api-staging.zanifu.com/api/finance/stock-credit',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '15',
'page[size]'=> '8',
'filter[start_date]'=> '2021-06-01',
'filter[end_date]'=> '2021-06-30',
'filter[search]'=> 'eveniet',
],
]
);
$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://api-staging.zanifu.com/api/finance/stock-credit/export"
);
let params = {
"filter[start_date]": "2021-06-01",
"filter[end_date]": "2021-06-30",
"filter[search]": "sapiente",
};
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://api-staging.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]'=> 'sapiente',
],
]
);
$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://api-staging.zanifu.com/api/finance/sales"
);
let params = {
"page[number]": "8",
"page[size]": "8",
"filter[start_date]": "2021-06-01",
"filter[end_date]": "2021-06-30",
"filter[search]": "quia",
};
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://api-staging.zanifu.com/api/finance/sales',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '8',
'page[size]'=> '8',
'filter[start_date]'=> '2021-06-01',
'filter[end_date]'=> '2021-06-30',
'filter[search]'=> 'quia',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
api/whitelist
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/whitelist"
);
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://api-staging.zanifu.com/api/whitelist',
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Create a Loan request from solveIt
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/loan-request"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"dealer_id": "officiis",
"bankName": "aut",
"branchName": "quaerat",
"accountNumber": "rerum",
"accountName": "inventore"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/loan-request',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'dealer_id' => 'officiis',
'bankName' => 'aut',
'branchName' => 'quaerat',
'accountNumber' => 'rerum',
'accountName' => 'inventore',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Check loan status request from solveIt
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/loan-inquiry"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"dealer_id": "temporibus",
"loan_reference": "blanditiis"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/loan-inquiry',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'dealer_id' => 'temporibus',
'loan_reference' => 'blanditiis',
],
]
);
$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://api-staging.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://api-staging.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://api-staging.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://api-staging.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://api-staging.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://api-staging.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:
Get single loan details
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/loans/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://api-staging.zanifu.com/api/loans/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:
Merchants
Api for managing merchants.
Register a new merchant.
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/merchants"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"phone_number": "nulla",
"otp": "aut",
"category_code": "vero"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/merchants',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'phone_number' => 'nulla',
'otp' => 'aut',
'category_code' => 'vero',
],
]
);
$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://api-staging.zanifu.com/api/merchants11"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"merchant_name": "ducimus",
"business_name": "dignissimos",
"email": "est",
"location": "voluptas"
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://api-staging.zanifu.com/api/merchants11',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'merchant_name' => 'ducimus',
'business_name' => 'dignissimos',
'email' => 'est',
'location' => 'voluptas',
],
]
);
$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://api-staging.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://api-staging.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://api-staging.zanifu.com/api/merchants/20/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://api-staging.zanifu.com/api/merchants/20/national-id',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'multipart' => [
[
'name' => 'front',
'contents' => fopen('/tmp/phpAgsgrl', 'r')
],
[
'name' => 'back',
'contents' => fopen('/tmp/phpAokjIk', '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://api-staging.zanifu.com/api/merchants/15/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://api-staging.zanifu.com/api/merchants/15/business-permit',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'multipart' => [
[
'name' => 'business_permit',
'contents' => fopen('/tmp/phpdySyZj', '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://api-staging.zanifu.com/api/merchants/4/mpesa-statement"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('mpesa_statement', document.querySelector('input[name="mpesa_statement"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/merchants/4/mpesa-statement',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'multipart' => [
[
'name' => 'mpesa_statement',
'contents' => fopen('/tmp/phpHUt2Kj', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Orders
List of orders
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/orders"
);
let params = {
"page[number]": "2",
"page[size]": "16",
"filter[start_date]": "2021-06-01",
"filter[end_date]": "2021-06-30`",
"filter[search]": "aliquid",
};
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://api-staging.zanifu.com/api/orders',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '2',
'page[size]'=> '16',
'filter[start_date]'=> '2021-06-01',
'filter[end_date]'=> '2021-06-30`',
'filter[search]'=> 'aliquid',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Update order
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/orders/dolorum"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "eos"
}
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->patch(
'https://api-staging.zanifu.com/api/orders/dolorum',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'status' => 'eos',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Agent Orders
requires authentication
Get all orders assigned to an agent
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/agent/orders"
);
let params = {
"page[number]": "19",
"page[size]": "4",
"filter[search]": "accusantium",
"filter[status]": "Pending",
"filter[due]": "today",
};
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://api-staging.zanifu.com/api/agent/orders',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '19',
'page[size]'=> '4',
'filter[search]'=> 'accusantium',
'filter[status]'=> 'Pending',
'filter[due]'=> 'today',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Agent Orders Due
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/agent/orders-due"
);
let params = {
"page[number]": "11",
"page[size]": "13",
};
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://api-staging.zanifu.com/api/agent/orders-due',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '11',
'page[size]'=> '13',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Agent New Order
requires authentication
Create a new order on behalf of customer
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/agent/orders"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"customer_id": "1245",
"amount": 5000,
"till_number": 12345,
"account_number": "XS234",
"products": [
{
"id": 6,
"quantity": 5
},
{
"id": 6,
"quantity": 5
}
]
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/agent/orders',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'customer_id' => '1245',
'amount' => 5000,
'till_number' => 12345,
'account_number' => 'XS234',
'products' => [
[
'id' => 6,
'quantity' => 5,
],
[
'id' => 6,
'quantity' => 5,
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Agent Order Action
requires authentication
Approve or reject an order
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/agent/orders/0"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"action": "Approve"
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://api-staging.zanifu.com/api/agent/orders/0',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'action' => 'Approve',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
OTP
Generate OTP
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/send-otp"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"phone_number": "impedit"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/send-otp',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'phone_number' => 'impedit',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Verify OTP
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/verify-otp/totam"
);
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://api-staging.zanifu.com/api/verify-otp/totam',
[
'headers' => [
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (422):
{
"message": "OTP code is not valid"
}
Received response:
Request failed with error:
Products
Api for managing products.
List of products
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/products"
);
let params = {
"filter[category]": "4",
"filter[distributor]": "2",
"page[number]": "2",
"page[size]": "11",
"filter[search]": "quis",
};
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://api-staging.zanifu.com/api/products',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'filter[category]'=> '4',
'filter[distributor]'=> '2',
'page[number]'=> '2',
'page[size]'=> '11',
'filter[search]'=> 'quis',
],
]
);
$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://api-staging.zanifu.com/api/products"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"title": "nisi",
"description": "est",
"price": 7,
"distributor_id": 3,
"category_id": 2
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/products',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'title' => 'nisi',
'description' => 'est',
'price' => 7,
'distributor_id' => 3,
'category_id' => 2,
],
]
);
$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://api-staging.zanifu.com/api/products/19"
);
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://api-staging.zanifu.com/api/products/19',
[
'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://api-staging.zanifu.com/api/products/suscipit"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"title": "impedit",
"description": "pariatur",
"price": 14,
"distributor_id": 19,
"category_id": 2
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://api-staging.zanifu.com/api/products/suscipit',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'title' => 'impedit',
'description' => 'pariatur',
'price' => 14,
'distributor_id' => 19,
'category_id' => 2,
],
]
);
$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://api-staging.zanifu.com/api/products/19"
);
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://api-staging.zanifu.com/api/products/19',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
profile
Get user documents
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/documents"
);
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://api-staging.zanifu.com/api/documents',
[
'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:
Download documents
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/documents"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"file_name": "neque"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/documents',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'file_name' => 'neque',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Send invitation message
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/invite-friend"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"phone_number": "eveniet"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/invite-friend',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'phone_number' => 'eveniet',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
SolveIt
Handles SolveIt requests
Create a Loan request from solveIt
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/loan-request"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"dealer_id": "corrupti",
"bankName": "illum",
"branchName": "in",
"accountNumber": "architecto",
"accountName": "eius"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/loan-request',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'dealer_id' => 'corrupti',
'bankName' => 'illum',
'branchName' => 'in',
'accountNumber' => 'architecto',
'accountName' => 'eius',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Check loan status request from solveIt
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/loan-inquiry"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"dealer_id": "dignissimos",
"loan_reference": "aut"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/loan-inquiry',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'dealer_id' => 'dignissimos',
'loan_reference' => 'aut',
],
]
);
$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://api-staging.zanifu.com/api/users"
);
let params = {
"page[number]": "18",
"page[size]": "11",
"filter[search]": "ducimus",
};
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://api-staging.zanifu.com/api/users',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '18',
'page[size]'=> '11',
'filter[search]'=> 'ducimus',
],
]
);
$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://api-staging.zanifu.com/api/users"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"first_name": "quis",
"last_name": "reiciendis",
"email": "distinctio",
"phone_number": "est",
"is_admin": true,
"permissions": "['sales','orders']"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api-staging.zanifu.com/api/users',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'first_name' => 'quis',
'last_name' => 'reiciendis',
'email' => 'distinctio',
'phone_number' => 'est',
'is_admin' => true,
'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://api-staging.zanifu.com/api/users/9"
);
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://api-staging.zanifu.com/api/users/9',
[
'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://api-staging.zanifu.com/api/users/itaque"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"first_name": "minus",
"last_name": "excepturi",
"phone_number": "iusto",
"is_admin": false,
"permissions": "['sales','orders']",
"email": "ullam"
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://api-staging.zanifu.com/api/users/itaque',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'first_name' => 'minus',
'last_name' => 'excepturi',
'phone_number' => 'iusto',
'is_admin' => false,
'permissions' => '[\'sales\',\'orders\']',
'email' => 'ullam',
],
]
);
$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://api-staging.zanifu.com/api/users/2"
);
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://api-staging.zanifu.com/api/users/2',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Wallets
Wallet Balances
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/wallets/balance"
);
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://api-staging.zanifu.com/api/wallets/balance',
[
'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:
List of wallet transactions
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/wallets/transactions"
);
let params = {
"page[number]": "11",
"page[size]": "13",
};
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://api-staging.zanifu.com/api/wallets/transactions',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'query' => [
'page[number]'=> '11',
'page[size]'=> '13',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Withdraw from wallet Example: 200
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/wallets/withdraw"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": 18
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://api-staging.zanifu.com/api/wallets/withdraw',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'amount' => 18,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error:
Pay loan from wallet
requires authentication
Example request:
const url = new URL(
"https://api-staging.zanifu.com/api/wallets/pay-loan"
);
let headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": 200
}
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://api-staging.zanifu.com/api/wallets/pay-loan',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'amount' => 200,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
Received response:
Request failed with error: