1.9.0 • Published 5 years ago

jambopay v1.9.0

Weekly downloads
4
License
ISC
Repository
-
Last release
5 years ago

JAMBOPAY SDK FOR NODEJS

This is the unofficial node.js integration module for integration with the Jambopay API

All of the methods called return promises and can therefore be easily chained

INSTALLATION

npm i jambopay

1. GETTING STARTED

 Object.assign( global, { JP: require('jambopay')});

The above makes the {jambopay} module globally available as 'JP' in your project

APP_KEY = "YOUR_JAMBOPAY_ISSUED_APP_KEY";

The above identifies your application to Jambopay


2. SET THE ENDPOINT URL (.set_endpoint_url(remote_host_address))

( Not necessary if using test.jambopay.co.ke [for tests] via VPN )

Example:

 JP.set_endpoint_url( 'http://test.jambopay.co.ke' );

3. LOGIN (.login(parmeters_object,header))

parameters_object = {username,password,grant_type}

Example:

JP.login({ 
            username: req.body.email,
            password: req.body.password,
            grant_type: "agency"
        })
.then(d => {

    d = JSON.parse(d)
    console.log(`Loged in as ${d.firstName} ${d.lastName}`);
    
    //@ All subsequent operations are placed here  

})
.catch(e => {

    //@ Handle the error 

})

This module handles basic authentication re-negotiation with Jambopay so that you don't have to. This fetches an authentication token for use with each request.

HEADERS PARAMETER

The headers parameter is optional but should generally be in the format :

{
    "authorization" : JAMBOPAY_TOKEN, 
    "app_key"       : APP_KEY
}

The above applies for each of the methods that expect a headers parameter.

The JAMBOPAY_TOKEN and APP_KEY parameters are globals provided by this SDK.

APP_KEY refers to your JamboPay issued developer application key and should be set as stipulated in 1 above.


USER METHODS

1. NAIROBI COUNTY COUNCIL PAYMENTS (.ncc)


A). UNIVERSAL BUSINESS PERMIT (.ubp)

Available methods

UBP REGISTRATION


a). .get_sbp_classes({PhoneNumber,ActivityID},headers)

This method gets all the business categories for all businesses as classified by the Nairobi County Government.

The ActivityID (basically a class/category into which the business falls) in the response will be used on the .get_sbp_sub_classes call.

Example:

