I've got a custom module that I have written to inject data into various places in my site when events happen with Commerce Subs.

As per the question title, I need to update an entry when a recurring payment happens (not the initial payment as I'm already doing something with that event).

I cannot see how to identify the subsequent payments from the events I have available to me in Craft Commerce

1 Answer 1


Listen to the invoice.payment_succeeded webhook and check the billing_reason for subscription_cycle. Full answer here: https://stackoverflow.com/a/54165193/1215040

use craft\commerce\stripe\base\Gateway as StripeGateway;
use craft\commerce\stripe\events\ReceiveWebhookEvent;
use yii\base\Event;

    function(ReceiveWebhookEvent $e) {

        if ($e->webhookData['type'] == 'invoice.payment_succeeded') {
            $invoice = $e->webhookData['data']['object'];
            if ($invoice['billing_reason'] == 'subscription_cycle') {
                // It's not the first payment!
            if ($invoice['billing_reason'] == 'subscription_create') {
                // It's the first payment!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.