• Resolved RenderWarrior

    (@web4people)


    Hello,

    I’m trying to figuring a behavior of this plugin, as I’m copying some order details on a different database using a snippet.

    Today I get my email warning about an order failed, but when I checked, that order was completed.

    Checking the Woocommerce logs on the order page, I see that Stripe refused the card, then it accepted it.

    The log says

    Transazione Stripe completata (ID Transazione: ********)
    Gennaio 3, 2024 alle 14:28 Elimina nota
    
    Lo stato dell’ordine è cambiato da In lavorazione a Completato.
    Gennaio 3, 2024 alle 14:28 Elimina nota
    
    Lo stato dell’ordine è cambiato da Fallito a In lavorazione.
    Gennaio 3, 2024 alle 14:28 Elimina nota
    
    Autenticazione SCA Stripe fallita. Motivo: Your card was declined. Lo stato dell’ordine è cambiato da In attesa di pagamento a Fallito.
    
    Gennaio 3, 2024 alle 14:28 Elimina nota
    Stripe payment intent created (Payment Intent ID: ******)
    

    There’s a hook I can check about the payment completed?

    I’m triyng woocommerce_payment_complete but it seems not working (or at least, it doesn’t do anything)
    My checks about a failed order are made inside the woocommerce_order_status_failed and woocommerce_order_status_pending hooks.

    My other code is firing at woocommerce_checkout_order_processed, when I copy the data to my DB.

    But after a failed payment, if the plugin then accepts a payment, where can I get that result? So I could update my records from “failed” to “completed”. Is still the woocommerce_payment_complete hook?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Saif

    (@babylon1999)

    Hello @web4people,

    Thank you for reaching out!

    Checking the Woocommerce logs on the order page, I see that Stripe refused the card, then it accepted it.

    The team is already aware of this behaviour, you can find a detailed discussion about it #2660

    But after a failed payment, if the plugin then accepts a payment, where can I get that result? So I could update my records from “failed” to “completed”. Is still the woocommerce_payment_complete hook?

    Just to clarify, do you have a custom solution where you want to listen when this issue occurs in order to execute conditional logic?

    If so, you can utilize this hook: wc_gateway_stripe_process_webhook_payment_error

    Let us know if you have any other questions or if misunderstood your request. :?)

    Thread Starter RenderWarrior

    (@web4people)

    Thank you!

    Well, I copy order details on another db/tables for a custom platform where sellers could make some statistics based on specific requests (not available in Woo).

    Copying the data on the thank you page seems sometimes didn’t worked so I moved my logic to the woocommerce_checkout_order_processed and it works nice.
    But I discovered sometimes orders are failed and the snippet copies data even the order is failed. It happens with stripe (never happened with PayPal)

    So I added a logic on the woocommerce_order_status_failed and woocommerce_order_status_pending hooks, for capturing that state and updating my tables. And it works.

    But today I discovered the issue I told you, so… I saved the data, then I got a failed status, so I updated my rows, but then stripe approved the transaction, but I was not able to get that status change again.

    I think the hook you told me it’s not useful, as if it tells about errors, I already get the failed status from the other hook.

    Maybe could I use the woocommerce_order_status_changed?

    Saif

    (@babylon1999)

    Maybe could I use the woocommerce_order_status_changed?

    If I understand correctly, this will trigger irrespective of the payment method used, like PayPal, while you specifically intend to monitor Stripe-related errors, right?

    In that case, I recommend exploring the action hook I mentioned earlier.

    Please note that custom solutions are not something we can generally assist with per our?support policy. If you need more help with this, you might want to check the?#developers?channel of the?Woo Community Slack?or hire a?WooExpert.

    Let us know if you have any other questions!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How the payment check works (processing > failed > completed)’ is closed to new replies.