PHP code example of alsharie / sabacash-payment
1. Go to this page and download the library: Download alsharie/sabacash-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/ */
alsharie / sabacash-payment example snippets
return [
'auth' => [
'username' => env('SABACASH_MERCHANT_USERNAME'),
'password' => env('SABACASH_MERCHANT_PASSWORD'),
],
'url' => [
'base' => env('SABACASH_BASE_URL', 'https://api.sabacash.ye:49901'),
]
];
$sabaCash = new SabaCash();
$response = $sabaCash->login();
if ($response->isSuccess()) {
$response->getToken();
}
$sabaCash = new SabaCash();
$response = $sabaCash
->setCurrency(2)
->setNote('this is simple note')
->setAmount(3000)
->setBeneficiaryTerminal(1)
->setSourceCode(/*phone number*/)
->initPayment();
if ($response->isSuccess()) {
$response->getAdjustment();
...
...
}
$sabaCash = new SabaCash();
$response = $sabaCash
->setAdjustmentId(603414)
->setOtp(5761)
->setOperationApprove()
->setNote('تاكيد عملية الدفع')
->confirmPayment();
if ($response->isSuccess()) {
return $response->getTransactionId();
}
$sabaCash = new SabaCash();
$response = $sabaCash
->setTransactionId(/*tranId*/)
->checkTransactionStatus();
if ($response->isSuccess()) {
return $response->getStatus();
}