Support Commerce 3.x in commerce_paybox_payment

Created on 7 August 2025, 6 days ago
Updated 8 August 2025, 5 days ago

Problem/Motivation

The commerce_paybox_payment module is currently not compatible with Commerce 3.x. Although the module can be installed on a Drupal 10 site using Commerce 3.x, attempting to place an order using a Paybox payment gateway results in a fatal error:

Error: Call to a member function getPluginId() on null in Drupal\commerce_payment\PaymentStorage->doCreate() (line 50 of modules/contrib/commerce/modules/payment/src/PaymentStorage.php).

This indicates that the module does not properly initialize the payment gateway plugin before trying to create a payment entity, which is now required by Commerce 3.x (see change record ).

Steps to reproduce

  1. Install a clean Drupal 10 site with Commerce 3.x.
  2. Enable the commerce_paybox_payment module.
  3. Create a payment gateway using the Paybox plugin provided by the module.
  4. Place a product in the cart and proceed to checkout.
  5. Select the Paybox gateway and attempt to complete the payment.

Expected: The payment is processed via Paybox.

Actual: A fatal error is thrown due to an uninitialized plugin instance.

Proposed resolution

Update the commerce_paybox_payment module to support Commerce 3.x by ensuring compatibility with internal changes in the commerce_payment module.

The fatal error occurs because the payment gateway plugin is not properly initialized before calling PaymentStorage::create(). Commerce 3.x requires the gateway plugin to be set explicitly, as outlined in the following change record:
https://www.drupal.org/node/3468511 .

This merge request introduces the necessary adjustments to ensure the plugin is initialized, allowing payments to be processed correctly. Backward compatibility with Commerce 2.x is not guaranteed, so a separate 2.x release is recommended.

Remaining tasks

  • Review the changes introduced in this merge request.
  • Test the updated module with Commerce 3.x. It has been tested in a real project, but further review is appreciated due to the lack of automated tests.
  • Decide whether to create a new 2.x branch to support Commerce 3.x separately from the 1.x branch.
  • Confirm that all existing unit tests pass.
📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇫🇷France devator

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024