Jakweb.ch stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
clouddesk/class/payment/yookassa-notifications.php

27 lines
1.0 KiB

1 year ago
<?php
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2021 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
require_once __DIR__.'yookassa/vendor/autoload.php';
$source = file_get_contents("php://input");
$requestBody = json_decode($source,true);
use YooKassa\Model\Notification\NotificationSucceeded;
use YooKassa\Model\Notification\NotificationWaitingForCapture;
use YooKassa\Model\NotificationEventType;
try {
$notification = ($requestBody['event'] === NotificationEventType::PAYMENT_SUCCEEDED)
? new NotificationSucceeded($requestBody)
: new NotificationWaitingForCapture($requestBody);
} catch (Exception $e) {
// Processing errors
}
$payment = $notification->getObject();
$id = $payment->id;
?>