\abdulmueid\mpesaConfig

Class Config

Summary

Methods
Properties
Constants
__construct()
loadFromFile()
getPublicKey()
getApiHost()
getApiKey()
getOrigin()
getServiceProviderCode()
getInitiatorIdentifier()
getSecurityCredential()
getBearerToken()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$public_key
$api_host
$api_key
$origin
$service_provider_code
$initiator_identifier
$security_credential
N/A

Properties

$public_key

$public_key : string

Public Key for the M-Pesa API. Used for generating Authorization bearer tokens.

Type

string

$api_host

$api_host : string

Hostname for the API - Use Sandbox or Production hostname

Type

string

$api_key

$api_key : string

API Key for the M-Pesa API. Used for creating authorize trasactions on the API

Type

string

$origin

$origin : string

Origin Header - Used for identifying hostname which is sending transaction requests

Type

string

$service_provider_code

$service_provider_code : string

Service Provider Code - Provided by Vodacom

Type

string

$initiator_identifier

$initiator_identifier : string

Initiator Identifier - Provided by Vodacom

Type

string

$security_credential

$security_credential : string

Security Credential - Provided by Vodacom

Type

string

Methods

__construct()

__construct(string  $public_key, string  $api_host, string  $api_key, string  $origin, string  $service_provider_code, string  $initiator_identifier, string  $security_credential) 

Config constructor.

Parameters

string $public_key
string $api_host
string $api_key
string $origin
string $service_provider_code
string $initiator_identifier
string $security_credential

loadFromFile()

loadFromFile(string  $file_path) : \abdulmueid\mpesa\Config

Loads the configuration from a file and returns a Config instance

Parameters

string $file_path

Returns

\abdulmueid\mpesa\Config

getPublicKey()

getPublicKey() : string

Returns the Public Key

Returns

string

getApiHost()

getApiHost() : string

Returns API Hostname

Returns

string

getApiKey()

getApiKey() : string

Returns the API Key

Returns

string

getOrigin()

getOrigin() : string

Returns the Origin Header

Returns

string

getServiceProviderCode()

getServiceProviderCode() : string

Returns the Service Provider Code

Returns

string

getInitiatorIdentifier()

getInitiatorIdentifier() : string

Returns the Initiator Identifier

Returns

string

getSecurityCredential()

getSecurityCredential() : string

Returns the Security Credential

Returns

string

getBearerToken()

getBearerToken() : string

Encrypts the API key with public key and returns a usable Bearer Token

Returns

string