Last updated: May 21, 2020

Events

PayPal buttons allows listen for events like: OrderCompleteEvent

OrderCompleteEvent #

This event is fired once the payment is successful and the order is created with a number.

use enupal\paypal\events\OrderCompleteEvent;
use enupal\paypal\services\Orders;
use yii\base\Event;

class YourPlugin extends Plugin
{
    public function init()
    {
        ...
        ...
         Event::on(Orders::class, Orders::EVENT_AFTER_ORDER_COMPLETE, function(OrderCompleteEvent $e) {
            $order = $e->order;
        });
        ...
        ...        
     }
}