1. Go to this page and download the library: Download paymint/paymint-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/ */
paymint / paymint-laravel example snippets
use PayMint\Laravel\Facades\PayMint;
class PaymentController extends Controller
{
// Step 1: Initialize and redirect customer
public function initiatePayment(Request $request)
{
$response = PayMint::checkout()->initialize([
'amount' => 5000,
'email' => $request->user()->email,
'reference' => 'ORDER_' . uniqid(),
'redirect_url' => route('payment.callback'),
'name' => $request->user()->name,
]);
return redirect($response['data']['authorization_url']);
}
// Step 2: Handle customer return & verify
public function handleCallback(Request $request)
{
$reference = $request->query('reference');
$payment = PayMint::checkout()->verify($reference);
if (($payment['data']['status'] ?? '') === 'successful') {
// Order is paid! Deliver value
return view('payment.success');
}
return view('payment.failed');
}
}