The MoiPayWay PHP Library simplifies interaction with Moipayway APIs in your PHP applications. It streamlines the process of integration, eliminating the need to deal with intricate details, and facilitates rapid API calls. Key features include:
- Wallets: creating and managing wallets (fiat, crypto).
- Making transfers, single/bulk. Fiat (NGN, GBP, EUR, USD) & Crypto.
- Manage virtual accounts.
- Tokens: create and manage token, such as; NFT, fungible token, stable coins, storage token, etc.
- Verification: running identity checks, credit checks, etc.
- AI: verify document image (drivers license NIN, BVN, etc), Face Comparison.
- Lookups: Document validity check, CAC, etc.
- Requirements
- Installation
- Initialization
- Authenticate
- Sending requests with payload
- Error handling
- More usage documentation
- Testing
- License
- PHP 7.4 or higher.
composer require moipayway/mpw-php
use MPW\MoiPayWay;
$mpw = new MoiPayWay("secret_token");
try {
var_dump($mpw->misc->countries());
} catch (Exception $e) {
echo $e->getMessage();
}
Refer to the documentation linked below to understand how to generate secret tokens for authenticating the Moipayway SDK.
Some endpoint requires additional data to be included in the request payload. Below is an example demonstrating sending requests with payload:
use MPW\MoiPayWay;
$mpw = new MoiPayWay("secret_token");
try {
$response = $mpw->wallet->createFiat([
'code' => '***',
'meta' => [
'name' => '***',
'user_id' => '***'
]
]);
var_dump($response);
} catch (Exception $e) {
echo $e->getMessage();
}
You can catch request errors by wrapping the method in a try / catch block.
use MPW\MoiPayWay;
$mpw = new MoiPayWay("invalid_api_secret_key");
try {
$response = $mpw->token->multi->mint($payload);
var_dump($response);
} catch (Exception $e) {
echo $e->getMessage();
}
Response :
Error minting multi token
./vendor/bin/phpunit