Vaspro Documentation

Introduction

VasPro Messaging Platform offers Developer solutions to messaging that allow Application to Application communication.

The messaging APIs are agile, fast and very responsive.

Prerequisites

You need to have a VasPro account to integrate all the APIs successfully. You will get an API token from the API tab once you are logged in.

Signup Login

Each API request must include the API Key. APIs are RESTful with the allowed content type as JSON.

Base URL

https://api.vaspro.co.ke

Use this base URL in all your API requests.

Usage example:

API Request:
/v3/BulkSMS/bulk/create
Base URL:
https://api.vaspro.co.ke
Request URL:
https://api.vaspro.co.ke/v3/BulkSMS/bulk/create

Response Structure

The general response structure for all API calls is as below:

  1. code - The code has two values (Success and Error)
  2. statusDescription - It contains a brief description of the processing.
  3. data - The data component is available in some responses and contains the credits spent,success response, correlator(unique system Id).

Types of response codes

  • 420 - Service Configuration Error (Service issues, ie. shortcode is NOT configured)
  • 400 - Bad Request/Resource
  • 404 - Resource is NOT available or Invalid Request
  • 402 - Payment is Required (account balance is low to carry out a transaction)
  • 422 - Validation Error (Missing Required Params)
  • 200 - Request is Successfully Processed.
  • 202 - Duplicated Request

Bulk SMS

POST Send Bulk SMS

API:
/v3/BulkSMS/bulk/create

Send bulk messages to your clients.

Note:
All messages are queued. Message delivery is determined by the capacity of queued messages.
Bulk messages are rate limited to 150 messages per second.

Headers
Content-type
application/json
Body
{
    "apiKey":"api token here",
    "shortCode":"VasPro",
    "origin": "API_INTERFACE",
    "isScheduled": ,
    "scheduleDate ": ,
    "scheduleTime ": ,
    "uniqueId":"12347",
    "enqueue": 1,
    "message": "",
    "contacts":{
        "recipients":"07xxxxxxxx,07xxxxxxx"
    },
    "callbackURL":"http://vaspro.co.ke/dlr"
}
Parameter Description Required
apiKey
string
The user identifier Token YES
shortCode
string
The SenderID that will be used to broadcast the message. By default VasPro is enabled. It is normally 11 characters or below in length YES
isScheduled
integer
Scheduling Flag. The flags are:
1 - schedule
2 - normal delivery
YES
scheduleDate
date
If the scheduled flag is set to 1 then the date must be set
scheduleTime
time
Scheduling Time is Set in Future from current time
callbackURL
string
The Rest JSON Callback to receive delivery reports
contacts
array / list
Contacts to send out the text The Contacts should be in an array list
enqueue
integer
This flag has 2 values to enable the client to queue not not their messages.
1 - Queue
0 - No queueing
YES
message
string
The text message to be sent out to clients YES
uniqueID
string
The unique identifier from the client used to identify the request YES
Example code

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.vaspro.co.ke/v3/BulkSMS/bulk/create",
  "method": "POST",
  "headers": {
    "cache-control": "no-cache",
  },
  "data": "{
        "apiKey": "api token here",
        "shortCode": "VasPro",
        "origin": "API_INTERFACE",
        "isScheduled": ,
        "scheduleDate":
        "scheduleTime": ,
        "uniqueId": "12347",
        "enqueue": 1,
        "message": ""
        "contacts":
            {"recipients": "07xxxxxxxx,07xxxxxxx"},
        "callbackURL": "http://vaspro.co.ke/dlr"
    }"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST Send Transactional SMS

API:
/v3/BulkSMS/api/create

Send transactional messages to your clients. The transactions are

