class Collection extends Product (View source)

Collection service/product.

Constants

PRODUCT

Product.

Properties

protected Repository $config Configuration. from  Product
protected ClientInterface $client

HTTP client.

from  Product
protected string $baseUri

Base URI.

from  Product
protected string $tokenUri

Token URI.

from  Product
protected string $subscriptionKey

Subscription key.

from  Product
protected string $clientId

Client ID.

from  Product
protected string $clientSecret

Client secret.

from  Product
protected string $clientCallbackUri

Client callback URI.

from  Product
protected string $currency Currency. from  Product
protected string $environment Environment. from  Product
protected string $partyIdType

Party ID type.

from  Product
protected string $logFile

Log file.

from  Product
protected string $transactionUri

Transact URI.

protected string $transactionStatusUri

Transaction status URI.

protected string $accountStatusUri

Account status URI.

protected string $accountBalanceUri

Account balance URI.

protected string $accountHolderInfoUri

Account holder basic info URI.

Methods

ClientInterface
getClient()

No description

from  Product
setClient(ClientInterface $client)

No description

from  Product
string
getBaseUri()

No description

from  Product
setBaseUri(string $baseUri)

No description

from  Product
string
getTokenUri()

No description

from  Product
setTokenUri(string $tokenUri)

No description

from  Product
string
getSubscriptionKey()

No description

from  Product
setSubscriptionKey(string $subscriptionKey)

No description

from  Product
string
getClientId()

No description

from  Product
setClientId(string $clientId)

No description

from  Product
string
getClientSecret()

No description

from  Product
setClientSecret(string $clientSecret)

No description

from  Product
string
getClientCallbackUri()

No description

from  Product
setClientCallbackUri(string $clientCallbackUri)

No description

from  Product
string
getCurrency()

No description

from  Product
setCurrency(string $currency)

No description

from  Product
string
getEnvironment()

No description

from  Product
setEnvironment(string $environment)

No description

from  Product
string
getPartyIdType()

No description

from  Product
setPartyIdType(string $partyIdType)

No description

from  Product
string
getLogFile()

No description

from  Product
setLogFile(string $logFile)

No description

from  Product
__construct(array $headers = [], array $middleware = [], ClientInterface $client = null)

Constructor.

array
getToken()

Request collections access token.

OAuth2Middleware
getAuthBroker(array $headers)

Get authentication broker.

from  Product
string
getTransactionUri()

No description

setTransactionUri(string $transactionUri)

No description

string
getTransactionStatusUri()

No description

setTransactionStatusUri(string $transactionStatusUri)

No description

string
getAccountStatusUri()

No description

setAccountStatusUri(string $accountStatusUri)

No description

string
getAppAccountBalanceUri()

No description

setAppAccountBalanceUri(string $accountBalanceUri)

No description

string
getAccountHolderInfoUri()

No description

setAccountHolderInfoUri(string $accountHolderInfoUri)

No description

string
requestToPay(string $transactionId, string $partyId, int $amount, string $payerMessage = '', string $payeeNote = '')

Request payee to pay.

array
getTransactionStatus(string $momoTransactionId)

Get transaction status.

array
getAccountBalance()

Get account balance.

bool
isActive(string $partyId, string $partyIdType = null)

Determine if an account holder is registered and active.

array
getAccountHolderBasicInfo(string $partyId)

Get basic info of an account holder.

Details

ClientInterface getClient()

No description

Return Value

ClientInterface

setClient(ClientInterface $client)

No description

Parameters

ClientInterface $client

string getBaseUri()

No description

Return Value

string

setBaseUri(string $baseUri)

No description

Parameters

string $baseUri

string getTokenUri()

No description

Return Value

string

setTokenUri(string $tokenUri)

No description

Parameters

string $tokenUri

string getSubscriptionKey()

No description

Return Value

string

setSubscriptionKey(string $subscriptionKey)

No description

Parameters

string $subscriptionKey

string getClientId()

No description

Return Value

string

setClientId(string $clientId)

No description

Parameters

string $clientId

string getClientSecret()

No description

Return Value

string

setClientSecret(string $clientSecret)

No description

Parameters

