1

Problem: I want to trigger an action (Instant Analytics plugin) whenever a payment (Craft Commerce plugin) is successful (webhook). Payment provider is Mollie.

So far I created a plugin that listens to the onOrderComplete event to send the analytics action. But it looks like the event onOrderComplete is not triggered.

Here is the code

craft()->on('commerce_orders.onOrderComplete', function(Event $event) {
    craft()->instantAnalytics->analytics()->addCommerceCheckoutStep($event->params['order'], 4, 'Payed');
    craft()->instantAnalytics->analytics()->sendPageView();
});

Question 1: Is this event a good one? Or is there an event that is thrown at the moment of a successful payment of an incoming webhook?

Question 2: Why is the onOrderComplete event not thrown?

  • That event is fired with the order's isComplete bit is set and the order is fully paid. Is that the case with your orders? – Brad Bell Oct 12 '17 at 17:28
  • Orders are becoming complete and payed. I will try to log something inside the event listener. Then I will know if the event is not triggered or the instant analytics is for some reason failing. Although the code of the instant analytics itself works, there might be an issue with the $event->params['order'] parameter.. I will be back as soon as I have more info. – boldenamsterdam Oct 13 '17 at 14:44
  • 1
    Well it according to the logs it looks like the event is actually triggered. The thing is that the page view is not sent and therefore it does not end up in analytics.. Maybe I will have to escalate this with the plugin developer.. – boldenamsterdam Oct 16 '17 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.