1. Go to this page and download the library: Download alsharie/floosak-payment 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/ */
$floosak = new Floosak();
$response = $floosak->requestKey();
if ($response->isSuccess()) {
$request_id = $response->getRequestId();
....
....
}
$floosak = new Floosak();
$response = $floosak
->setOtp(/*otp*/)
->setRequestId(/*requestId*/)
->verifyKey();
if ($response->isSuccess()) {
$key= $response->getKey();
$wallet_id= $response->getWalletId();
//todo:: store $key and $wallet_id
} else {
return $response->body();
}
$floosak = new Floosak();
$response = $floosak
->setRequestId(/*ref_id*/) // random number you generate most
->setAmount(/*amount*/)
->setCustomerPhone(/*phone*/)
->setPurpose(/*purpose*/)
->purchase();
if ($response->isSuccess()) {
$purchase_id = $response->getPurchaseId();
....
....
}
$floosak = new Floosak();
$response = $floosak
->setPurchaseId(/*purchase_id*/) // you get it from the response of the above request `purchase()`
->setOtp(/*user_otp*/)
->confirmPurchase();
if ($response->isSuccess()) {
$tran_id = $response->getTransactionId();
....
....
}
$floosak = new Floosak();
$response = $floosak
->setRequestId(/*ref_id*/) // the random number you generated
->setTransactionId(/*tran_id*/)
->setAmount(/*amount*/) // amount to refund
->refund();
if ($response->isSuccess()) {
return $response->getBalance();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.