Skip to content

Magento 2.4.5: What is the right event to retrieve all payment information

With the upgrade to Magento 2.4.5 from 2.4.2, the old code in an observer class in the custom module to get information about Stripe Payment isn’t working any more. It looks like Magento event sales_order_place_after isn’t able to help with retrieving payment information. I tried several other events including sales_order_load_after sales_order_save_before sales_order_save_after sales_order_delete_before sales_order_delete_after checkout_submit_all_after. Below is the code snippet that calls a function by passing a Stripe payment object and an array containing order details. $stripePayment->getCard() returns null although Magento admin shows all payment information

My events.xml that used to work until the recent Magento upgrade:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_place_after">
        <observer name="Perfectmakeupmirrors_sales_order_place_after" instance="PerfectmakeupmirrorsOrderObserverOrderPlaceAfter" />
    </event>
    <event name="sales_order_save_after">
        <observer name="Perfectmakeupmirrors_sales_order_save_after" instance="PerfectmakeupmirrorsOrderObserverOrderSaveAfter" />
    </event>
</config>

I’m looking for an event which is triggered at the end of Magento order cycle to be able to get the Payment information that I store in a separate DB.