JP
.ncc
.ubp
.get_sbp_classes({ 
            PhoneNumber : "...",
            ActivityID  : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .get_sbp_sub_classes({PhoneNumber,ID},headers)

The above request gets you the business sub-Classes related to the Activity ID.

The sub-ClassID on the response will be used in the .get_sbp_activity_charges call.

Example:

JP
.ncc
.ubp
.get_sbp_sub_classes({ 
            PhoneNumber : "...",
            ID          : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

c). .get_sbp_activity_charges({PhoneNumber,subclassID},headers)

The ChargeID parameter in the response can be used as a filtering parameter when making subsequent calls

Example:

JP
.ncc
.ubp
.get_sbp_activity_charges({ 
            PhoneNumber : "...",
            subclassID  : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

d). .get_sbp_activity_sub_counties(headers)

This call lists all the sub-counties within Nairobi county. The client chooses this and the subsequent call in order to help determine his/her business’ approximate location.

Example:

JP
.ncc
.ubp
.get_sbp_activity_sub_counties()
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

e). .get_sbp_wards({id},headers)

This call lists all the wards within a given Sub-county in the County.

Example:

JP
.ncc
.ubp
.get_sbp_wards({ 
    id : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

f). .prepare_payment({Year,Names,PhoneNumber,PhonePin,IDNumber,ActivityCode,ActivityName,SBPSubClassID,RelativeSize,WardName,ZoneName,AcceptedTnC,WardCode,ZoneCode,BusinessName,Pin,IDDocumentNumber,BusinessClassificationDetails,PremisesArea,NumberOfEmployees,AnnualSBPAmount,PostalCode,Town,Telephone1,Telephone2,FaxNumber,Email,PhysicalAddress,PlotNumber,Building,BuildingCategory,Floor,RoomStallNumber,ContactPersonName,ContactPersonDesignation,ContactPersonPOBox,ContactPersonPostalCode,ContactPersonTown,ContactPersonTelephone1,ContactPersonTelephone2,PaidBy,ApprovalStatus,PaymentTypeID,SBPPaymentType }, headers)

Acceptable Parameters

ParameterTypeRequiredDescription
BusinessIDString-
YearIntR
TransactionIDString-
NamesStringRIsaac Juma
BillNumberString-
BillStatusString-
PhoneNumberStringR254724659560
PhonePinIntR1234
IDNumberStringR1
ActivityCodeIntR
ActivityNameStringRPainting
SBPSubClassIDIntR1114
RelativeSizeStringR1
WardNameStringR
ZoneNameStringR
AcceptedTnCBooleanR1
WardCodeIntR4
ZoneCodeIntR136
BusinessNameStringRDcyntech
BusinessRegistrationNumberString-
PinStringRJJITYTU767868
VATString-JHJH2323
IDDocumentNumberStringR28734420
BusinessClassificationDetailsStringR1212
OtherBusinessClassificationDetailsString-2121
PremisesAreaStringR121
NumberOfEmployeesIntR121212
AnnualSBPAmountDouble-0
POBoxStringR8782 Nairobi
PostalCodeStringR00100
TownStringRNairobi
Telephone1StringR254717803383
Telephone2StringR254717803383
FaxNumberString-0717803383
EmailStringRijuma@webtribe.com
PhysicalAddressStringRdsfsdfsd
PlotNumberStringR343ffdf
BuildingStringR34634
BuildingCategoryStringRNon-Storey
FloorStringRn\/a
RoomStallNumberStringR12
ContactPersonNameStringRSimiyu Robert
ContactPersonDesignationStringR
ContactPersonPOBoxStringR281 Soy
ContactPersonPostalCodeStringR30105
ContactPersonTownStringR
ContactPersonTelephone1StringR0717803383
ContactPersonTelephone2StringR0717803383
ContactPersonFaxNumberString-3434
PaidByStringRSAMUEL KAHARA
ApprovalStatusInt-0
PaymentTypeIDIntR1
SBPPaymentTypeIntR1
ReceiptNumberString-
LocalReceiptNumberString-
ReferenceNumberString-
BankNameString-
BranchNameString-
Exclusions0.IDString-ChargeID excludedfrom payment
Exclusions1.IDString-ChargeID excluded from payment

|

The transactionID in the response is used to commit the transaction on the .commit_payment call.

Example:

JP
.ncc
.ubp
.prepare_payment({
            Year        : "...",
            Names       : "...",
            PhoneNumber : "...",
            PhonePin    : "...",
            IDNumber    : "...",
            ActivityCode: "...",
            ActivityName: "...",
            SBPSubClassID: "...",
            RelativeSize: "...",
            WardName    : "...",
            ZoneName    : "...",
            AcceptedTnC : "...",WardCode,ZoneCode,BusinessName: "...",
            Pin         : "...",
            IDDocumentNumber: "...",
            BusinessClassificationDetails: "...",
            PremisesArea: "...",
            NumberOfEmployees: "...",
            AnnualSBPAmount: "...",
            PostalCode  : "...",
            Town        : "...",
            Telephone1  : "...",
            Telephone2  : "...",
            FaxNumber   : "...",
            Email       : "...",
            PhysicalAddress: "...",
            PlotNumber  : "...",
            Building    : "...",
            BuildingCategory: "...",
            Floor       : "...",
            RoomStallNumber: "...",
            ContactPersonName: "...",
            ContactPersonDesignation: "...",
            ContactPersonPOBox: "...",
            ContactPersonPostalCode: "...",
            ContactPersonTown: "...",
            ContactPersonTelephone1: "...",
            ContactPersonTelephone2: "...",
            PaidBy      : "...",
            ApprovalStatus: "...",
            PaymentTypeID: "...",
            SBPPaymentType: "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

g). .commit_payment({PhoneNumber,SBPPaymentType,Tendered,TransactionID,PaymentTypeID,PaidBy,PhonePin},headers)

ParameterTypeRequiredDescription
MerchantIDStringRMerchant identifier e.g. NCC
PhoneNumberStringRAgent Phone number
SBPPaymentTypeIntR1
TenderedDoubleRConfirmation amount of the SBP total bill
TransactionIDStringRUnique ID from the POST response.
PaymentTypeIDIntR1
PaidByStringRPerson Paying for the registration
PhonePinStringRPin of the wallet being debited

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.ncc
.ubp
.commit_payment({
            PhoneNumber : "...",
            SBPPaymentType: "...",
            Tendered    : "...",
            TransactionID: "...",
            PaymentTypeID: "...",
            PaidBy      : "...",
            PhonePin    : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

UBP RENEWAL


a). .get_business( {LicenseID,Year,PhoneNumber}, headers )

This call gets the business details for the business as registered using the LicenseID (BusinessID).

The ActivityID provided in the response is to be used in the subsequent calls.

Example:

JP
.ncc
.ubp
.get_business({
    LicenseID       : "...",
    Year            : "...",
    PhoneNumber     : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .get_business_class_id( {ActivityID,PhoneNumber} ,headers )

Gets the business Classes related to the ActivityID.

The ClassID on the response will be used in the subsequent calls.

Example:

JP
.ncc
.ubp
.get_business_class_id({
    ActivityID : "...",
    PhoneNumber: "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

c). .get_business_sub_class_id({ID,PhoneNumber},headers)

The returned SubClassID is used in the .prepare_payment call.

Example:

JP
.ncc
.ubp
.get_business_sub_class_id({
    ID          : "...",
    PhoneNumber : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

d). .prepare_payment({MerchantID,BusinessID,Year,PhoneNumber,PaymentTypeID,SBPSubClassID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
MerchantIDStringRMerchant Identifier
BusinessIDStringRLicense ID
YearIntR2017
PhoneNumberStringRPhoneNumber of the wallet
PaymentTypeIDIntR1
SBPSubClassIDIntRID from the getsbpsubclasses call

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.ncc
.ubp
.prepare_payment({
    MerchantID          : "...",
    BusinessID          : "...",
    Year                : "...",
    PhoneNumber         : "...",
    PaymentTypeID       : "...",
    SBPSubClassID       : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

e). .commit_payment({PhoneNumber,MerchantID,TransactionID,Pin,Year,AcceptedTnC,ContactPersonName,IDDocumentNumber,Telephone1,ZoneCode,WardCode,ZoneName,WardName,PlotNumber},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
PhoneNumberStringRWallet PhoneNumber
MerchantIDStringRMerchant identifier
TransactionIDStringRUnique ID from the POST response
PinStringRWallet Pin
YearIntRYear of business permit renewal
AcceptedTnCBooleanRAccept terms and conditions, e.g. True
ContactPersonNameStringRContact Person
IDDocumentNumberStringRNumber of the ID document
Telephone1StringRTelephone1
BuildingString-
FloorString-Floor
RoomStallNumberString-Room Stall Number
ZoneCodeIntRBusiness location Zone Code
WardCodeIntRBusiness location Ward Code
ZoneNameStringRBusiness location Zone Name
WardNameStringRBusiness location Ward Name
PlotNumberStringRBusiness location Plot Number

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.ncc
.ubp
.commit_payment({
    PhoneNumber         : "...",
    MerchantID          : "...",
    TransactionID       : "...",
    Pin                 : "...",
    Year                : "...",
    AcceptedTnC         : "...",
    ContactPersonName   : "...",
    IDDocumentNumber    : "...",
    Telephone1          : "...",
    ZoneCode            : "...",
    WardCode            : "...",
    ZoneName            : "...",
    WardName            : "...",
    PlotNumber          : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

B). LAND RATES (.land_rates)

Available methods

a). .prepare_payment({PlotNumber,PhoneNumber,PaymentTypeID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
MerchantIDStringRMerchant identifier
PlotNumberStringRPlot number
PhoneNumberStringRCustomers phone number
PaymentTypeIDIntRMode of payment e.g. 1 for cash, etc

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.ncc
.land_rates
.prepare_payment({
    PlotNumber : "...",
    PhoneNumber: "...",
    PaymentTypeID: "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .commit_payment({TransactionID,Amount},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
MerchantIDStringRMerchant identifier
TransactionIDStringRUnique transaction reference number
AmountdecimalRtransaction amount

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.ncc
.land_rates
.commit_payment({
    TransactionID: "...",
    Amount      : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

C). PARKING (.parking)

Available methods

DAILY PARKING


a). .get_daily_parking_items ( headers )

This call pulls the required information to determine the amount to be paid.i.e Vehicle types and Zones.

Example:

JP
.ncc
.parking
.get_daily_parking_items()
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .prepare_payment({MerchantID,IsDaily,PlateNumber,PaymentTypeID,PhoneNumber,ZoneCodeID,ChargeID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
MerchantIDStringRMerchant identifier
IsDailyboolRWhether parking is daily or not e.g true or false
PlateNumberstringRCar registration Number e.g. KDF888W
PaymentTypeIDIntRMode of payment e.g. 1
PhoneNumberstringRCustomer phone number
ZoneCodeIDIntRUnique id describing the parking zone e.g.10
ChargeIDIntRUnique vehicle type ID e.g.10
DurationIDInt0ID describing the parking duration (for non daily instances)

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.ncc
.parking
.prepare_payment({
    MerchantID      : "NCC",
    IsDaily         : true,
    PlateNumber     : "...",
    PaymentTypeID   : "...",
    PhoneNumber     : "...",
    ZoneCodeID      : "...",
    ChargeID        : "...",
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

c). .commit_payment({TransactionID,Amount},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
MerchantIDStringRMerchant identifier
TransactionIDStringRTransaction id
PhoneNumberStringRClient Phone Number
PaidByStringRClient Name
AmountDecimalRAmount paid for parking

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.ncc
.parking
.commit_payment({
    TransactionID: "...",
    Amount      : "...",
    PaidBy      : "...",
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

SEASONAL PARKING


a). .get_seasonal_parking_items ( headers )

This gets initialization data (fees and charges) to determine the amount to be paid. This includes: vehicle type and Parking duration.

Example:

JP
.ncc
.parking
.get_seasonal_parking_items()
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

__

b). .prepare_payment({MerchantID,IsDaily, PlateNumber,PaymentTypeID,PhoneNumber,ZoneCodeID,ChargeID,DurationID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
MerchantIDStringRMerchant identifier
IsDailyBoolRWhether parking is daily or not
PlateNumberStringRCar plate no.
PaymentTypeIDIntRMode of payment
PhoneNumberstringRCustomer phone number
ZoneCodeIDIntRUnique id describing the parking zone
ChargeIDIntRUnique id describing the parking charges
DurationIDIntRUnique id describing the parking duration

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.ncc
.parking
.prepare_payment({
    MerchantID  : "...",
    IsDaily     : "...",
    PlateNumber : "...",
    PaymentTypeID: "...",
    PhoneNumber : "...",
    ZoneCodeID  : "...",
    ChargeID    : "...",
    DurationID  : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

c). .commit_payment({MerchantID,TransactionID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
MerchantIDStringRMerchant identifier
TransactionIDStringRTransaction id

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.ncc
.parking
.commit_payment({
    TransactionID   : "...",
    MerchantID      : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

D). SACCO PARKING (.sacco_parking)

Available methods

a). .get_sacco_parking_items ( headers )

This call pulls the required information to determine the amount to be paid. This include Vehicle types and duration types.

Example:

JP
.ncc
.sacco_parking
.get_sacco_parking_items()
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .prepare_payment({SaccoName,Vehicles: [{VehicleType,Duration,RegistrationNumber}],PaymentTypeID},headers)

Acceptable Parameters

ParameterRequiredTypeDescription
SaccoNameRStringname of sacco
VehiclesArray fields
VehicleTypeRint
DurationRint
RegistrationNumberRstring
PaymentTypeIDRintMode of payment e.g. 1 - cash

|

The transactionID from the response is used in the .commit_payment call.

Example:

let params = {       
            SaccoName : "..." , 
            Vehicles: [ 
                {
                    vehicleType :"...",
                    Duration    :"...",
                    RegistrationNumber:"..."
                } 
            ], 
            PaymentTypeID   :"..." 
        };


JP
.ncc
.sacco_parking
.prepare_payment( 
    params
)
.then(d=>{
    //@ Do something with the response
})  
.catch(e => {
    //@ Handle the error 
});

c). .commit_payment({},headers)

Acceptable Parameters

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

ParameterTypeRequiredDescription
TransactionIDStringR Transaction id

|

Example:

let params = {       
            TransactionID   :"..." 
        };


JP
.ncc
.sacco_parking
.commit_payment( 
    params
)
.then(d=>{
    //@ Do something with the response
})  
.catch(e => {
    //@ Handle the error 
});

D). HOUSE RENT (.house_rent)

Available methods

a). .get_estates ( headers )

This call gets a list of estates with houses and markets that belong to Nairobi County

Example:

JP
.ncc
.house_rent
.get_estates()
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .get_residences ( { ID }, headers ))

This call gets the list of residences within an estate using the EstateID

Example:

JP
.ncc
.house_rent
.get_residences({
    ID          : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

c). .prepare_payment({TransactionID,Names,Amount,Adjustment,Currentbalance,CustomerNames,LastBillMonth,MonthlyOtherCharges,MonthlyRent,OtherArrears,PhysicalAddress,RentArrears},headers)

Acceptable Parameters

OutputTypeDescription
TransactionIDstringUnique transaction reference number
NamesstringTenant names
AmountdecimalAmount to pay
Adjustmentdecimalany adjustment accrued in payment
CurrentbalancedecimalCurrent balance
CustomerNamesstringCustomer names
LastBillMonthDateTimeLast month bill was paid
MonthlyOtherChargesdecimalOther monthly charges
MonthlyRentdecimalMonthly rent
OtherArrearsdecimalOther arrears
PhysicalAddressdecimalPhysical address
RentArrearsdecimalRent arrears
RentDueDateDateTimeRent due date
UHNstringUnique house number

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.ncc
.house_rent
.prepare_payment({
                    TransactionID   : "...",
                    Names           : "...",
                    Amount          : "...",
                    Adjustment      : "...",
                    Currentbalance  : "...",
                    CustomerNames   : "...",
                    LastBillMonth   : "...",
                    MonthlyOtherCharges     : "...",
                    MonthlyRent     : "...",
                    OtherArrears    : "...",
                    PhysicalAddress : "...",
                    RentArrears     : "...",
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

d). .commit_payment({TransactionID,Amount},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
TransactionIDStringRUnique transaction reference number
AmountdecimalRAmount to pay

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.ncc
.house_rent
.commit_payment({
    TransactionID   : "...",
    Amount          : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

D). E-CONSTRUCTION (.e_construction)

Available methods

a). .prepare_payment({InvoiceNumber,PaymentTypeID,PhoneNumber,PaidBy},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
InvoiceNumberstringRinvoice number
PaymentTypeIDintRMode of payment
PhoneNumberstringRThe client's phone number
PaidBystringRThe name of the client

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.ncc
.e_construction
.prepare_payment({
    InvoiceNumber: "...",
    PaymentTypeID: "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .commit_payment({TransactionID,PhoneNumber},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
TransactionIDstringRUnique transaction reference number
PhoneNumberstringRUser phone number

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.ncc
.e_construction
.commit_payment({
    TransactionID   : "...",
   PhoneNumber      : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

E). LIQUOR (.liquor)

Available methods

a). .prepare_payment({ Date,LicenseNumber,PhoneNumber,PaymentTypeID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
DateDateTimeRdate
LicenseNumberStringRLicense number
PhoneNumberStringRCustomer
PaymentTypeIDint?RMode of payment

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.ncc
.liquor
.prepare_payment( Date          : "...",
                LicenseNumber   : "...",
                PhoneNumber     : "...",
                PaymentTypeID   : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .commit_payment({TransactionID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
TransactionIDStringRUnique transaction reference number

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.ncc
.liquor
.commit_payment({
    TransactionID   : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

E). MISCELLANEOUS (.misc)

Available methods

a). .prepare_payment({PhoneNumber,BillNumber,PaymentTypeID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
PhoneNumberstringRCustomer phone number
BillNumberstringRUnique Bill reference number gotten from county
PaymentTypeIDintRMode of payment

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.ncc
.misc
.prepare_payment({
                    PhoneNumber     : "...",
                    BillNumber      : "...",
                    PaymentTypeID   : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .commit_payment({TransactionID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
TransactionIDStringRUnique transaction reference number

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.ncc
.misc
.commit_payment({
    TransactionID   : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

2. NAIROBI WATER PAYMENTS (.nairobi_water)


a). .get_bill({AccountNumber},headers)

This call pulls the applicable charges for Nairobi Water.

Example:

JP
.nairobi_water
.get_bill({
    AccountNumber   : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .prepare_payment({AccountNumber,PhoneNumber,Names,Amount,PaymentTypeID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
AccountNumberStringRNairobi Water customer account number
PhoneNumberStringRUser phone number
NamesStringRCustomer account names
AmountdecimalRTransaction amount
PaymentTypeIDint?RMode of payment

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.nairobi_water
.prepare_payment({
            AccountNumber   : "...",
            PhoneNumber     : "...",
            Names           : "...",
            Amount          : "...",
            PaymentTypeID   : "..."

        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

c). .commit_payment({TransactionID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
TransactionIDStringRUnique transaction reference number

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.nairobi_water
.commit_payment({
            TransactionID   : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

3. NATIONAL HOSPITAL INSURANCE FUND PAYMENTS (.nhif)


a). .prepare_payment({AccountNumber,IsCorporate,PhoneNumber,Amount,PaymentTypeID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
AccountNumberStringRCustomer account number at NHIF i.e. member number
IsCorporateBoolRWhether transaction is corporate or individual, use False
PhoneNumberStringRCustomers phone number
PenaltyDecimalOAmount to pay as penalty.
AmountDecimalRTransaction amount.
PaymentTypeIDIntRMode of payment e.g. 1 for cash, etc

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.nhif
.prepare_payment({
            AccountNumber   : "...",
            IsCorporate     : "...",
            PhoneNumber     : "...",
            Amount          : "...",
            PaymentTypeID   : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .commit_payment({TransactionID,PhoneNumber,Amount},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
TransactionIDStringRUnique transaction reference number
PhoneNumberStringRCustomers phone number
AmountdecimalRTransaction amount

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.nhif
.commit_payment({
            TransactionID   : "...",
            PhoneNumber     : "...",
            Amount          : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

4. KASNEB PAYMENTS (.kasneb)


a). .prepare_payment({PhoneNumber,BillNumber,PaidBy,PaymentTypeID},headers)

Acceptable Parameters

ParameterDescription
PhoneNumberThe phone number of the individual making the payment
BillNumberThe bill number or invoice number to which payment is to be made
PaidByThe names of the individual making the payment
PaymentTypeIDThe type of payment being made. For all agents we request this be defaulted to 1 which stands for cash transactions

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.kasneb
.prepare_payment({
            PhoneNumber : "...",
            BillNumber  : "...",
            PaidBy      : "...",
            PaymentTypeID: "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .commit_payment({PhoneNumber,TransactionID,ExaminationCenterID,Tendered},headers)

Acceptable Parameters

ParameterDescription
PhoneNumberThe phone number of the individual making the payment
TransactionIDThis is the unique identifier for the payment to be processed. This value comes from the previous output from a property with the same name
ExaminationCenterIDNull able parameter. Only applies to payments that have an exam center applied to them.
TenderedThis is an optional parameter denoting the total amount of money given by the client. It is either same to or more than the Amount field and can be used to compute change owed to the client

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.kasneb
.commit_payment({
            TransactionID   : "...",
            PhoneNumber     : "...",
            Tendered        : "...",
            ExaminationCenterID: "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

5. JAMBOPAY WALLET PAYMENTS (.wallet)


a). .prepare_payment({PhoneNumber,Amount,PaymentTypeID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
PhoneNumberstringRUser phone number
AmountdecimalRTransaction amount
PaymentTypeIDIntRMode of payment.e.g. 1 for cash, 2 for cheque, etc

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.wallet
.prepare_payment({
            PhoneNumber   : "...",
            Amount        : "...",
            PaymentTypeID : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .commit_payment({TransactionID,PhoneNumber},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
TransactionIDStringRUnique transaction reference number
PhoneNumberStringRUser phone number

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.wallet
.commit_payment({
            TransactionID   : "...",
            PhoneNumber     : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

6. JAMBOPAY PAYMENT REPORTS (new JP.Reports(reporting_stream [ e.g. parking, saccoparking, rent,nhif,ubp]))


INITIALIZE THE QUERY OBJECT

e.g

For NCC Parking

const ParkingReport = new JP.Reports(`parking`); 

a). .get_transactions({},headers)

Acceptable parameters

ParameterTypeRequiredDescription
PlateNumberstringOId of the business
IndexintOZero based index of the pages of the transactions to return- each page has 30 transactions
TransactionIDstringOUnique transaction reference number
StartDateDateOLeast date to fetch transactions from
EndDateDateOLatest date to fetch transactions
UserIDstringOUnique user id
TransactionStatusbyteOState of the transaction (prepared-0 or completed-1)

|

Sample Usage ( for ncc parking )

ParkingReport
.get_transactions( {})
.then( d => {
    //@ Do something
})
.catch( e => {
    ///@ Handle the error
})

7. KENYA POWER & LIGHTING Co. PAYMENTS (.kplc)


a). .prepare_payment({PhoneNumber,Amount,PaymentTypeID,MeterNumber,MerchantID},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
PhoneNumberstringRUser phone number
AmountdecimalRTransaction amount
PaymentTypeIDIntRMode of payment.e.g. 1 for cash, 2 for cheque, etc
MeterNumberIntRThe client's meter number
MerchantIDIntR'KPLC' in this case

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.kplc
.prepare_payment({
            PhoneNumber   : "...",
            Amount        : "...",
            PaymentTypeID : "...",
            MeterNumber   : "...",
            MerchantID    : "KPLC"
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .commit_payment({TransactionID,PhoneNumber,Tendered,Pin},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
TransactionIDStringRUnique transaction reference number
PhoneNumberStringRUser phone number
TenderedIntRThe amount that has been given by the client
PinStringRThe initiator's access password/PIN

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.kplc
.commit_payment({
            TransactionID   : "...",
            PhoneNumber     : "...",
            Tendered        : "...",
            Pin             : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

8. OFFSTREET PARKING PAYMENTS (new JP.OffStreetParking(bool liveServer = false))


This endpoint requires initialization before it's use. The main purpose for this is to specify whether or not to use the live endpoint.

To initialize the endpoint use

const live_offstreet_parking = new JP.OffStreetParking(true);

or

const test_offstreet_parking = new JP.OffStreetParking();

a). .validate_attendant({PhoneNumber},headers)

This method helps to check the validity of an attendant by their telephone number

Example:

test_offstreet_parking
.validate_attendant({
    PhoneNumber : "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .book_vehicle({PlateNumber,attPhoneNumber},headers)

This method helps to book in a vehicle to the system by the plate number

Example:

test_offstreet_parking
.book_vehicle({
    PlateNumber : "...",
    attPhoneNumber: "..."
})
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})


9. STARTIMES PAYMENTS (.startimes)


a). .prepare_payment({PhoneNumber,Amount,PaymentTypeID,SmartCardCode,CustomerCode},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
PhoneNumberstringRUser phone number
AmountdecimalRTransaction amount
PaymentTypeIDIntRMode of payment.e.g. 1 for cash, 2 for cheque, etc
SmartCardCodeIntRThe client's smartcard number
CustomerCodeIntRThe designated customer code

|

The transactionID from the response is used in the .commit_payment call.

Example:

JP
.startimes
.prepare_payment({
            PhoneNumber   : "...",
            Amount        : "...",
            PaymentTypeID : "...",
            SmartcardCode : "...",
            CustomerCode  : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})

b). .commit_payment({TransactionID,PhoneNumber,Tendered},headers)

Acceptable Parameters

ParameterTypeRequiredDescription
TransactionIDStringRUnique transaction reference number
PhoneNumberStringRUser phone number
TenderedIntRThe amount that has been given by the client

|

The response parameters will contain a valid ReceiptNumber which denotes that the transaction has been successfully commited and completed.

Example:

JP
.startimes
.commit_payment({
            TransactionID   : "...",
            PhoneNumber     : "...",
            Tendered        : "..."
        })
.then(d => {
    
    //@ Do something  

})
.catch(e => {

    //@ Handle the error 

})


GLOBAL METHODS


JP.prepare_payment({},headers)

JP.commit_payment({},headers)

The above methods can be invoked directly for any payment channel (apart from offstreetparking) as long as the relevant payment stream is passed.

Below is a table of the relevant payment streams

TargetStream
E-Constructioneconstruction
House Rentrent
Jambopay Walletwallet
KASNEBkasneb
Kisumu Water & Seweragekiwasco
Kenya Power & Lightingkplc
Land Rateslandrate
Liquorliquor
Miscellaneousmisc
Nairobi Waternairobiwater
NHIFnhif
NCC - OffStreet Parkingoffstreetparking
Parkingparking
Sacco Parkingsaccoparking
Unified Business Permitsbp

|

Below is a table of applicable MerchantID's

TargetMerchantID
Nairobi CountyNCC
Trans Nzoia CountyTNC

An example sacco_parking prepare_payment request

let params = {       
        Stream  :"saccoparking"
        SaccoName : "" , 
        Vehicles: [ 
            {
                vehicleType :"",
                Duration    :"",
                RegistrationNumber:""
            } 
        ], 
        PaymentTypeID   :""            
    };

JP
.prepare_payment( 
    params
)
.then(d=>{
    //@ Do something with the response
})  
.catch(e => {
    //@ Handle the error 
});
1.9.0

5 years ago

1.8.3

5 years ago

1.8.2

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.5.0

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago