1. Go to this page and download the library: Download p4ndish/laravel-santimpay 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/ */
p4ndish / laravel-santimpay example snippets
use P4ndish\SantimPay\Facades\SantimPay;
$merchantTxnId = SantimPay::generateMerchantTxnId();
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use P4ndish\SantimPay\Exception\SantimPayException;
use P4ndish\SantimPay\Facades\SantimPay;
public function pay(Request $request): RedirectResponse
{
$merchantTxnId = SantimPay::generateMerchantTxnId();
try {
$res = SantimPay::initiatePayment(
merchantTxnId: $merchantTxnId,
amount: 100,
reason: 'Order #123',
phoneNumber: $request->input('phone')
);
} catch (SantimPayException $e) {
abort($e->getStatus(), $e->getMessage());
}
if (!($res['url'] ?? null)) {
abort(500, 'SantimPay did not return a redirect URL.');
}
return redirect()->away($res['url']);
}
use P4ndish\SantimPay\Facades\SantimPay;
$status = SantimPay::checkTransactionStatus($merchantTxnId);
// $status is the decoded JSON response array