1. Go to this page and download the library: Download krafsys/payment-manager 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/ */
$result = $manager->gateway('paystack')->verify('order_1029');
if ($result->isSuccessful()) {
// $result->amount, $result->currency, $result->paidAt are all normalized
}
use Krafsys\PaymentManager\DTO\RefundRequest;
$refund = $manager->gateway('paystack')->refund(new RefundRequest(
reference: 'order_1029',
amount: 1000.00, // omit for a full refund
reason: 'Customer requested cancellation',
));
$rawBody = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_PAYSTACK_SIGNATURE'] ?? null; // header name differs per gateway, see table below
$gateway = $manager->gateway('paystack');
if (!$gateway->verifyWebhookSignature($rawBody, $signature)) {
http_response_code(401);
exit;
}
$event = $gateway->parseWebhookPayload(json_decode($rawBody, true));
if ($event->status === \Krafsys\PaymentManager\Enums\TransactionStatus::Success) {
// fulfil the order using $event->reference
}
use Krafsys\PaymentManager\Laravel\Facades\PaymentManager;
$response = PaymentManager::gateway('flutterwave')->initialize($paymentRequest);