Drupal Commerce
Integrate Cost+ with your Drupal Commerce store using the official payment gateway module

Integrate Cost+ as a payment method in your Drupal Commerce store. The official NoPayn Payment Gateway module uses the Hosted Payment Page flow, so no card data touches your server — fully PCI DSS compliant.
Prerequisites
- Active Cost+ merchant account
- Drupal 10 or 11
- Drupal Commerce 3.x
- PHP 8.1 or later
- Admin access to your Drupal site
Supported Payment Methods
- Credit / Debit Card — Visa, Mastercard, and more
- Apple Pay
- Google Pay
- Vipps / MobilePay
1. Install the Module
Copy the commerce_nopayn module into your Drupal installation and enable it:
cp -r commerce_nopayn /path/to/drupal/web/modules/custom/
drush en commerce_nopayn -y
drush crYou can also download the module directly from the GitHub repository.
2. Add a Payment Gateway
- Navigate to Commerce → Configuration → Payment gateways (
/admin/commerce/config/payment-gateways) - Click Add payment gateway
- Select NoPayn Payment Gateway as the plugin
3. Configure the Gateway
Enter the following settings:
- NoPayn API Key — Your merchant API key from the Merchant Portal
- Payment Methods — Enable or disable Credit Card, Apple Pay, Google Pay, Vipps MobilePay
- Mode — Set to Test when using an API key from a sandbox website, or Live when using a production website key
Only activate the payment methods you have been approved for and received confirmation for.
Optional Settings
- Manual Capture — Authorize credit card payments without immediate capture (funds are reserved, then captured when the order is fulfilled)
- Debug Logging — Enable to log all API requests and responses to the Drupal log for troubleshooting
Click Save when done.
4. Payment Flow
Once configured, the payment flow works as follows:
- Customer adds products to cart and proceeds to checkout
- At the payment step, enabled Cost+ methods are shown as radio buttons
- Customer selects a method and confirms the order
- The module creates an order via the Cost+ API and redirects to the hosted payment page
- Customer completes payment on the Cost+ page
- Customer returns to the store — payment is verified via API
- A webhook from Cost+ asynchronously confirms the payment result
Payment sessions expire after 5 minutes per Cost+ standards. The module also sends itemized order lines (products and shipping) to Cost+ for detailed transaction records.
5. Webhook Configuration
The webhook URL is automatically generated by Drupal Commerce:
https://your-store.com/payment/notify/{gateway_machine_name}For example: https://your-store.com/payment/notify/nopayn
This URL must be accessible from the internet without authentication. The module always verifies payment status via the API — it never trusts the webhook payload alone.
Manual Capture
When manual capture is enabled for credit cards:
- Customer's card is authorized (funds reserved) during checkout
- Capture occurs automatically when the order transitions to Fulfilled
- If the order is cancelled, the authorization is voided via webhook
Use manual capture if you want to only charge customers when their order ships. This is useful for merchants with longer fulfillment times.
Refunds
Refunds can be processed directly from the Commerce admin panel. Both full and partial refunds are supported.
Database Tables
The module creates two tables for tracking:
| Table | Purpose |
|---|---|
nopayn_transactions | Tracks payment orders created with the Cost+ API |
nopayn_refunds | Records refund operations for audit purposes |
Uninstallation
drush pmu commerce_nopayn -y
drush crUninstalling the module will drop the nopayn_transactions and nopayn_refunds tables. Make sure to export any data you need before uninstalling.
Test and Launch
Place a few test transactions to ensure everything works smoothly. Set the gateway Mode to Test and verify both successful and failed payments before switching to Live.
Support
Need help? Reach out to our support team at support@costplus.io.