A free payment gateway for Drupal Commerce that automatically approves all payments without collecting billing information. Perfect for testing, demonstrations, or scenarios where payment collection is not required.
- Automatic payment approval
- No billing address collection required
- Seamless integration with Commerce checkout flow
- Customizable payment instructions
- Automatic billing form hiding on method selection
- Test and Live modes support
- Comprehensive error logging
- Drupal: ^10 || ^11
- Commerce Payment: 3.x
- Download and extract the module to your
modules/customdirectory - Enable the module:
Or via the UI: Administration → Extend
drush en ec_payment_free
- Navigate to Commerce → Configuration → Payment gateways
- Click Add payment gateway
- Select Free Payment from the plugin dropdown
- Configure the gateway:
- Label: Enter a display name (e.g., "Test Payment")
- Mode: Choose Test or Live
- Payment instructions: Customize the message shown to customers during checkout
- Save the configuration
Once configured, the Free Payment gateway will appear as a payment option during checkout. When selected:
- The billing address form is automatically hidden
- Payment is processed immediately without external validation
- Orders are automatically marked as paid with status "Completed"
The module provides a helper service for programmatic payment creation:
// Get the helper service
$helper = \Drupal::service('ec_payment_free.helper');
// Create a payment for an order
$payment = $helper->paymentCreate($order, $gateway_id);
// Check if payment method is free payment
$is_free = $helper->isFreePayment($payment_plugin_id);- FreePayment.php: Main payment gateway plugin
- FreePaymentInformation.php: Custom checkout pane that hides billing fields
- FreePaymentForm.php: Offsite payment form handler
- Helper.php: Service for payment operations and gateway detection
This module is intended for testing and development purposes only. Do not use it in production environments where actual payment collection is required. All payments are automatically approved without any validation.
This is a custom module. For issues or feature requests, please contact your development team or module maintainer.
This module follows the same license as Drupal core (GPL v2 or later).
Developed for Drupal Commerce 3.x and Drupal 10/11.
Pavel Kasianov.
Linkedin: https://www.linkedin.com/in/pkasianov/
Drupal org: https://www.drupal.org/u/pkasianov