commerce icon indicating copy to clipboard operation
commerce copied to clipboard

receiveSubscriptionPayment event never seems to fire?

Open MattWilcox opened this issue 4 years ago • 3 comments

We are using Stripe for Commerce plugin as a payment gateway, and have our own plugin that's listening on EVENT_RECEIVE_SUBSCRIPTION_PAYMENT as documented here: https://craftcms.com/docs/commerce/3.x/extend/events.html#receivesubscriptionpayment

Event::on(
    Subscriptions::class,
    Subscriptions::EVENT_RECEIVE_SUBSCRIPTION_PAYMENT,
    function(SubscriptionEvent $event) {
        LogToFile::info('Got into EVENT_RECEIVE_SUBSCRIPTION_PAYMENT on main plugin file', 'subscription-emails');

        $this->emailsService->subscriptionReceivePayment($event); // works because of 'emailsService' => EmailsService::class
    }
);

We are expecting that when Stripe processes a subscription payment, that it will fire off the webhook, that the Stripe for Commerce plugin will do its thing, Commerce will listen to that and then the EVENT_RECEIVE_SUBSCRIPTION_PAYMENT will fire, allowing us to send a "thanks for your subscription payment" email from our own plugin.

The event never seems to fire. We have never seen a log line in the subscription-emails log file for this event, only ever for the EVENT_AFTER_CREATE_SUBSCRIPTION event (also in our plugin, and working fine)

Are we missing something, or are none of the Subscription events other than EVENT_AFTER_CREATE_SUBSCRIPTION working?

We do have the webhooks set up to all send, and the webhook secret is in and valid.

Additional info

  • Craft version: 3.6.11.2
  • Commerce version: 3.2.17.4
  • PHP version: 7.4.3

MattWilcox avatar Apr 21 '21 13:04 MattWilcox

Has there been any movement on this?

gazlawn22 avatar Jun 16 '21 14:06 gazlawn22

Sorry, this slipped through our review. We are moving issues to discussions at the moment and this surfaced. Will review this in the morning.

lukeholder avatar Jul 21 '21 15:07 lukeholder

Thanks Luke. Are there any updates addressing this issue?

JorgeST avatar Jun 22 '22 00:06 JorgeST

@lukeholder Any update on this ?

mc-tomjrjones avatar Sep 07 '23 13:09 mc-tomjrjones

I was able to reproduce the the event triggering on the payment event on the latest version of Commerce and Stripe plugin. Please create a new issue if this issue persists on the latest version of Commerce and the Stripe plugin.

Thanks.

CleanShot 2023-11-20 at 19 36 25@2x

lukeholder avatar Nov 20 '23 11:11 lukeholder