NAV -image
javascript php

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));

Request      

POST api/advance

Body Parameters

amount  integer optional  
Amount being requested

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."
}

Request      

GET api/agent-limit

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));

Request      

POST api/login

Body Parameters

key  string optional  
This can also be email|phone

email  string optional  
This can also be phone|key

phone  string optional  
This can also be email|key

password  string optional  
This can also be secret

secret  string optional  
This can also be password

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));

Request      

POST api/sign-up

Body Parameters

account_type  integer optional  

name  string optional  
Distributor Name

phone  string optional  
Distributor Phone number

email  string optional  
Distributor Email

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));

Request      

POST api/password-reset

Body Parameters

email  string  
Distributor Email

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));

Request      

POST api/reset-password

Body Parameters

email  string  
Distributor Email

token  string  
Generated token from email

new_password  string  
New password

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));

Request      

POST api/pin-reset

Body Parameters

phone_number  string  
Phone number

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));

Request      

POST api/reset-pin

Body Parameters

otp  string  
Otp sent for the number

phone_number  string  
phone number

new_pin  string  
New user pin

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));

Request      

POST api/change-password

Body Parameters

current_password  string  
Current user password

new_password  string  
New user password

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));

Request      

POST api/change-pin

Body Parameters

current_pin  string  
Current user pin

new_pin  string  
New user pin

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));

Request      

POST api/logout

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."
}

Request      

GET api/carts

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."
}

Request      

GET api/carts/{cart}

URL Parameters

cart  integer  
Cart id

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"
        }
    ]
}

Request      

GET api/categories

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));

Request      

POST api/checkout

Body Parameters

payment_method  string  
Payment Method (zanifu_credit, wallet)

till  integer  
Distributor Till Number

account_number  string optional  
Payer Account Number

phone_number  string optional  
Alternative Phone Number

amount  integer optional  
Amount when without products

products  object[] optional  
Products selected for payment

products[].id  integer  

products[].quantity  integer  

products[].distributor_id  integer optional  

redeem_code  string optional  

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));

Request      

PUT api/checkout/{cart}

URL Parameters

cart  integer  
Pending Cart Id

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));

Request      

POST api/postcomment

Body Parameters

comment  string  

commentid  string  

user  string  

type  string  

name  string  

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));

Request      

POST api/getcomments

Body Parameters

commentid  string  

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));

Request      

POST api/removecomment

Body Parameters

commentid  string  

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."
}

Request      

GET api/agent/commissions

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));

Request      

POST api/agent/commissions

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."
}

Request      

GET api/customers

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[search]  string optional  
Filter by query

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."
}

Request      

GET api/customers/{customer}/transactions

URL Parameters

customer  integer  
Customer ID

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

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."
}

Request      

GET api/customers/{region}

URL Parameters

region  integer  
Region ID

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[search]  string optional  
Filter by query

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."
}

Request      

GET api/agent/customers

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[search]  string optional  
Filter by query

filter[status]  string optional  
Filter by status

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));

Request      

PUT api/customers/geotag/{customer}

URL Parameters

customer  integer  
customer id

Body Parameters

latitude  number  
Latitude

longitude  number  
Longitude

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."
}

Request      

GET api/redeem/{code}/verify

URL Parameters

code  string  

Body Parameters

redeem_code  string  
Redeem Code

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
    }
}

Request      

GET api/distributors

Query Parameters

filter[category]  integer optional  
Filter by category

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[search]  string optional  
Filter by query

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));

Request      

POST api/agents

Body Parameters

name  string  
Agent Name

phone_number  string  
Agent Phone Number

distributor_id  integer  
Agent Assigned Distributor

pin  integer  
Agent log in PIN

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."
}

Request      

GET api/dashboard

Query Parameters

filters[period]  string optional  
Filter by transaction period

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."
}

Request      

GET api/sales

Query Parameters

filters[period]  string optional  
Filter by transaction period

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."
}

Request      

GET api/stock-credit

Query Parameters

filters[period]  string optional  
Filter by transaction period

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."
}

Request      

GET api/finance/stock-credit

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[start_date]  string optional  
date Filter start date

filter[end_date]  string optional  
date Filter end date

filter[search]  string optional  
Filter by query

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."
}

Request      

GET api/finance/stock-credit/export

Query Parameters

filter[start_date]  string optional  
date Filter start date

filter[end_date]  string optional  
date Filter end date

filter[search]  string optional  
Filter by query

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."
}

Request      

GET api/finance/sales

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[start_date]  string optional  
date Filter start date

filter[end_date]  string optional  
date Filter end date

filter[search]  string optional  
Filter by query

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."
}

Request      

GET api/whitelist

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));

Request      

POST api/loan-request

Body Parameters

dealer_id  string  

bankName  string optional  

branchName  string  

accountNumber  string  

accountName  string  

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));

Request      

POST api/loan-inquiry

Body Parameters

dealer_id  required optional  

loan_reference  required optional  

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."
}

