1. Go to this page and download the library: Download mootaco/moota-php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mootaco / moota-php-sdk example snippets
// my code goes here
// Set your API V2 Server Key
\Moota\Moota\Config\Moota::$ACCESS_TOKEN = '<your server key>';
$auth = new \Moota\Moota\Domain\Auth();
try {
$getSecretToken = $auth->login(
new \Moota\Moota\DTO\Auth\LoginData(
'[email protected]',
'password_hash',
new \Moota\Moota\DTO\Auth\ScopesData( true )
)
);
// set to \Moota\Moota\Config::$ACCESS_TOKEN = $getSecretToken['access_token'];
} catch (\Moota\Moota\Exception\MootaException $exception) {
// handling fail authentication
}
$getSecretToken = new \Moota\Moota\Domain\Auth();
$getSecretToken->logout();
$bank_account = new \Moota\Moota\Domain\BankAccount();
// store bank account
try {
$bank_account->storeBankAccount(
new \Moota\Moota\DTO\BankAccount\BankAccountStoreData(
"",
Moota::BANK_TYPES[0], // list of bank type
"loream", //for gojek and ovo fill with mobile phone number
"your password",
"loream kasma",
"16899030",
true
)
);
} catch (\Moota\Moota\Exception\MootaException $exception) {
print_r($exception->getPharseErrors());
}
// update bank account
try {
$bank_account->updateBankAccount(
new \Moota\Moota\DTO\BankAccount\BankAccountUpdateData(
"hashing_qwopejs_id",
"jhon", //for gojek and ovo fill with mobile phone number
"",
"",
"",
"",
""
)
);
} catch (\Moota\Moota\Exception\MootaException $exception) {
print_r($exception->getPharseErrors());
}
// get list bank account
try {
$bank_account->getBankList();
} catch (\Moota\Moota\Exception\MootaException $exception) {
print_r($exception->getPharseErrors());
}
// can't wait for new mutation data use method refresh mutation
try {
$bank_account->refreshMutation('<bank_id>');
} catch (\Moota\Moota\Exception\MootaException $exception) {
print_r($exception->getPharseErrors());
}
// want to remove bank account from moota ?
try {
$bank_account->destroyBankAccount('<bank_id>');
} catch (\Moota\Moota\Exception\MootaException $exception) {
print_r($exception->getPharseErrors());
}
// want to activate my wallet account ovo or gojek please request otp code first
try {
$otp_code = $bank_account->bankEwalletRequestOTPCode('<bank_id>');
$bank_account->bankEwalletVerificationOTPCode(
new \Moota\Moota\DTO\BankAccount\BankAccountEwalletOtpVerification('<bank_id>', '<$otp_code>')
);
} catch (\Moota\Moota\Exception\MootaException $exception) {
print_r($exception->getPharseErrors());
}
$mutation = new \Moota\Moota\Domain\Mutation();
// get my mutation
$my_mutation = $mutation->getMutations(
new \Moota\Moota\DTO\Mutation\MutationQueryParameterData(
'asdasd',
'2021-09-21',
'Testing Note Mutation',
'2000123',
'CR'
)
);
// Determine dummy mutation for debugging
$my_mutation = $mutation->storeMutation(
new \Moota\Moota\DTO\Mutation\MutationStoreData(
// fill mutation value here
)
);