1. Go to this page and download the library: Download nycorp/finance 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/ */
public function canWithdraw(float $amount, bool $forceBalanceCalculation): bool
{
//EX : Set to true because the account is debited only when the service is consumed
return true;
}
public function getCurrency()
{
// Implement your logic to get currency here the default value is set in the finance config file
return \NYCorp\Finance\Http\Core\ConfigReader::getDefaultCurrency();
}
$response = \Nycorp\LiteApi\Response\DefResponse::parse(User::first()->withdrawal(DefaultPaymentProvider::getId(), 12, $description));
$response->getBody(); // get the body of the response
$response->isSuccess(); // get the success state as boolean
$response->getMessage(); // get response message