Headers
Content-type
application/json
Body
{
    "apiKey":"api token here",
    "shortCode":"VasPro",
    "recipient":"",
    "enqueue": 1,
    "message": "",
    "callbackURL":"http://vaspro.co.ke/dlr"
}
API Parameter Description Type Required
apiKey The user identifier Token string YES
shortCode The SenderID that will be used to broadcast the message. By default VasPro is enabled. It is normally 11 characters or below in length string YES
recepient One number at a time string YES
callbackURL The Rest JSON Callback to receive delivery reports string
enqueue This flag has 2 values to enable the client to queue not not their messages.
1 - Queue
0 - No queueing
integer YES
message The text message to be sent out to clients string YES
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/BulkSMS/api/create",
    "method": "POST",
    "headers": {
        "cache-control": "no-cache",
    },
    "data": "{
        "apiKey": "api token here",
        "shortCode": "VasPro",
        "recipient": "",
        "enqueue": 1,
        "message": "",
        "callbackURL": "http://vaspro.co.ke/dlr"
    }"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST Send Premium (2-way) SMS

API:
/v3/BulkSMS/premium/create

Send premium SMS to your clients

Headers
Content-type
application/json
Body
{
    "apiKey":"api token here",
    "shortCode":"VasPro",
    "recipient":"",
    "enqueue": 1,
    "message": "",
    "callbackURL":"http://vaspro.co.ke/dlr",
    "link_id": ""
}
API Parameter Description Type Required
apiKey The user identifier Token string YES
shortCode The SenderID that will be used to broadcast the message. By default VasPro is enabled. It is normally 11 characters or below in length string YES
recepient One number at a time string YES
callbackURL The Rest JSON Callback to receive delivery reports string
enqueue This flag has 2 values to enable the client to queue not not their messages.
1 - Queue
0 - No queueing
integer YES
message The text message to be sent out to clients string YES
link_id The unique identifier sent on receiving inbox (shortcode) notifications string YES
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/BulkSMS/premium/create",
    "method": "POST",
    "headers": {
    "cache-control": "no-cache",
    },
    "data": {
        "apiKey": "api token here",
        "shortCode": "VasPro",
        "recipient": "",
        "enqueue": 1,
        "message": "",
        "callbackURL": "http://vaspro.co.ke/dlr",
        "link_id": ""
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST Send Nested SMS

API:
/v3/BulkSMS/bulk/nested

Send multiple SMS with different content to different clients.

Note:
All messages are queued. Message delivery is determined by the capacity of queued messages.
Bulk messages are rate limited to 150 messages per second.

Headers
Content-type
application/json
Body
{
    "apiKey":"api token here",
    "shortCode":"VasPro",
    "messageData":[
            { "recepient": "07xxxxxxxx", "message": "", "uniqueId": ""},
            ...
    ],
    "enqueue": 1,
    "message": "",
    "callbackURL":"http://vaspro.co.ke/dlr",
    "link_id": ""
}
API Parameter Description Type Required
apiKey The user identifier Token string YES
shortCode The SenderID that will be used to broadcast the message. By default VasPro is enabled. It is normally 11 characters or below in length string YES
messageData Nested Message data containing the following fields:
message - text message
recipient - the mobile receiving the message
uniqueId - required
string YES
callbackURL The Rest JSON Callback to receive delivery reports string
enqueue This flag has 2 values to enable the client to queue not not their messages.
1 - Queue
0 - No queueing
integer YES
uniqueId The unique identifier from the client used to identify the request string YES
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/BulkSMS/bulk/nested",
    "method": "GET",
    "headers": {
        "cache-control": "no-cache",
    },
    "data": {
        "apiKey": "api token here"
        "shortCode": "VasPro",
        "messageData":[
            { "recepient": "07xxxxxxxx", "message": "", "uniqueId": ""},
            ...
        ],
        "enqueue": 1,
        "message": "",
        "callbackURL": "http://vaspro.co.ke/dlr",
        "uniqueId": ""
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Premium SMS

POST Initiate Subscription

API:
/subscription/v3/manage

This Method allows the CP(Content Provider) to initiate the subscription Management Interface that initiates a ussd optin interface for the clients.

Headers
Content-type
application/json
Body
{
    "token":"api token here",
    "msisdn": "2547xxxxxxxx",
    "product_id": 12345
}
API Parameter Description Type Required
token Authentication Key identifying the client request string YES
msisdn Mobile that is subscribing to the premium service string YES
product_id The service unique identifier integer YES
Example code

var settings = {
    "url": "https://api.vaspro.co.ke/subscription/v3/manage",
    "method": "POST",
    "processData": false,
    "headers": {
        "cache-control": "no-cache",
    },
    "data": {
        "token":"api token here",
        "msisdn": "2547xxxxxxxx",
        "product_id": 12345
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST View Subscription Data

API:
/subscription/sms/v3/fetch/products

This Api allows CPs to fetch subscription data from Vaspro Sms Gateway

Headers
Content-type
application/json
Body
{
    "token":"api token here",
    "service_name": "",
    "short_code": ""
    "stop_keyword": "STOP123456",
    "mt_cost": 10.00,
    "product_id": 123456,
    "limit": 1,
    "offset": 1
}
API Parameter Description Type Required
token Authentication Key identifying the client request string YES
service_name The product service name string
short_code A filter value to get data from specified shortcode string YES
mt_cost The value to filter the cost for each product string
limit Number of data to return integer
offset Filter value to filter the results from specified offset integer
product_id The service unique identifier integer
Example code

var settings = {
    "url": "https://api.vaspro.co.ke/subscription/v3/manage",
    "method": "POST",
    "processData": false,
    "headers": {
        "cache-control": "no-cache",
    },
    "data": {
        "token":"api token here",
        "service_name": "",
        "short_code": ""
        "stop_keyword": "STOP123456",
        "mt_cost": 10.00,
        "product_id": 123456,
        "limit": 1,
        "offset": 1
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST Create Subscription Message

API:
/subscription/sms/v3/create/broadcast

This API allows the user to create bulk MT messages to be sent out only to the subscribers

Headers
Content-type
application/json
Body
{
    "token":"api token here",
    "message": "",
    "product_id": "",
    "campaign_name": ""
    "origin": "",
    "unique_id": 10.00,
    "is_scheduled": 1,
    "scheduled_date": "",
    "scheduled_time": "",
    "number_of_retries": 1,
    "callback_url"; ""
}
API Parameter Description Type Required
token Authentication Key identifying the client request string YES
message The content to be broadcasted to the consumer string YES
product_id Its a filter value representing the product that the clients wants to send a broadcast communication string YES
campaign_name The name of the broadcast campaign to be sent out double YES
origin The Values required are:
1. API_MT
integer
offset Filter value to filter the results from specified offset integer
product_id The service unique identifier integer
Example code

var settings = {
    "url": "https://api.vaspro.co.ke/subscription/v3/manage",
    "method": "POST",
    "processData": false,
    "headers": {
        "cache-control": "no-cache",
    },
    "data": {
        "token":"api token here",
        "service_name": "",
        "short_code": ""
        "stop_keyword": "STOP123456",
        "mt_cost": 10.00,
        "product_id": 123456,
        "limit": 1,
        "offset": 1
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST Delete Subscriber

API:
/subscription/sms/v3/delete/sub

This allows you to delete the subscriber via the API

Body
{
    "token":"api token here",
    "msisdn": "2547xxxxxxxx",
    "product_id": 12345
}
API Parameter Description Type Required
token Authentication Key identifying the client request string YES
msisdn Mobile number that is subscribed to the premium service string YES
product_id The service unique identifier integer YES
Example code

var settings = {
    "url": "https://api.vaspro.co.ke/subscription/v3/manage",
    "method": "POST",
    "processData": false,
    "data": {
        "token":"api token here",
        "msisdn": "2547xxxxxxxx",
        "product_id": 12345
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Receive Subscription Data

This is the profile information in regards to subscribers of a particular service that will be sent to the Content Providers (CP). The Subscription profile is sent to the CPs in realtime one the callback(clients) provided.

API Parameter Description Type
token Authentication Key identifying the client request string
msisdn Mobile that is subscribing to the premium service string
product_id The service unique identifier integer
campaign_id The campaign Identifier is created on subscription. It represents the message that was sent. string
unique_id The Unique Identifier from third party to uniquely identify a client request string
service_name The product service name string
start_keyword The word that the subscriber used to be subscribed string
stop_keyword The word that the subscriber used to be unsubscribed string
service_name The product service name string
date Date the the user was subscribed/Unsubscribed string
Response Data

{
    "token": "xxxx",
    "service_name": "Ufundi Subscription",
    "start_keyword": "START123456"
    "stop_keyword": "STOP123456",
    "msisdn": 2547xxxxxxxxx,
    "product_id": 123456,
    "campaign_id": "xxx",
    "unique_id": "xxx",
    "date": 20191231T12:00:00
}

View Delivery Report

The delivery reports can be sent to the customer if the callback provided is correct when sending the broadcast message.

API Parameter Description Type
recepient Mobile Number of the subscriber string
correlator The content to be broadcasted to the consumer. string
timestamp The time the request is received date
productId This is a filter value representing the product that the clients wants to send a broadcast communication. string
campaignId The unique identifier sent after the create subscription message api has been invoked. string
uniqueId The unique Identifier from third party to uniquely that was used to identify a client request. string (250)
referenceId The MNO reference Number. string
billing_type The billing type:
1. AIRTIME_BILLING
2. MPESA BILLING
string
deliveryState The status code string
deliveryStatus The description of the delivery report received:-
Success reports are:-
  1. DeliveredToNetwork
  2. DeliveredToTerminal
Failed Reports are:-
  • UserNotSubscribed
  • InsufficientFunds
  • MessageStatusIsOverdue
  • NotSFCUser
  • UserNotExist
  • Invalid_Linkid
  • UserInBlacklist
  • DeliveryImpossible
  • DeliveryUncertain
  • UnknownSubscriber
  • DeliveryFailure
  • UserAbnormalState
  • TeleserviceNotProvisioned
  • DeliveryNotificationNotSupported
  • QueueAuthorisationError
  • InternalServerError
  • UnknownServerError
string
Response Data

{
    "recepient": "2547xxxxxxxxx",
    "correlator": "xxx",
    "timestamp": 20191231T12:00:00
    "productId": "xxx",
    "campaignId": "xxx",
    "uniqueId": "xxx",
    "referenceId": "xxx",
    "billing_type": "xxx",
    "deliveryState": "xxxxx",
    "deliveryStatus": "xxxxx"
}

Contacts

GET View Contact Groups

API:
/v3/contact/api/groups

You can use contact API to view contact groups, add contact to contact group, edit contacts and view contact. To begin using it you need to enable all permission for contacts services on Vaspro Portal.

Body
{
    "apiKey": "api token here",
    "unique_id": 123,
    "limit": 123"
}
API Parameter Description Type Required
apiKey The user identifier Token string YES
unique_id Unique identifier for each request you make integer
phoneNumber Contact to send out the MPESA push prompt string YES
limit Number of records to limit. By default it will limit 10 records integer
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/contact/api/groups",
    "method": "POST",
    "processData": false,
    "data": {
        "apiKey":"KEY",
        "unique_id": "",
        "limit": 123
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

GET Add Contacts

API:
/v3/contact/api/add

Add contacts in a contact group

Body
{
    "apiKey":"api token here",
    "msisdn": "2547xxxxxxxx",
    "contact_groupId": 1234,
    "unique_id": 123456,
    "custom_field1": "",
    "custom_field2": "",
    "custom_field3": "",
    "custom_field4": "",
    "custom_field5": "",
    "custom_tag": ""
}
API Parameter Description Type Required
apiKey The user identifier Token string YES
msisdn Contacts to add to the contact group string YES
contact_groupId Refers to the contact group id from Contact group API doc integer YES
unique_id The contact unique ID that you generate. integer YES
custom_field1 Custom field also refer to full_name string
custom_field2 Custom field also refer to full_name string
custom_field3 Custom field also refer to full_name string
custom_field4 Custom field also refer to full_name string
custom_field5 Custom field also refer to full_name string
custom_tag Custom tags for your contact string
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/contact/api/add",
    "method": "POST",
    "processData": false,
    "data": {
        "apiKey":"api token here",
        "msisdn": "2547xxxxxxxx",
        "contact_groupId": 1234,
        "unique_id": 123456,
        "custom_field1": "",
        "custom_field2": "",
        "custom_field3": "",
        "custom_field4": "",
        "custom_field5": "",
        "custom_tag": ""
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST Edit Contacts

API:
/v3/contact/api/edit

Edit contacts in a contact group

Body
{
    "apiKey":"api token here",
    "msisdn": "2547xxxxxxxx",
    "contact_groupId": 1234,
    "contact_id": 1234,
    "unique_id": 123456,
    "custom_field1": "",
    "custom_field2": "",
    "custom_field3": "",
    "custom_field4": "",
    "custom_field5": "",
    "custom_tag": ""
}
API Parameter Description Type Required
apiKey The user identifier Token string YES
msisdn Contacts to add to the contact group string YES
contact_id Contact Id of the contact wish to update integer YES
unique_id The contact unique ID that you generate. integer YES
contact_groupId Refers to the contact group id from Contact group API doc integer YES
custom_field1 Custom field also refer to full_name string
custom_field2 Custom field also refer to full_name string
custom_field3 Custom field also refer to full_name string
custom_field4 Custom field also refer to full_name string
custom_field5 Custom field also refer to full_name string
custom_tag Custom tags for your contact string
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/contact/api/add",
    "method": "POST",
    "processData": false,
    "data": {
        "apiKey":"api token here",
        "msisdn": "2547xxxxxxxx",
        "contact_groupId": 1234,
        "unique_id": 123456,
        "custom_field1": "",
        "custom_field2": "",
        "custom_field3": "",
        "custom_field4": "",
        "custom_field5": "",
        "custom_tag": ""
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Payments

POST Initiate MPESA SDK Push

API:
/v3/checkout/mpesa

Initiate the MPESA SDK Push to process payments quickly and conveniently.

To be able use SDK Push API you first need to aggregate your MPESA Paybill or Till number to VasPro portal. To Aggregate your paybill/till, login on the VasPro Portal, go to the Payments tab, then click on Aggregate Paybill button

Headers
Content-type
application/json
Body
{
    "apiKey":"api token here",
    "amount":"100",
    "phoneNumber": "07xxxxxxxx",
    "callbackURL": "url here",
    "paybillNumber": "789789",
    "transactionDesc": "Payment for xyz"
}
API Parameter Description Type Required
apiKey The user identifier Token string YES
amount The Amount should be in numeric form integer YES
phoneNumber Contact to send out the MPESA push prompt string YES
callbackURL The Rest JSON Callback to receive delivery reports string
paybillNumber Paybill number to initiate the MPESA SDK push string YES
transactionDesc Description of the transaction string
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/checkout/mpesa",
    "method": "POST",
    "processData": false,
    "headers": {
        "cache-control": "no-cache",
    },
    "data": {
        "apiKey":"KEY",
        "amount":"AMOUNT",
        "callBackURL":"",
        "phoneNumber":"PHONE NUMBER",
        "paybillNumber":"PAYBILL/TILL",
        "transactionDesc":""
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

USSD

Receive USSD Requests

This API enables you to receive all USSD requests for your application to your callback URL. You only need to give us your callback

API Parameter Description Type
msisdn The mobile number string
tokenKey The token key can be sent on request string
sessionID The MNO Session ID string
expiryPeriod The time taken for the USSD to expire
Usually expires in < 180 Seconds
string
input The message received from user dialing string
accessPoint Access Point or Ussd Code
Format e.g. *664*1114#
Requirements
  1. User to provide url to receive request and also respond appropriately as illustrated above.
  2. USSD Code for interaction is required.
  3. User application has to respond before the Expiry Period is over
  4. All menu responses should below under 1 second(s) to avoid timeouts and cater for network latency.
Expected Response From Client:

Success HTTP Status Code: 200

The Response expected should be in a string format. As below:

  1. Continuing with the session:
    CON Select a option to proceed
    Continue
    Exit
  2. Ending the USSD Sessions
    To end the session the invoker has to start with the word end and accompanying text to be displayed

    Example:
    END Thank You for interacting with the menu
Response Data

{
    "tokenKey":"api token here",
    "msisdn": 0712345678,
    "sessionID": "xxxx",
    "expiryPeriod": "20190101",
    "input": "2",
    "accessPoint": "*664*1114#"
}

Rewards

POST View Rewards

API:
/v3/rewards/view/transaction

Utilities API allows you purchase airtime, bundles, prepaid tokens, pay postpaid electricity and view all transaction. To be able to use Utilities API, you will first need to enable all permission for Rewards Management.

Headers
Content-type
application/json
Body
{
    "apiKey":"api token here",
    "enqueue": 1,
    "unique_id": ""
}
API Parameter Description Type Required
apiKey The user identifier Token string YES
enqueue It is required and should always be set to 1 integer YES
unique_id Unique Id for each request you make string YES
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/rewards/view/transaction",
    "method": "POST",
    "processData": false,
    "headers": {
        "cache-control": "no-cache",
    },
    "data": {
        "apiKey":"api token here",
        "enqueue": 1,
        "unique_id": ""
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST Bulk Rewards Disbursement

API:
/v3/rewards/bulk

Pay utilities in bulk mode

Body
{
    "apiKey":"api token here",
    "enqueue": 1,
    "unique_id": "",
    "utilityID": 4,
    "payload": [
        {
            "phone": 2547xxxxxxxx,
            "account": "meter number, account id, etc",
            "uniqueId": "xxx",
            "amount": 123
        },
        {...}
    ]
            ,
}
API Parameter Description Type Required
apiKey The user identifier Token string YES
enqueue It is required and should always be set to 1 integer YES
unique_id Unique Id for each request you make string YES
utilityID Utility ID
4 is for Airtime,
5 Mobile Data Bundles (Available on request)
6 KPLC Pre-paid Tokens
7 KPLC Post-paid Tokens (Unavailable)
string YES
payLoad It is an array object that consist of id, phone, account, and amount array of objects YES
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/rewards/bulk",
    "method": "POST",
    "processData": false,
    "data": {
        "apiKey":"api token here",
        "enqueue": 1,
        "unique_id": "",
        "utilityID": 4,
        "payload": [
            {
                "phone": 2547xxxxxxxx,
                "account": "meter number, account id, etc",
                "uniqueId": "xxx",
                "amount": 123
            },
        ]
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST Send Airtime

API:
/v3/rewards/airtime

This is a dedicated API to send airtime to your clients

Headers
Content-type
application/json
Body
{
    "apiKey": "xxx",
    "unique_id": "Vaspro_test29803314",
    "amount": "5",
    "msisdn": "254704050143",
}
API Parameter Description Type Required
apiKey The user identifier token string YES
unique_id The unique identifier for the request string YES
amount The value to disburse to the customer integer YES
msisdn The receiver of the reward string YES
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/rewards/airtime",
    "method": "POST",
    "processData": false,
    "headers": {
        "cache-control": "no-cache",
    },
    "data": {
        "apiKey": "xxx",
        "unique_id": "Vaspro_test29803314",
        "amount": "5",
        "msisdn": "254704050143",
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

POST Send Electricity Token (KPLC Pre/Postpaid)

API:
/v3/rewards/electricity

This is a dedicated API to send electricity tokens or pay for KPLC meter

Headers
Content-type
application/json
Body
{
    "apiKey": "xxx",
    "unique_id": "Vaspro_test29803314",
    "amount": "5",
    "msisdn": "2547xxxxxxx",
    "account_type": "1",
    "bill_reference": "Meter number",
    "callback": "client's callback url to get results after processing"
}
API Parameter Description Type Required
apiKey The user identifier token string YES
unique_id The unique identifier for the request string YES
amount The value to disburse to the customer integer YES
msisdn The phone number of the client to receive confirmation message string YES
account_type Refers to the type of electricity account to use:
1 - Prepaid
2 - Postpaid (Unavailable)
integer YES
bill_reference The meter number of the account string YES
callback The client's callback url to get results after processing string
Example code

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.vaspro.co.ke/v3/rewards/electricity",
    "method": "POST",
    "processData": false,
    "headers": {
        "cache-control": "no-cache",
    },
    "data": {
        "apiKey": "xxx",
        "unique_id": "Vaspro_test29803314",
        "amount": "5",
        "msisdn": "2547xxxxxxx",
        "account_type": "1",
        "bill_reference": "Meter number",
        "callback": "client's callback url to get results after processing"
    }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});