Version ie v5.13.37
Environment Docker
Bug Description
I am experiencing an issue with Stripe SEPA Direct Debit payments in Invoice Ninja.
Stripe is configured as the payment gateway in Invoice Ninja with the following credentials:
-
Publishable Key
-
API Key
-
Webhook Secret
The Stripe webhook is also configured correctly. The webhook endpoint in Stripe points to the Webhook URL displayed under Payment Providers in Invoice Ninja.
The webhook is configured in Stripe with the events required/supported by Invoice Ninja.
Steps to reproduce
-
Create an invoice in Invoice Ninja.
-
Select Stripe SEPA Direct Debit as the payment method.
-
Submit a payment using Stripeβs official test IBAN for a failed SEPA Direct Debit:
DE65370400440002222227Stripe documentation: https://docs.stripe.com/testing
-
Initially, the payment is accepted and Invoice Ninja marks the invoice as Paid.
-
Stripe subsequently processes the SEPA Direct Debit and determines that the payment has failed.
-
Stripe sends the failed-payment event to the configured Invoice Ninja webhook.
-
Invoice Ninja successfully receives the webhook event.
Actual behavior
Although Invoice Ninja receives the Stripe webhook indicating that the SEPA Direct Debit payment has failed, the invoice remains marked as Paid.
Under Payments in Invoice Ninja, the corresponding payment is shown as Pending, but the invoice status itself is not reverted or corrected.
This results in an inconsistent state:
-
Invoice status: Paid
-
Payment status: Pending / failed at Stripe
Expected behavior
When Stripe reports via webhook that the SEPA Direct Debit has failed, Invoice Ninja should update the corresponding payment and the invoice should no longer remain marked as Paid.
The invoice should be returned to the appropriate unpaid/outstanding status because the payment was not successfully completed.
Additional information
The Stripe webhook itself appears to be working correctly. Stripe shows that the failed-payment event was sent to the Invoice Ninja webhook endpoint, and Invoice Ninja appears to receive the event.
The issue therefore seems to occur when Invoice Ninja processes the failed Stripe SEPA Direct Debit webhook: the payment state is updated/recognized, but the invoice status is not reverted from Paid.