Skip to main content

Wallet as a Service

Introduction

How to build and deploy digital wallets on our reliable and scalable infrastructure.

Introduction - Wallets API

Wallet as a service enables you to efficiently manage multiple accounts, offering full control over transactions, balances, and account settings. With features like real-time tracking and detailed transaction history, the API helps streamline payment workflows and ensures seamless financial operations across your platform.

Some use cases:

  • E-commerce Platforms: Easily manage customer wallets, process payments, and handle refunds with real-time tracking of balances.
  • Banking and Financial Services: Enable secure and efficient management of multiple customer accounts, supporting deposits, withdrawals, and transfers.
  • Subscription-Based Services: Automate recurring payments, manage subscription balances, and track transaction history for seamless customer billing.
  • Crowdfunding Platforms: Manage individual campaign accounts, track contributions, and handle disbursements with full control over each account’s transactions.
  • Gaming and Digital Platforms: Manage in-game purchases, reward points, and wallet balances, ensuring smooth and secure financial transactions.

Our API supports a wide range of other use cases. If you need further clarification, don’t hesitate to reach out.

Check out the following guides to get started with our REST API.

Authentication

An authorization header is required for all calls made to the Wallet API. To generate an access token, you will need to obtain your username and password.

POST https://{{BASE_URL}}/api/v1/auth/login

Once an access_token is generated, it should be passed as a header param i.e Authorization = Bearer <ACCESS_TOKEN>

Request Body
NameType
usernameBody Field
passwordBody Field

Register a client

A client refers to either an individual or a business entity that holds an account within the wallet system. Before an account can be established for the client, a client profile must first be created.

Creating a Client Profile

To create a client profile within the wallet system, you need to send a POST request with the following payload. The profile includes details about the client and the contact person.

POST https://{{BASE_URL}}/api/v1/clients

Request body

{
"client_name": "LIPAD",
"client_email": "[email protected]",
"client_phone_number": "254712345678",
"contact_person_name": "Admin",
"contact_person_email": "[email protected]",
"contact_person_msisdn": "254712345678",
"business_pin": "1",
"physical_address": "456 Elm St",
"country": "Canada",
"logo": "https://example.com/logo2.png",
"description": "Lorem ipsum dolor sit amet consectetur adipiscing elit.",
"is_active": 1
}

Payload Description

KeyValue TypeRequiredDescription
client_namestringYesName of the client (business or individual).
client_emailstringYesEmail address of the client.
client_phone_numberstringYesPhone number of the client, including country code.
contact_person_namestringYesName of the contact person managing the account.
contact_person_emailstringYesEmail address of the contact person.
contact_person_msisdnstringYesContact person's phone number, including country code.
business_pinstringYesBusiness identification number or PIN.
physical_addressstringNoPhysical address of the client.
countrystringYesThe country where the client is located.
logostringNoURL for the client's logo.
descriptionstringNoBrief description of the client.
is_activenumberYesIndicates whether the client profile is active (1 for active, 0 for inactive).

Example Response

Upon successful creation, the API will return a response containing the client profile details and a unique client code.

{
"client_id": "123",
"client_name": "Emlyn",
"client_email": "[email protected]",
"client_phone_number": 7209323323,
"contact_person_name": "Emlyn",
"contact_person_email": "[email protected]",
"contact_person_msisdn": 7209323323,
"business_pin": "A102035",
"physical_address": "Nairobi, Kenya",
"country": "Kenya",
"description": "Test",
"is_active": 1,
"client_code": "EML67BG6W1",
"logo": "https://example.com/logo.png"
}

Create a Wallet

Once a client profile has been successfully created, you can proceed to create a wallet for the client. A wallet represents an account tied to the client within the wallet system, and it is essential for storing and managing funds.

Creating a Wallet

To create a wallet for a client, you need to send a POST request with the following payload. The payload includes details such as the client code, account type, currency, and status of the account.

POST https://{{BASE_URL}}/api/v1/accounts

Request Body

{
"client_code": "LIPNZPMF7O",
"account_type_code": "FLOAT_ACCOUNT",
"account_name": "Collection Account KES 2",
"currency": "KES",
"minimum_balance": 0,
"can_overdraw": false,
"status": "ACTIVE",
"status_description": "Collection Account"
}

Payload Description

KeyValue TypeRequiredDescription
client_codestringYesUnique client code generated when the client profile is created.
account_type_codestringYesThe type of account, e.g., FLOAT_ACCOUNT, AVAILABLE_COLLECTIONS,HYBRID_ACCOUNT,ACQUIRER_RESERVE,ROLLING_RESERVE,COMMISSION_ACCOUNT,COMMISSION_TAX_ACCOUNT.
account_namestringYesName of the account for identification purposes.
currencystringYesThe currency for the wallet, e.g., KES (Kenyan Shilling), USD (US Dollar).
minimum_balancenumberYesThe minimum balance required for the account, typically 0.
can_overdrawbooleanNoSpecifies whether the account can be overdrawn (true or false).
statusstringYesStatus of the wallet, e.g., ACTIVE, INACTIVE.
status_descriptionstringNoA brief description of the wallet’s purpose or status.

