1. Go to this page and download the library: Download geekk/payssion-payments-php 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/ */
geekk / payssion-payments-php example snippets
$data = $_POST;
$webhookService = new PayssionWebhookService($data, 'your api key', 'your secretkey');
if(! $webhookService->hasCorrectSignature()) {
echo 'Incorrect signature';
return;
}
$paymentId = $webhookService->getPaymentId();
$invoiceId = $webhookService->getOrderId();
$status = $webhookService->getState();
if (in_array($status, [
PayssionPaymentStatusEnum::cancelled,
PayssionPaymentStatusEnum::failed,
PayssionPaymentStatusEnum::expired,
PayssionPaymentStatusEnum::error,
])) {
echo 'failded payment';
// Core for failed payment
return;
}
if (in_array($status, [
PayssionPaymentStatusEnum::refunded,
PayssionPaymentStatusEnum::chargeback,
])) {
echo 'refunded payment';
// Code for refunded payment
return;
}
if ($status == PayssionPaymentStatusEnum::completed) {
echo 'completed payment';
// Code for completed payment
return;
}