1. Go to this page and download the library: Download nokimaro/liontech-laravel 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/ */
nokimaro / liontech-laravel example snippets
use Nokimaro\LionTech\Laravel\Facades\LionTech;
use Nokimaro\LionTech\Requests\CreateOrderRequest;
use Nokimaro\LionTech\ValueObjects\Currency;
use Nokimaro\LionTech\ValueObjects\Money;
$order = LionTech::orders()->create(new CreateOrderRequest(
amount: new Money('100.00', Currency::USD),
description: 'Order #1234',
successUrl: 'https://your-site.com/success',
declineUrl: 'https://your-site.com/decline',
webhookUrl: 'https://your-site.com/webhook',
));
use Nokimaro\LionTech\Client;
use Nokimaro\LionTech\Clients\PaymentsClient;
class PaymentController extends Controller
{
// Inject the main client
public function store(Client $liontech)
{
$payment = $liontech->payments()->create($request);
}
// Or inject individual clients
public function index(PaymentsClient $payments)
{
return $payments->get($paymentId);
}
}
use Nokimaro\LionTech\Client;
// Create a client for a specific tenant
$client = new Client(
accessToken: $tenant->liontech_access_token,
refreshToken: $tenant->liontech_refresh_token,
baseUrl: config('liontech.base_url'),
secureUrl: config('liontech.secure_url'),
);
$order = $client->orders()->create($request);
use Nokimaro\LionTech\Security\WebhookSignatureVerifier;
use Illuminate\Http\Request;
class WebhookController extends Controller
{
public function handle(Request $request, WebhookSignatureVerifier $verifier)
{
if (! $verifier->verify($request->headers->all(), $request->getContent())) {
abort(403, 'Invalid webhook signature');
}
// process webhook...
return response()->json(['status' => 'ok']);
}
}
use Nokimaro\LionTech\Security\CardEncryptor;
class PaymentController extends Controller
{
public function __construct(private readonly CardEncryptor $encryptor) {}
public function encrypt()
{
$encrypted = $this->encryptor->encryptForPayment([
'pan' => '4405639704015096',
'cvv' => '123',
'exp_month' => 12,
'exp_year' => 2030,
'cardHolder' => 'John Doe',
]);
}
}
use Nokimaro\LionTech\Laravel\Config\LionTechConfig;
if (LionTechConfig::isConfigured()) {
// safe to use SDK
}
if (LionTechConfig::isSandbox()) {
// running in sandbox mode
}