Payment system events
Events
Event | Description and parameters | Available from version | ||||||
---|---|---|---|---|---|---|---|---|
OnSalePsServiceProcessRequestBeforePaid | Triggered when method processRequest for payment system handler operated without errors and payment status needs an update.
Parameters
| |||||||
OnSaleGetHandlerDescription | Triggered on receiving description for payment system. Event handler can add to CODE key value.
Parameters
| |||||||
onSalePsInitiatePaySuccess | Triggered on successful initializing of payment system. Event handler contains available payment object.
Parameters
| |||||||
onSalePsInitiatePayError | Triggered on error when initializing payment system. Event handler contains payment object and array with errors.
Parameters
|
Examples
OnSalePsServiceProcessRequestBeforePaid
use Bitrix\Main; use Bitrix\Sale\Payment; Main\EventManager::getInstance()->addEventHandler( 'sale', 'OnSalePsServiceProcessRequestBeforePaid', 'myFunction' ); function myFunction(Main\Event $event) { /** @var Payment $payment */ $payment = $event->getParameter('payment'); /** @var string $status */ $status = $event->getParameter('status'); /** @var string $paySystemId */ $paySystemId = $event->getParameter('pay_system_id'); /** * Arbitrary code * For example, getting payment system $paySystem = $payment->getPaySystem(); */ }
OnSaleGetHandlerDescription
use Bitrix\Main; use Bitrix\Sale\Payment; Main\EventManager::getInstance()->addEventHandler( 'sale', 'OnSaleGetHandlerDescription', 'myFunction' ); function myFunction(Main\Event $event) { /** @var string $handler */ $handler = $event->getParameter("handler"); if ($handler === 'my_handler') { return array( 'USER_COLUMNS' => array( "NAME" => "User field", "SORT" => 6000, 'GROUP' => 'COLUMN_SETTINGS', ) ); } return array(); }
onSalePsInitiatePaySuccess
use Bitrix\Main; use Bitrix\Sale\Payment; Main\EventManager::getInstance()->addEventHandler( 'sale', 'onSalePsInitiatePaySuccess', 'myFunction' ); function myFunction(Main\Event $event) { /** @var Payment $payment */ $payment = $event->getParameter('payment'); /** * Arbitrary code */ }
onSalePsInitiatePayError
use Bitrix\Main; use Bitrix\Sale\Payment; Main\EventManager::getInstance()->addEventHandler( 'sale', 'onSalePsInitiatePayError', 'myFunction' ); function myFunction(Main\Event $event) { /** @var Payment $payment */ $payment = $event->getParameter('payment'); /** @var array $errors array with errors retrieved via getErrorMessages from object ServiceResult */ $errors = $event->getParameter('errors'); /** * Arbitrary code */ }
© «Bitrix24», 2001-2024