Expected Response

{
"account_id": "1",
"account_number": "10000110",
"account_name": "Float Account 1",
"currency": "KES",
"minimum_balance": "0.1000",
"can_overdraw": false,
"status": "ACTIVE",
"status_description": "Test account",
"created_at": "2024-09-05T17:14:04.734Z",
"updated_at": "2024-09-05T17:14:04.734Z"
}

Create a Client Service

Before transactions can be initiated within the wallet system, a client service must be created. A client service contains various settings and rules that govern how transactions are processed within the wallet.

Key Features of a Client Service:

  • Transaction Types: A client service can be configured to handle both CREDIT and DEBIT transactions, or only one of them, depending on the service requirements. (Note: This attribute is under review, as most services seem to require both types.)
  • Transaction Fees: If applicable, the client service can define specific transaction fees for its operations.
  • Transaction Limits: The service can also set minimum and maximum allowable amounts for transactions.

Creating a Client Service

POST https://{{BASE_URL}}/api/v1/client-services

Request Body

{
"client_code": "LIPNZPMF7O",
"client_service_name": "Payout KES Nairobi",
"service_code": "CUSTOM_SERVICE",
"has_transaction_fee": true,
"transaction_fee_type": "FIXED",
"transaction_fee": 0.0,
"minimum_transaction_amount": 1.0,
"maximum_transaction_amount": 100.0,
"is_active": 1
}

Payload Description

KeyValue TypeRequiredDescription
client_codestringYesUnique client code generated when the client profile is created.
client_service_namestringYesName of the client service (e.g., "Payout KES Nairobi").
service_codestringYesA unique service identifier, e.g., CUSTOM_SERVICE.
has_transaction_feebooleanYesSpecifies if the service charges a transaction fee (true or false).
transaction_fee_typestringNoType of transaction fee, either PERCENTAGE or FIXED. Optional if no fee is charged.
transaction_feenumberNoThe amount charged as a fee, e.g., 0.00. Optional if has_transaction_fee is false.
minimum_transaction_amountnumberYesThe minimum transaction amount allowed by this service.
maximum_transaction_amountnumberYesThe maximum transaction amount allowed by this service.
is_activenumberYesIndicates whether the service is active (1 for active, 0 for inactive).

Example Response

Upon successful creation, the API will return a response containing the details of the newly created client service.

{
"client_service_id": "1",
"client_service_code": "PAY1CNAELX",
"client_code": "LIPNZPMF7O",
"client_service_name": "Payout KES Nairobi",
"service_code": "CUSTOM_SERVICE",
"has_transaction_fee": true,
"transaction_fee_type": "FIXED",
"transaction_fee": 0.0,
"minimum_transaction_amount": 1.0,
"maximum_transaction_amount": 100.0,
"is_active": 1
}

Transactions

In the wallet system, transactions can be performed by combining the client, client service, and wallet that have been created. These components work together to handle various types of transactions.

Transaction Types

Primarily, the following types of transactions can be performed:

  • Credit: Adding funds to a wallet or account.
  • Debit: Deducting funds from a wallet or account.
  • Account Transfer: Moving funds between different wallets or accounts.
  • Reversal: Reversing a previously performed transaction.

Each transaction type can be executed through the use of a client’s wallet, associated with the specific client service, to ensure compliance with the defined transaction rules and settings.

Make a Debit or Credit

To perform a transaction within the wallet system, you need to combine the client, client service, and wallet that have been created. Using these components, you can initiate credit and debit transactions.

Creating a Transaction

To make a transaction, you will need to send a POST request to the following endpoint. The command parameter in the URL determines whether the transaction is a credit or a debit.

  • For a Credit transaction, use command=CREDIT.
  • For a Debit transaction, use command=DEBIT.

POST {{BASE_URL}}/api/v1/transactions?command=CREDIT (or DEBIT for debits)

Request Body

{
"account_number": "10000099",
"client_service_code": "FLOIQ2XAFJ",
"transaction_source": "EXTERNAL",
"transaction_amount": 100.0,
"source_transaction_id": "12325524445",
"source_transaction_data": {
"data": "test"
},
"transaction_narration": "Test",
"transaction_date": "2024-07-29T12:34:56Z"
}

Payload Description

KeyValue TypeRequiredDescription
account_numberstringYesThe wallet or account number where the transaction will be applied.
client_service_codestringYesThe unique code for the client service handling the transaction.
transaction_sourcestringYesSource of the transaction (e.g., EXTERNAL, INTERNAL).
transaction_amountnumberYesThe amount of money involved in the transaction.
source_transaction_idstringYesA unique reference ID for the transaction from the source system.
source_transaction_dataobjectNoAdditional data related to the source transaction.
transaction_narrationstringNoA brief description or narration for the transaction.
transaction_datestring (ISO 8601)YesThe date and time when the transaction occurred (ISO 8601 format).

Expected Response

