• Resolved alpha2

    (@neoseeyou)


    Hello,

    We’ve noticed that some orders paid via SEPA payment method are reported as failed payments after a few days or even a few weeks.

    However, when this happens, the WooCommerce order status does not change from completed to failed so it’s hard for us to report these orders.

    Could you please confirm whether the Stripe module is supposed to update the order status when a SEPA payment subsequently fails?

    Thanks

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Clayton R

    (@mrclayton)

    Hi @neoseeyou

    Thank you for contacting Payment Plugins. The plugin is designed to use webhooks to update the order status when a SEPA payment fails. Here is a link to the plugin’s webhook documentation.

    https://paymentplugins.com/documentation/stripe/webhooks/

    Make sure your webhook is setup and that it’s receiving the notifications from Stripe.

    Kind Regards

    Thread Starter alpha2

    (@neoseeyou)

    Hi,

    Thanks for your reply.

    We have checked the webhook setup, but we also reviewed the plugin source code because we wanted to understand the exact behaviour when a SEPA payment fails several days after the order has already been processed.

    From what we can see in the code, when the order has already reached the completed status, the plugin appears to consider it as finalized and does not move it back to failed when a later charge.failed webhook is received.

    So the webhook itself may be received correctly, but the order status would still remain completed.

    Could you please confirm whether this is the expected behaviour?

    Plugin Author Clayton R

    (@mrclayton)

    Hi @neoseeyou

    Could you please confirm whether this is the expected behaviour?

    Yes, that is the expected behavior. If an order is marked as completed, that’s the status that indicates payment has been received. You would not want to mark an order as failed if it has been marked as completed in your system.

    The Stripe plugin sets the SEPA order’s status to on-hold by default. Then, when the payment intent succeeded webhook is received, the order’s status is updated to processing/completed.

    An order that has not had payment completed should not be marked as completed in your system.

    Kind Regards

    Thread Starter alpha2

    (@neoseeyou)

    Hi,

    Thanks for the clarification.

    I understand the logic regarding failed SEPA payments. However, our concern is specifically about SEPA disputes occurring after the payment has already been successfully completed.

    With SEPA Direct Debit, a payment can legitimately be marked as successful, the WooCommerce order can therefore be processed and completed, and the goods can already have been shipped.

    But the customer still has an 8-week period after the debit to dispute the payment through their bank, on a no-questions-asked basis. Stripe also confirms that disputes within this period are automatically honoured.

    This is not only a theoretical case for us: we have already had orders where the SEPA payment was successfully processed, the order was shipped, and the customer later disputed the debit and was reimbursed by their bank.

    So in that situation, keeping the WooCommerce order as completed after receiving the later dispute makes it difficult operationally for us to identify that the payment has effectively been reversed.

    Thanks

    Plugin Author Clayton R

    (@mrclayton)

    Hi @neoseeyou

    There is already a separate webhook flow for disputes since that corresponds to the charge.dispute_created webhook. That is the webhook that fires when a dispute is created by Stripe.

    When the dispute webhook is received the order’s status is set to on-hold by default. Make sure you have that feature turned on via the Advanced Settings page.

    https://paymentplugins.com/documentation/stripe/advanced-settings/#dispute-created

    Are you observing a different webhook event when the dispute is created?

    Kind Regards

    Thread Starter alpha2

    (@neoseeyou)

    Hi,

    Thanks, that distinction is helpful.

    I checked one of our actual SEPA cases in Stripe Workbench, and it appears to be slightly different from the charge.dispute.created flow you described.

    In this case:

    • the SEPA payment was initiated and remained processing for several days;
    • Stripe later displayed the message that the customer had requested a refund from their bank;
    • the actual events generated by Stripe were charge.failed and payment_intent.payment_failed;
    • there was no charge.dispute.created event;
    • the WooCommerce order had already been marked as completed, and it remained completed after the charge.failed event.

    So this seems to be the exact case we were initially referring to: a late SEPA bank return/refund request that Stripe reports through charge.failed, while the WooCommerce order has already reached completed.

    As you confirmed previously, your plugin intentionally does not move an already completed order back to failed.

    Regards

    Plugin Author Clayton R

    (@mrclayton)

    Hi @neoseeyou

    The Stripe plugin would not have moved the SEPA order to completed though so it sounds like you have some other functionality that caused that. The Stripe plugin only calls the WC_Order::payment_complete() method once the payment_intent.succeeded event is received from Stripe.

    Can you share the order notes for the order in question? That will shed some light on the series of events that led to the status being updated to completed.

    Based on your description it sounds like the payment_intent.succeeded was never triggered on your site so I am confident the Stripe plugin isn’t the reason the status updated to completed.

    Kind Regards

    Thread Starter alpha2

    (@neoseeyou)

    Hi,

    Thanks, that explains the misunderstanding.

    In our case, the order being completed is expected and comes from our own internal workflow.

    For operational reasons, we do not wait for the final SEPA confirmation before processing the order. The order is initially placed on-hold, then after our internal validation we manually move it to processing, and later to completed once it has been fulfilled.

    So I agree that your Stripe plugin is not responsible for moving this particular order to completed.

    The issue we are trying to address is what happens afterwards:

    • the SEPA order has already been processed and completed by our internal workflow;
    • several days later Stripe sends a charge.failed event;
    • because the WooCommerce order is already completed, the Stripe plugin intentionally leaves its status unchanged;
    • operationally, we then have a completed order for which the SEPA payment has actually failed.

    We have therefore developed a small custom MU-plugin for our specific workflow. It listens for late SEPA charge.failed events and, when the related order is already processing or completed, moves it to failed and alerts our customer service team.

    We understand this is specific to our business process rather than an issue with the default behaviour of your plugin.

    Is wc_stripe_webhook_charge_failed the appropriate hook for implementing this custom handling, or would you recommend another hook/API exposed by Payment Plugins for this use case?

    Plugin Author Clayton R

    (@mrclayton)

    Hi @neoseeyou

    Thank you for that explanation. Yes, the action wc_stripe_webhook_charge_failed is what you would want to use for your custom handling.

    Kind Regards

    Plugin Author Clayton R

    (@mrclayton)

    Hi @neoseeyou

    Can you share your custom code from the MU-plugin? In the plugin function wc_stripe_process_charge_failed we’re looking at changing one of the conditional checks from $order->get_date_completed() to $order->get_paid_date().

    Kind Regards

    Thread Starter alpha2

    (@neoseeyou)

    Hello

    COuld you give me an email address where i can send you our mu plugin ?

    Regards

    Plugin Author Clayton R

    (@mrclayton)

    Hi @neoseeyou

    You can create a support ticket within your WordPress Admin on the Stripe plugin settings pages.

    Kind Regards

    Thread Starter alpha2

    (@neoseeyou)

    done

Viewing 13 replies - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.