```php
<?php

$payment = $event->getObject();

if ($payment->getState() === PaymentInterface::STATE_PENDING) {
  // do stuff
}
```