string $clientSecret

string getClientCallbackUri()

No description

Return Value

string

setClientCallbackUri(string $clientCallbackUri)

No description

Parameters

string $clientCallbackUri

string getCurrency()

No description

Return Value

string

setCurrency(string $currency)

No description

Parameters

string $currency

string getEnvironment()

No description

Return Value

string

setEnvironment(string $environment)

No description

Parameters

string $environment

string getPartyIdType()

No description

Return Value

string

setPartyIdType(string $partyIdType)

No description

Parameters

string $partyIdType

string getLogFile()

No description

Return Value

string

setLogFile(string $logFile)

No description

Parameters

string $logFile

__construct(array $headers = [], array $middleware = [], ClientInterface $client = null)

Constructor.

Parameters

array $headers
array $middleware
ClientInterface $client

Exceptions

Exception

array getToken()

Request collections access token.

Return Value

array

Exceptions

CollectionRequestException
GuzzleException

See also

https://momodeveloper.mtn.com/docs/services/collection/operations/token-POST Documentation

protected OAuth2Middleware getAuthBroker(array $headers)

Get authentication broker.

Parameters

array $headers

HTTP request headers

Return Value

OAuth2Middleware

Exceptions

Exception

string getTransactionUri()

No description

Return Value

string

setTransactionUri(string $transactionUri)

No description

Parameters

string $transactionUri

string getTransactionStatusUri()

No description

Return Value

string

setTransactionStatusUri(string $transactionStatusUri)

No description

Parameters

string $transactionStatusUri

string getAccountStatusUri()

No description

Return Value

string

setAccountStatusUri(string $accountStatusUri)

No description

Parameters

string $accountStatusUri

string getAppAccountBalanceUri()

No description

Return Value

string

setAppAccountBalanceUri(string $accountBalanceUri)

No description

Parameters

string $accountBalanceUri

string getAccountHolderInfoUri()

No description

Return Value

string

setAccountHolderInfoUri(string $accountHolderInfoUri)

No description

Parameters

string $accountHolderInfoUri

string requestToPay(string $transactionId, string $partyId, int $amount, string $payerMessage = '', string $payeeNote = '')

Request payee to pay.

Parameters

string $transactionId

Your transaction reference ID, Say: order number.

string $partyId

Account holder. Usually phone number if type is MSISDN.

int $amount

How much to debit the payer.

string $payerMessage

Payer transaction history message.

string $payeeNote

Payee transaction history message.

Return Value

string

Auto generated payment reference. Format: UUID

Exceptions

CollectionRequestException
GuzzleException
Exception

See also

https://momodeveloper.mtn.com/docs/services/collection/operations/requesttopay-POST Documentation

array getTransactionStatus(string $momoTransactionId)

Get transaction status.

Parameters

string $momoTransactionId

MTN Momo transaction ID. Returned from transact (requestToPay)

Return Value

array

Exceptions

CollectionRequestException
GuzzleException

See also

https://momodeveloper.mtn.com/docs/services/collection/operations/requesttopay-referenceId-GET Documentation

array getAccountBalance()

Get account balance.

Return Value

array

Account balance.

Exceptions

CollectionRequestException
GuzzleException

See also

https://momodeveloper.mtn.com/docs/services/collection/operations/get-v1_0-account-balance Documentation

bool isActive(string $partyId, string $partyIdType = null)

Determine if an account holder is registered and active.

Parameters

string $partyId

Party number - MSISDN, email, or code - UUID.

string $partyIdType

Allowed values [msisdn, email, party_code].

Return Value

bool

True if account holder is registered and active, false if the account holder is not active or not found

Exceptions

CollectionRequestException
GuzzleException

See also

https://momodeveloper.mtn.com/docs/services/collection/operations/get-v1_0-accountholder-accountholderidtype-accountholderid-active Documentation

array getAccountHolderBasicInfo(string $partyId)

Get basic info of an account holder.

Parameters

string $partyId

Party number - MSISDN.

Return Value

array

account basic info

Exceptions

CollectionRequestException
GuzzleException

See also

https://momodeveloper.mtn.com/docs/services/collection/operations/basicuserInfo-GET Documentation