Skip to content

Instantly share code, notes, and snippets.

@scottsb
Last active July 5, 2019 20:20
Embed
What would you like to do?
Patch for WooCommerce Auth.net DPM SHA2 Response Calculation

The WooCommerce Authorize.net DPM plugin (v.1.8.0) has a bug in the SHA2 response calculation, causing the following error to appear to customers when they enter invalid credit card information (as well as an email to the merchant admin email):

An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.

As a quick fix, open the file class-wc-authorize-net-relay-response-handler.php and search for this bit of code:

! empty( $data[ $hash_field ] )

And replace with this:

isset( $data[ $hash_field ] )

And then at your soonest opportunity switch to a different payment plugin, as the Authorize.net DPM integration method is deprecated and will be discontinued at some point. It also seems the plugin has been abandoned (no longer listed on WooCommerce's site).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment