Collection
Represent Collection Client used for collection product
async createAccessToken()
async getAccountBalance()
async getAccountBalanceIn()
async getBasicUserInfo()
async askUserInfo()
async requestToPay()
async getWithdrawStatus()
async withdraw()
async isActive()
await createAccessToken( authorization )
await createAccessToken( authorization )Method to create access token for collection user
Parameters :
- authorization (string) - a valid basic authentification token 
Return
[boolean, data]
{
  "access_token": "string",
  "token_type": "string",
  "expires_in": 0
}Return Type :
array
await getAccountBalance( authorization, target )
await getAccountBalance( authorization, target )Method to get balance for collection user
Parameters :
- authorization (string) - A valid bearer authentification token 
- target (string) - The target environment 
Return :
[boolean, data]
{
  "availableBalance": "string",
  "currency": "string"
}Return Type :
array
await getAccountBalanceIn( currency, authorization, target )
await getAccountBalanceIn( currency, authorization, target )Method to get balance in specific currency for collection user
Parameters :
- currency (string) - A valid ISO4217 Currency 
- authorization (string) - A valid bearer authentification token 
- target (string) - The target environment 
Return :
[boolean, data]
{
  "availableBalance": "string",
  "currency": "string"
}Return Type :
array
await getBasicUserInfo( msisdn, authorization, target )
await getBasicUserInfo( msisdn, authorization, target )Method to get basic user info without consent for collection user
Parameters :
- msisdn (string) - The number of the user 
- authorization (string) - A valid bearer authentification token 
- target (string) - The target environment 
Return :
[boolean, data]
{
  "given_name": "string",
  "family_name": "string",
  "birthdate": "string",
  "locale": "string",
  "gender": "string",
  "status": "string"
}Return Type:
array
await askUserInfo( authorization, target )
await askUserInfo( authorization, target )Method to get user info with consent for collection user
Parameters :
- authorization (string) - A valld bearer authentification token 
- target (string) - The target environment 
Return :
[boolean, data]
{
  "sub": "string",
  "name": "string",
  "given_name": "string",
  "family_name": "string",
  "middle_name": "string",
  "email": "string",
  "email_verified": true,
  "gender": "string",
  "locale": "string",
  "phone_number": "string",
  "phone_number_verified": true,
  "address": "string",
  "updated_at": 0,
  "status": "string",
  "birthdate": "string",
  "credit_score": "string",
  "active": true,
  "country_of_birth": "string",
  "region_of_birth": "string",
  "city_of_birth": "string",
  "occupation": "string",
  "employer_name": "string",
  "identification_type": "string",
  "identification_value": "string"
}Return Type :
array
await requestToPay( authorization, uuid, target, body, callback )
await requestToPay( authorization, uuid, target, body, callback )Method to request a payment for collection user
Parameters :
- authorization (string) - A valid bearer authentification token 
- uuid (string) - A valid UUID version 4 
- target (string) - The target environment 
- body (Object) - A dictionnary with full detail of the payment [see detail below] 
According to MTN MOMO API
{
  "amount": "string",
  "currency": "string",
  "externalId": "string",
  "payer": {
    "partyIdType": "MSISDN",
    "partyId": "string"
  },
  "payerMessage": "string",
  "payeeNote": "string"
}{
  "type": "object",
  "properties": {
    "amount": {
      "type": "string",
      "description": "Amount that will be debited from the payer account."
    },
    "currency": {
      "type": "string",
      "description": "ISO4217 Currency"
    },
    "externalId": {
      "type": "string",
      "description": "External id is used as a reference to the transaction. External id is used for reconciliation. The external id will be included in transaction history report. <br>External id is not required to be unique."
    },
    "payer": {
      "type": "object",
      "properties": {
        "partyIdType": {
          "enum": [
            "MSISDN",
            "EMAIL",
            "PARTY_CODE"
          ],
          "type": "string"
        },
        "partyId": {
          "type": "string"
        }
      },
      "description": "Party identifies a account holder in the wallet platform. Party consists of two parameters, type and partyId. Each type have its own validation of the partyId<br> MSISDN - Mobile Number validated according to ITU-T E.164. Validated with IsMSISDN<br> EMAIL - Validated to be a valid e-mail format. Validated with IsEmail<br> PARTY_CODE - UUID of the party. Validated with IsUuid"
    },
    "payerMessage": {
      "type": "string",
      "description": "Message that will be written in the payer transaction history message field."
    },
    "payeeNote": {
      "type": "string",
      "description": "Message that will be written in the payee transaction history note field."
    }
  }
}- callback ( [Optional] string ) - The website receiving call back 
Return :
[boolean, data]
Retrun Type :
array
await getWithdrawStatus( authorization, uuid, target )
await getWithdrawStatus( authorization, uuid, target )Method to get a withdrawal status for collection user
Parameters :
- authorization (string) - A valid bearer authentification token 
- uuid (string) - A valid UUID version 4 
- target (string) - The target environment 
Return :
[boolean, data]
According to MTN MOMO API
{
  "amount": "string",
  "currency": "string",
  "financialTransactionId": "string",
  "externalId": "string",
  "payer": {
    "partyIdType": "MSISDN",
    "partyId": "string"
  },
  "payerMessage": "string",
  "payeeNote": "string",
  "status": "PENDING",
  "reason": {
    "code": "PAYEE_NOT_FOUND",
    "message": "string"
  }
}Return Type:
array
await withdraw( authorization, uuid, target, body, callback )
await withdraw( authorization, uuid, target, body, callback )Method to withdraw money for collection user
The library is taking in charge only Withdraw V2
Parameters :
- authorization (string) - A valid bearer authentification token 
- uuid (string) - A valid UUID version 4 
- target (string) - The target environment 
- body (Object) - A dictionnary with full detail of the payment [see detail below] 
- callback ( [Optional] string ) - The website receiving call back 
Return :
[boolean, data]
Return Type :
array
await isActive( account, accountType, authorization, target )
await isActive( account, accountType, authorization, target )Method to check if an account is active for a collection user
Parameters :
- account (string) - The account target 
- account_type (string) - Specifies the type of the party ID. Allowed values [msisdn, email, party_code]. default set to msisdn 
- authorization (string) - A valid bearer authentification token 
- target (string) - The target environment 
Return :
[boolean, data]
Return Type :
array
Last updated