Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Payment
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 Jul 2017 at 01:02 UTC
Updated:
4 Nov 2019 at 21:16 UTC
Jump to comment: Most recent
Comments
Comment #2
bojanz commentedSounds like you have broken data in your system that you'll have to clean up first.
Payment methods must always reference a payment gateway. Yours were probably orphaned when you deleted a gateway.
Comment #3
zenimagine commentedI uninstalled PayPlug and I encounter the same error. I will wait for the payment module to update.
Comment #4
barry6575 commented@bojanz can you advise where I would find the data in the system to clean up.
I deleted all of my test orders, but my add payment method page is broken so I'm unable to delete my test payment methods.
Comment #5
zenimagine commented@barry6575 in /admin/modules/uninstall "Commerce Payment", simply click on the "Remove payment" link and update the database.
Comment #6
barry6575 commented@zenimagibe that did it...Thanks!
Comment #7
barry6575 commentedComment #8
sriharsha.uppuluri commentedI have 210 payments if I do like that all the information will be lost. Is there an alternative to this?
Comment #9
bojanz commentedYes. Fix your payment gateway. We submitted patches to each known gateway, perhaps yours is in the list, allowing you to apply the patch and then proceed to update.php
Comment #11
sagesolutions commented@bojanz, you mentioned you submitted patches to each known gateway... Where would I find these patches? in particular, I need the Stripe patch.
Thanks!
Comment #12
bojanz commentedNo you don't, Stripe is up to date, we committed a fix directly and tagged a release.
Comment #13
bbuchert commentedI think you have to update Stripe first and then update Commerce.
Comment #14
bbuchert commentedSorry due to my slow connection I posted this twice.
Comment #15
luksak@bojanz This still happened to me updating today with a deleted payment gateway caused by
commerce_payment_post_update_3()...Comment #16
aaronbaumanThis is the first google result for the error, so I'm providing my workaround here.
In my case, this error occured when updating from 2.13 to 2.14, but the workaround should be applicable whenever the error is encountered.
I'm testing database update locally using a sanitized database which does not include production gateway settings.
My database has one local payment method, machine name
authorize_sandbox_environment.But, the payments in tables
commerce_paymentandcommerce_payment_methodreference other payment gateways in the "payment_gateway" column, thus commerce_payment's update method fails with a fatal error that blocks all subsequent updates from completing.I worked around the issue with the following 2 SQL queries.
These queries reassign the invalid commerce payment entries to point at the existing payment gateway config:
Replace "authorize_sandbox_environment" with the machine name of a valid payment config on your system.
This method is not for you if you're concerned about possibly invalidating any of your old payment data.
Comment #17
alejo dMy workaround:
I had this issue with Orphans payments. I had to add again those old payments gateways removed from the system to execute that update.
Context
When you remove a Payment gateway in the table commerce_payment_method still there the relation with that payment gateway. There is why when the update try to duplicate and save the entity fails, because doesn't exists.
Comment #18
golubovicm commentedI have the same error, with Datatrans payment gateway after I'm redirected back to site and only when aliases are turned on (to support recurring payments). When they are off everything works fine. And I didn't delete any payment gateway. Also tried clicking "Remove payment" (there are actually 2 links named similar, tried clicking both) but didn't help. Any idea?
Drupal\Core\Entity\EntityStorageException: Required payment method field "payment_gateway" is empty. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).