mirrorps / drupal-taler-payments
Custom Drupal module integrating GNU Taler payments via the TalerPHP SDK.
Package info
github.com/mirrorps/drupal-taler-payments
Type:drupal-custom-module
pkg:composer/mirrorps/drupal-taler-payments
Requires
- php: >=8.1
- ext-openssl: *
- mirrorps/taler-php: ~1.2.0
Requires (Dev)
- roave/security-advisories: dev-latest
README
Developer-focused and site-builder-friendly documentation for the custom Drupal module that integrates GNU Taler payments.
This module adds a configurable Drupal block that starts a GNU Taler checkout flow, creates Merchant Backend orders on demand, opens the wallet with a taler:// URI, and supports QR-based mobile payment.
Who This Is For
This README is written for two audiences:
- Drupal site administrators and editors who want to place a Taler payment button on a page.
- Developers who need to install, configure, extend, test, or contribute to the module.
Quick Start For Site Owners
If you only need to use the module on your Drupal site:
- Install the module and its Composer dependencies.
- Enable
taler_paymentsfromExtendor with Drush. - Open the settings page at
/admin/config/services/taler-payments. - Save:
- A Taler Base URL that includes the instance path and uses
https:// - Either an Access Token or Username/Password/Instance ID
- A Taler Base URL that includes the instance path and uses
- Place the
Taler payment buttonblock in a region or layout. - Configure the block:
- Button text
- Summary
- Amount
- Save the block and visit the page where it appears.
Requirements
- Drupal
^10 || ^11 - PHP
>= 8.1 - PHP OpenSSL extension (
ext-openssl) - Composer
- Reachable GNU Taler Merchant Backend over HTTPS
- The Composer package
mirrorps/drupal-taler-payments
Installation
Install the module in your Drupal codebase with Composer.
Example from the Drupal project root:
composer require mirrorps/drupal-taler-payments drush en taler_payments -y
Configuration
Open the module settings page:
- URL:
/admin/config/services/taler-payments - Admin menu:
Configuration->Web services->Taler Payments
The settings page is split into four sections.
1. Base URL
- Must be an absolute
https://URL - Must include the Merchant Backend instance path
- Example:
https://backend.demo.taler.net/instances/sandbox
2. Access Token
- Enter the full Authorization header value
- Example:
Bearer secret-token:sandbox - The token is encrypted before it is stored
** Never commit or share a real token.
3. Username And Password
- Requires:
- Instance ID
- Username
- Password
- The password is encrypted before it is stored
4. Public Text Customization
Optional text overrides for the public checkout page:
- Call-to-action
- Thank you message
- Payment button CTA
If these values are left empty, the module uses safe defaults.
Authentication Behavior
Two authentication methods are supported:
- Access token
- Username/password/instance ID
If both are configured, access token authentication takes priority.
How To Show The Taler Payment Block
This is the main user-facing feature of the module.
Place The Block In Standard Block Layout
- Go to
Structure->Block layout. - Choose the region where you want the payment button to appear.
- Click
Place block. - Search for
Taler payment button. - Click
Place block. - Fill in the block settings:
Button text: text shown on the buttonSummary: text describing the paymentAmount: GNU Taler amount format such asEUR:1.00orKUDOS:0.50
- Save the block.
- Save the block layout.
Use The Block In Layout Builder
If your site uses Layout Builder, add the Taler payment button block the same way you would add any other custom block plugin to a section.
Important Notes For Editors
- Each placed block instance has its own button text, summary, and amount.
- The amount must follow GNU Taler format:
CURRENCY:VALUE - Examples:
EUR:1.00KUDOS:0.11
- When a visitor clicks the button, the order is created at that moment
- The visitor is redirected to a checkout page managed by this module
What Visitors See
After clicking the payment button, the visitor is sent to a Drupal checkout page managed by this module.
The checkout page shows:
- A short call-to-action message
- The payment summary
- The amount
- The order ID
- A wallet button when a valid
taler://URI is available - A QR code for mobile wallet scanning
- Automatic payment status polling
- A thank-you message after successful payment
The module also adds the taler URI scheme to Drupal allowed protocols and outputs the Taler support meta tag on checkout pages.
Core Behavior
- Block plugin:
Taler payment button - Orders are created only after user interaction
- Recent unpaid checkout intents may be reused briefly instead of creating duplicate orders immediately
- Checkout status is polled in the browser until a final state is reached
Developer Notes
Main Components
src/Plugin/Block/TalerPaymentButtonBlock.phpDrupal block plugin with per-instance settings.src/TalerPaymentButtonBuilder.phpBuilds the button render array and start-checkout link.src/Controller/TalerCheckoutController.phpHandles checkout start, checkout page rendering, and status polling.src/Checkout/TalerCheckoutManager.phpCreates orders, reuses recent intents, and maps Taler order status.src/Service/TalerClientManager.phpBuilds the configured Taler PHP SDK client.src/Form/*Admin forms for base URL, credentials, and public text customization.src/PublicText/TalerPublicTextProvider.phpResolves user-facing text with defaults and configuration overrides.
Frontend Assets
js/taler-payment-button.jsjs/taler-checkout-polling.jscss/taler-payment-button.cssjs/vendor/qrcodejs/qrcode.min.js
Configuration Storage
Settings are stored in Drupal configuration.
Sensitive credentials are encrypted before storage.
Local Development
Install dependencies:
composer install
Enable the module in your Drupal environment:
drush en taler_payments -y
Running Tests
This module currently includes unit tests.
From a Drupal project where the module is installed, run:
vendor/bin/phpunit web/modules/custom/taler_payments/tests/src/Unit
Project Structure
config/installDefault module configurationconfig/schemaConfig schema definitionssrc/Plugin/BlockBlock pluginsrc/ControllerCheckout and settings page controllerssrc/FormAdmin settings formssrc/CheckoutCheckout state and Taler order orchestrationsrc/ServiceTaler client bootstrapsrc/SecurityCredential encryptionsrc/PublicTextPublic text defaults and overridessrc/ValidationInput validation helpersjsFrontend behaviorcssFrontend stylingtests/src/UnitUnit tests
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Privacy
The module does not create user profiles.
When users trigger payment actions, Drupal sends order-related requests to the configured Merchant Backend. Hosting and backend logs may include metadata such as IP addresses and request details.
License And Third-Party Components
- Module license: GPLv2 or later
- Bundled component:
js/vendor/qrcodejs/qrcode.min.js(MIT License, davidshimjs)
See:
js/vendor/qrcodejs/LICENSE
Funding
This project is funded through NGI TALER Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program. Learn more at the NLnet project page.