PHP code example of sloukapetr / comgate-laravel-package
1. Go to this page and download the library: Download sloukapetr/comgate-laravel-package 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/ */
sloukapetr / comgate-laravel-package example snippets
use Sloukapetr\ComgateLaravelPackage\Events\ComgateWebhookReceived;
class HandleComgateWebhook
{
public function handle(ComgateWebhookReceived $event): void
{
// Keep this listener idempotent: Comgate can retry webhook delivery.
if ($this->alreadyProcessed($event->notification->transId)) {
return;
}
if ($event->notification->isPaid()) {
$transactionId = $event->notification->transId;
$referenceId = $event->notification->refId;
// mark order or subscription renewal as paid
}
}
private function alreadyProcessed(?string $transactionId): bool
{
return false;
}
}