Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
Versioning
Changelog
Upgrade your API version
Upgrade your SDK version
Essentials
SDKs
API
Testing
Stripe CLI
Tools
Workbench
Developers Dashboard
Stripe Shell
Stripe for Visual Studio Code
Features
Workflows
Event Destinations
Stripe health alertsFile uploads
AI solutions
Agent toolkit
Security and privacy
Security
Privacy
Extend Stripe
Build Stripe apps
Use apps from Stripe
    Overview
    Stripe-built apps
    Adobe Commerce
      Cookbooks
        Add additional metadata to payments
        Add custom events to Stripe webhooks
        Add external payment methods to the payment form
        Disable shipping methods in the Express Checkout modals
        Enable manual capture
        Enable multicapture
        Enable overcapture
        Hide the terms displayed in the PaymentElement form
        Integrate a custom fee to the tax calculation
        Place an order before a 3D Secure payment is collected
        Style the payment form at the checkout
        Test why a specific payment method doesn't appear
      Payments and tax app for Adobe Commerce
      Standalone tax app for Adobe Commerce
    Cegid
    Commercetools
    Mirakl
    NetSuite
    Oracle Opera
    PrestaShop
    Salesforce
    SAP
    Shopware 6
    Stripe Tax for BigCommerce
    Stripe Tax for WooCommerce
    Partner apps
    Build your own app
Partners
Partner ecosystem
Partner certification
HomeDeveloper resourcesUse apps from StripeAdobe CommerceCookbooks

Add custom events to Stripe webhooks

Extend the list of supported webhook events in the Stripe module for Adobe Commerce.

Stripe Webhooks is a tool to trigger actions based on events that occur in your Stripe account. This guide describes how to extend the Stripe module to add a custom event to the list of enabled events.

Create a new module

First, create a new module with the following directory structure. Replace Vendor with your preferred vendor name.

app/code/Vendor/StripeCustomizations/ ├── etc/ │ ├── module.xml │ └── di.xml ├── Plugin/ │ └── Webhooks/ │ └── EnabledEventsPlugin.php ├── registration.php

  • Register your module
  • Inside registration.php, register your module with Magento.

    <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Vendor_StripeCustomizations', __DIR__ );

  • Define your module configuration
  • Inside etc/module.xml, define the module and specify that it depends on the Stripe module.

    <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Vendor_StripeCustomizations" setup_version="1.0.0"> <sequence> <module name="StripeIntegration_Payments"/> </sequence> </module> </config>

  • Configure dependency injection
  • Inside etc/di.xml, define a plugin for the EnabledEvents class.

    <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="StripeIntegration\Payments\Model\Webhooks\EnabledEvents"> <plugin name="vendor_stripecustomizations_webhooks_enabledevents_plugin" type="Vendor\StripeCustomizations\Plugin\Webhooks\EnabledEventsPlugin" sortOrder="10" disabled="false" /> </type> </config>

  • Create the plugin
  • Inside Plugin/Webhooks/EnabledEventsPlugin.php, define an after plugin for the getEvents method.

    <?php namespace Vendor\StripeCustomizations\Plugin\Webhooks; use StripeIntegration\Payments\Model\Webhooks\EnabledEvents; class EnabledEventsPlugin { /** * After plugin for getEvents method. * * @param EnabledEvents $subject * @param array $result * @return array */ public function afterGetEvents(EnabledEvents $subject, array $result) { // Add custom events to the list $result[] = 'custom.event.example'; $result[] = 'another.custom.event'; return $result; } }

    Here, you add your custom events (custom.event.example and another.custom.event) to the existing list of events.

    For a full list of supported event types, please refer to the Types of events documentation.

  • Enable your module
  • Run the following commands to enable and deploy your module:

    php bin/magento module:enable Vendor_StripeCustomizations php bin/magento setup:upgrade php bin/magento cache:clean php bin/magento cache:flush

  • Verify the changes
  • Run the following command from the CLI to reconfigure webhooks:

    bin/magento stripe:webhooks:configure

    Navigate to your Stripe dashboard and manually inspect the new webhook endpoint configuration. When you hover over the Listening for xx events tab, you can see the new webhook event in the list.

    Was this page helpful?
    YesNo
    Need help? Contact Support.
    Join our early access programme.
    Check out our changelog.
    Questions? Contact Sales.
    LLM? Read llms.txt.
    Powered by Markdoc