{
"transaction_id": "7607",
"account": "10000110",
"client_service": "PAY1CNAELX",
"transaction_type": "CREDIT",
"currency": "KES",
"transaction_amount": "96.0000",
"previous_balance": "0.0000",
"current_balance": "96.0000",
"other_party_account": "10000002",
"other_party_transaction_hash": "N/A",
"transaction_source": "EXTERNAL",
"source_transaction_id": "121231234",
"source_transaction_data": {
"data": "Dashboard"
},
"transaction_narration": "2131321",
"transaction_date": "2024-09-05T17:47:00.000Z"
}

Make an Internal Transfer

An internal transfer allows you to transfer funds between two accounts within the wallet system. The transfer will be made between the source account and the destination account, and it requires the use of a valid client service.

Creating an Internal Transfer

To make an internal transfer, you need to send a POST request to the following endpoint with the appropriate payload:

POST https://{{BASE_URL}}/api/v1/account-transfers

Request Body

{
"source_account_number": "10000014",
"destination_account_number": "10000015",
"client_service_code": "INT_NHQ5Y77",
"transaction_amount": 10.0,
"source_transaction_id": "1",
"transaction_source": "INTERNAL",
"source_transaction_data": {},
"transaction_narration": "Transfer for payment",
"transaction_date": "2022-07-29T12:34:56Z"
}

Request Description

KeyValue TypeRequiredDescription
source_account_numberstringYesThe account number from which the funds will be transferred.
destination_account_numberstringYesThe account number to which the funds will be transferred.
client_service_codestringYesThe client service code that authorizes the transaction.
transaction_amountnumberYesThe amount of money to be transferred.
source_transaction_idstringYesA unique reference ID for the transaction from the source system.
transaction_sourcestringYesIndicates the source of the transaction, e.g., INTERNAL.
source_transaction_dataobjectNoAdditional data related to the transaction, if applicable.
transaction_narrationstringNoA brief description of the transaction, e.g., "Transfer for payment".
transaction_datestring (ISO)YesThe date and time when the transaction occurred (in ISO 8601 format).

Example Response

Upon successfully creating the internal transfer, the API will return a response with transaction details and a unique transaction ID.

{
"source_transaction": {
"transaction_id": "7611",
"account": "10000097",
"client_service": "INTBPHGRXO",
"transaction_type": "DEBIT",
"currency": "KES",
"transaction_amount": "10.0000",
"previous_balance": "2985.0000",
"current_balance": "2975.0000",
"other_party_account": "10000095",
"other_party_transaction_hash": "N/A",
"transaction_source": "INTERNAL",
"source_transaction_id": "IFT112242342412324",
"source_transaction_data": {
"data": "Dashboard"
},
"transaction_narration": "1242142421421",
"transaction_date": "2024-09-05T18:36:42.774Z"
},
"destination_transaction": {
"transaction_id": "7612",
"account": "10000095",
"client_service": "INTBPHGRXO",
"transaction_type": "CREDIT",
"currency": "KES",
"transaction_amount": "10.0000",
"previous_balance": "0.0000",
"current_balance": "10.0000",
"other_party_account": "10000097",
"other_party_transaction_hash": "N/A",
"transaction_source": "INTERNAL",
"source_transaction_id": "IFT212242342412324",
"source_transaction_data": {
"data": "Dashboard"
},
"transaction_narration": "1242142421421",
"transaction_date": "2024-09-05T18:36:42.788Z"
}
}

Make a Reversal

A reversal allows you to reverse a previously performed transaction in the wallet system. This can be used to undo incorrect or duplicate transactions. To reverse a transaction, you need the transaction ID of the original transaction and the proper command.

Creating a Reversal

To make a reversal, send a POST request to the following endpoint. Replace :id in the URL with the transaction ID of the original transaction.

POST {{wallet_url}}/transactions/:id?command=REVERSE

Expected Response

{
"source_transaction": {
"transaction_id": "7609",
"account": "10000110",
"client_service": "REVN6D91E4",
"transaction_type": "DEBIT",
"currency": "KES",
"transaction_amount": "997.0000",
"previous_balance": "1093.0000",
"current_balance": "96.0000",
"other_party_account": "10000002",
"other_party_transaction_hash": "N/A",
"transaction_source": "INTERNAL",
"source_transaction_id": "RVS11212adas",
"source_transaction_data": {
"data": "Dashboard"
},
"transaction_narration": "1213124",
"transaction_date": "2024-09-05T17:58:00.000Z"
},
"destination_transaction": {
"transaction_id": "7610",
"account": "10000002",
"client_service": "REVN6D91E4",
"transaction_type": "CREDIT",
"currency": "KES",
"transaction_amount": "997.0000",
"previous_balance": "9195.0000",
"current_balance": "10192.0000",
"other_party_account": "10000110",
"other_party_transaction_hash": "N/A",
"transaction_source": "INTERNAL",
"source_transaction_id": "RVS21212adas",
"source_transaction_data": {
"data": "Dashboard"
},
"transaction_narration": "1213124",
"transaction_date": "2024-09-05T17:58:00.000Z",
"transaction_id": "7610"
}
}