Request      

GET api/loans

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));

Request      

POST api/loans

Body Parameters

amount  string  
Amount being paid

phone_number  string optional  
Alternative Phone Number

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."
}

Request      

GET api/loans/limit

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."
}

Request      

GET api/loans/{loan}

URL Parameters

loan  integer  
loan id

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));

Request      

POST api/merchants

Body Parameters

phone_number  string  

otp  string  

category_code  string  

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));

Request      

PUT api/merchants{merchant}

URL Parameters

merchant  integer  

Body Parameters

merchant_name  string  

business_name  string  

email  string  

location  string  

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."
}

Request      

GET api/merchants/{merchant}/application

URL Parameters

merchant  integer  

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));

Request      

POST api/merchants/{merchant}/national-id

URL Parameters

merchant  integer  

Body Parameters

front  file  

back  file  

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));

Request      

POST api/merchants/{merchant}/business-permit

URL Parameters

merchant  integer  

Body Parameters

business_permit  file  

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));

Request      

POST api/merchants/{merchant}/mpesa-statement

URL Parameters

merchant  integer  

Body Parameters

mpesa_statement  file  

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."
}

Request      

GET api/orders

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[start_date]  string optional  
date Filter start date

filter[end_date]  string optional  
date Filter end date

filter[search]  string optional  
Filter by query

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));

Request      

PATCH api/orders/{order}

URL Parameters

order  string  

Body Parameters

status  string  
Order Status

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."
}

Request      

GET api/agent/orders

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[search]  string optional  
Filter by query

filter[status]  string optional  
Filter by agent status

filter[due]  string optional  
Filter by due date

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."
}

Request      

GET api/agent/orders-due

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

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));

Request      

POST api/agent/orders

Body Parameters

customer_id  string  
Customer ID

amount  integer  
Amount to borrow

till_number  integer  
Distributor till number

account_number  string optional  
Customer account number

products  object[] optional  
Products selected for payment

products[].id  integer  

products[].quantity  integer  

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));

Request      

PUT api/agent/orders/{order}

URL Parameters

order  integer optional  
Selected order id

Body Parameters

action  required optional  
string Selected agent action

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));

Request      

POST api/send-otp

Body Parameters

phone_number  string  
Phone Number

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"
}

Request      

GET api/verify-otp/{otp}

URL Parameters

otp  string  
OTP code

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."
}

Request      

GET api/products

Query Parameters

filter[category]  integer optional  
Filter by category

filter[distributor]  integer optional  
Filter by distributor

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[search]  string optional  
Filter by query

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));

Request      

POST api/products

Body Parameters

title  string  
Product Title

description  string optional  
Product description

price  integer  
Product price

distributor_id  integer  
Product distributor

category_id  integer  
Product category

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."
}

Request      

GET api/products/{product}

URL Parameters

product  integer  
Product id

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));

Request      

PUT api/products/{product}

PATCH api/products/{product}

URL Parameters

product  string  

Body Parameters

title  string  
Product Title

description  string optional  
Product description

price  integer  
Product price

distributor_id  integer  
Product distributor

category_id  integer  
Product category

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));

Request      

DELETE api/products/{product}

URL Parameters

product  integer  
product id

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."
}

Request      

GET api/documents

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));

Request      

POST api/documents

Body Parameters

file_name  string  
File Name

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));

Request      

POST api/invite-friend

Body Parameters

phone_number  string  
Phone number

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));

Request      

POST api/loan-request

Body Parameters

dealer_id  string  

bankName  string optional  

branchName  string  

accountNumber  string  

accountName  string  

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));

Request      

POST api/loan-inquiry

Body Parameters

dealer_id  required optional  

loan_reference  required optional  

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."
}

Request      

GET api/users

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a page

filter[search]  string optional  
Filter by query

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));

Request      

POST api/users

Body Parameters

first_name  string  
User's first name

last_name  string  
User's last name

email  string  
User's email

phone_number  string  
User's phone number

is_admin  boolean  
If user is an admin

permissions  array optional  
Permissions for non admin

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."
}

Request      

GET api/users/{user}

URL Parameters

user  integer  
User's id

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));

Request      

PUT api/users/{user}

PATCH api/users/{user}

URL Parameters

user  string  

Body Parameters

first_name  string  
User's first name

last_name  string  
User's last name

phone_number  string  
User's phone number

is_admin  boolean  
If user is an admin

permissions  array optional  
Permissions for non admin

email  string  
User's email

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));

Request      

DELETE api/users/{user}

URL Parameters

user  integer  
user id

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."
}

Request      

GET api/wallets/balance

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."
}

Request      

GET api/wallets/transactions

Query Parameters

page[number]  integer optional  
Page number

page[size]  integer optional  
Number of records on a pag

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));

Request      

PUT api/wallets/withdraw

Body Parameters

amount  integer  
Amount to withdraw

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));

Request      

PUT api/wallets/pay-loan

Body Parameters

amount  integer  
Amount to pay