After paying for new membership, CiviCRM shows error message "Failed to update contribution in database"
Overview
I tested the Stripe payment processor by letting test users subscribe to memberships via the online form, which at the same time creates an account for the new user. A dozen or so test transactions went through totally fine. Then, without changing anything at the setup, users constantly receive the error message "Failed to update contribution in database" at the end of the transaction, when the thank you page should be shown. However, the payment is going through and the membership is getting created.
Reproduction steps on local test site
- Ensure that no user is logged in.
- Go to membership subscription page.
- Enter all details
- user name and password for wordpress account
- address
- credit card details
- confirm GDPR acceptance with checkbox
- Press button to confirm subscription
Current behaviour
user experience
- new user account gets created and user is logged into it
- instead of being redirected to the Thank You page, user is redirected to the membership renewal page
- at the top of the page, CiviCRM shows the error message:
Failed to update contribution in database
back end
- the new membership IS created, including the related contribution and payment transaction
- also in Stripe, the payment has been successful
CiviCRM Log File (debugging turned on)
- at the beginning of the transaction there are lots of warnings like these, which shouldn't be problematic:
[warning] Deprecated code: We have merged input params into the property bag for now but please rewrite code to not use this. [warning] Deprecated code: Unknown property 'amount'. We have merged this in for now as a custom property. Please rewrite your code to use PropertyBag->setCustomProperty if it is a genuinely custom property, or a standardised setter like PropertyBag->setContactID for standard properties
- then there is an info about a successful update of the contribution record
[info] Contribution record updated successfully
- This one is the only hint about something going wrong toward the end of the subscription process:
[debug] Stripe Exception: Event: charge.captured Error: No matching contributions for event evt_1G4PXbA9RNx8NDfgzD4Yezl9
Environment information
- CiviCRM: 5.21.1
- CMS: Wordpress 5.3.2
- Extension Stripe Payment Processor: 6.3.1
- Extension MJWShared: 0.6
- Extension GDPR: 2.8
Comments
What puzzles me most is the fact that the issue came up only after several successful transactions. I cannot remember exactly, but it MIGHT have happened that I mistyped the test credit card number and corrected it after an error message, just bevor the error occurred.
I do not know the internals well enough to make any educated guess. By looking at the database, the only table, where evt_xxx data are recorded, is civicrm_system_log. For this particular transaction, there are two entries for the event identifier that gets stated in the debug message:
I tried to resolve the issue by deinstalling/reinstalling the Stripe extension and clearing the civicrm_system_log table, but with no success.