Problem/Motivation

When a customer is on the Commerce checkout page and performs any AJAX-driven action — such as changing the country (which triggers a state/province field refresh) or applying/removing a coupon code — Drupal's form system serializes the form state and the associated payment gateway plugin into the session or temp store. Because USAePay stored a \SoapClient instance as a class property ($soapClient), this serialization fails with:

Exception: Serialization of 'Soap\Sdl' is not allowed in serialize()
(line 14 of /var/www/html/docroot/core/lib/Drupal/Component/Serialization/PhpSerialize.php)

Steps to reproduce

1. Add a product to the cart and proceed to checkout.
2. On the checkout page, either:
Change the Country field or submit a coupon.
3.Observe the Drupal watchdog/log for the serialization exception.
The AJAX response fails — the state dropdown does not update, or the coupon is not applied.

Proposed resolution

Remove the $soapClient property entirely. Instead of constructing a \SoapClient once at plugin instantiation and storing it, introduce a getSoapClient() method that creates a fresh \SoapClient because calls only happen during actual payment processing, not during every page/AJAX request.

Remaining tasks

User interface changes

None

API changes

Data model changes

None

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gkavin2 created an issue. See original summary.

g_miric’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.