pstk / paystack-magento2-module
pstk/paystack-magento2-module
Paystack Payments for Magento 2
Paystack payment gateway extension for Magento 2
Version: 3.0.11 (Paystack v2 Inline.js API)
Requirements
- Magento 2.4.x
- PHP 8.2+
Installation
Composer (Recommended)
Go to your Magento2 root folder and run:
composer require pstk/paystack-magento2-module
php bin/magento module:enable Pstk_Paystack
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
Manual Installation
Copy all files to app/code/Pstk/Paystack/ in your Magento installation, then run:
php bin/magento module:enable Pstk_Paystack
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
Configuration
To configure the plugin in Magento Admin:
- Go to Stores > Configuration > Sales > Payment Methods.
- Find Paystack and configure:
- Enabled: Yes/No
- Title: What customers see at checkout
- Integration Type: Inline (Popup) or Redirect
- Test Mode: Enable for sandbox testing
- Test/Live Secret Key: Get from your Paystack dashboard
- Test/Live Public Key: Get from your Paystack dashboard
- Click Save Config.
Webhook Setup
For reliable payment confirmation (especially for the redirect flow), set up a webhook in your Paystack dashboard:
- Go to Settings > API Keys & Webhooks on your Paystack dashboard
- Set the Webhook URL to:
https://yourdomain.com/paystack/payment/webhook - The module handles
charge.successevents and automatically updates order status
Development Environment
A Docker-based development environment is included in the dev/ directory for contributors and testing.
Prerequisites
- Docker (or Rancher Desktop with
dockerdruntime) - A Paystack test account
Quick Start
cd dev
cp .env.example .env # Add your Paystack test keys
docker compose up -d # First run builds the image (~5 min) and installs Magento (~3 min)
bash setup.sh # Enables module, creates test products, configures everything
Once complete you'll see:
============================================
Setup complete!
Storefront: http://localhost:8080
Admin panel: http://localhost:8080/admin
Admin login: admin / Admin12345!
Test card: 4084 0840 8408 4081
Expiry: 12/30
CVV: 408
PIN: 0000
OTP: 123456
============================================
What's Included
- Magento 2.4.8-p3 via Mage-OS public mirror (no Adobe marketplace auth needed)
- OpenSearch 2.19.1 + MariaDB 10.6
- 5 test products with images and a configured homepage
- Paystack payment pre-configured in test mode (inline popup)
- Container names:
paystack-magento,paystack-db,paystack-search
Tear Down
cd dev
docker compose down # Stop containers (preserves data)
docker compose down -v # Stop containers and delete all data
Documentation
Support
For bug reports and feature requests directly related to this plugin, please use the issue tracker.
For general support or questions about your Paystack account, you can reach out by sending a message from our website.
Community
If you are a developer, please join our Developer Community on Slack.
Contributing to the Magento 2 plugin
If you have a patch or have stumbled upon an issue with the Magento 2 plugin, you can contribute this back to the code. Please read our contributor guidelines for more information how you can do this.
Changelog
All notable changes to the Paystack Magento 2 module are documented here.
This project adheres to Semantic Versioning.
The entries below cover every release since the last tag, v3.0.10.
[3.0.11] - 2026-08-17
Corrects the transaction payload sent to Paystack: the amount is now always an
integer number of currency subunits, and the order's own currency is sent.
Fixed
- Redirect-mode checkout failed outright on many order totals. The amount
was sent asgrandTotal * 100, a floating-point product — so a 19.99 order
became1998.9999999999998. Paystack rejects a non-integer amount
("amount" must be an integer,invalid_amount), which surfaced to the
customer as a failed checkout they could not complete. Totals such as 19.99,
1.10, 0.29 and 8.21 were affected; totals whose product is exactly
representable, such as 5000.00, were not — which is why this was
intermittent. The amount is now an integer number of subunits.
Thanks to @iammcoding (#70). - Inline (popup) mode overcharged by one subunit on some totals. The amount
usedMath.ceil, soMath.ceil(8.21 * 100)produced 822 instead of 821
whenever the float product landed just above the integer. Now uses
Math.round. - Redirect mode sent no currency at all. The code called
$order->getCurrency(), which is not a method onMagento\Sales\Model\Order
— it resolved through Magento's magic getter to a non-existentcurrency
column and returnednull. Paystack silently substitutes the integration's
default currency for a null value, so orders were charged the correct number
in the merchant's default currency rather than the order's. On a store whose
display currency differs from the Paystack default this mischarged
significantly: a 12.50 USD order was charged as 12.50 in the default
currency. Now sendsgetOrderCurrencyCode().
Upgrade note
If your Paystack integration does not have your store's currency enabled, the
redirect flow will now fail with unsupported_currency where it previously
completed (in the wrong currency). Enable your store's currency on your Paystack
integration. This is a deliberate change: a visible failure is better than a
silent mischarge.
[3.0.10] - 2026-07-17
Consolidated release for Magento 2.4.9 / PHP 8.5, verified end-to-end with
Content-Security-Policy enforced.
Fixed
- Payment verification failed on PHP 8.5 even when the payment succeeded.
Gateway/PaystackApiClient.phpcalledcurl_close(), which is deprecated in
PHP 8.5 (a no-op since PHP 8.0). Magento escalates the deprecation to an
exception, and it fired after the charge was confirmed — so customers saw
"Payment verification failed" despite a successful payment. Removed all
curl_close()calls (the handle is freed automatically). - Admin order creation on Adobe Commerce (EE). The payment method now
implementsMethodInterfacedirectly instead of extendingAbstractMethod,
andgetInfoInstance()matches the expected contract, preventing EE-only
interceptors from crashing admin pages. Adds a defence-in-depth admin-area guard.
Added
- PHPUnit unit-test suite (
Test/Unit/**,phpunit.xml) covering the payment
model, controllers, gateway client, observers, config provider, and plugins. - End-to-end test coverage and a dedicated admin-config MFTF page object/section.
[3.0.9] - 2026-07-17
Superseded by 3.0.10 (its fixes are included there).
Fixed
- Checkout page hung on the loading spinner under enforced CSP. The module's
PHP CSPPolicyCollectorreplaced Magento's entire Content-Security-Policy,
dropping'self'fromscript-srcand blocking Magento's own JavaScript on the
checkout page (CSP is enforced by default on checkout/payment pages since 2.4.7).
Replaced with the standard, additiveetc/csp_whitelist.xmlmechanism. - MFTF
PaystackPaymentConfigAvailableTest404'd in the Adobe pipeline. The
test navigated with a rawamOnPage url="admin/..."that resolved to
/admin/admin/.... Switched to anarea="admin"page object (emits a correct
base-relative URL) and coreAdminLoginActionGroup/AdminLogoutActionGroup.
[3.0.8] - 2026-06-22
Added
- Storefront guest-checkout MFTF coverage (
StorefrontPaystackCheckoutRendersTest)
guarding against the "checkout does not load" class of failure.
Changed
- Hardened the Adobe Marketplace build script so internal artifacts are excluded
from the published zip.
[3.0.7] - 2026-04-07
Changed
- Version bump (no functional changes).
[3.0.6] - 2026-04-07
Changed
- Reworked the checkout method-renderer JavaScript to lazy-load the Paystack Inline
SDK, so a slow/blocked SDK no longer stalls checkout rendering. - Updated
ConfigProviderand the payment model.
Added
- First vendor MFTF test (
PaystackPaymentConfigAvailableTest) verifying the
payment method appears in admin configuration. - Empty
etc/adminhtml/di.xmlto keep the module out of the admin DI scope.
[3.0.5] - 2026-03-06
Fixed
- Admin order-create crash on Adobe Commerce (EE). Scoped the
PaymentManagementInterfacepreference tofrontend/webapi_rest(removed from
the global/admin scope) and lazy-loaded the payment method, so admin order
creation and MFTF tests are no longer affected by frontend-only dependencies.
Note: 3.0.5–3.0.9 were not individually tagged — they were released together as
v3.0.10.
See the commit history since
v3.0.4 for details.
| Version | Stability | QA Status | Compatibility | Released |
|---|---|---|---|---|
| 3.0.11 | stable | Fail | Magento 2.4.7-2.4.9 Details | 2026-08-17 09:05:50 |
| 3.0.10 | stable | Fail | Magento 2.4.7-2.4.9 Details | 2026-07-17 16:14:27 |
| 3.0.4 | stable | Fail | Magento 2.4.7-2.4.9 Details | 2026-03-06 12:30:44 |
| 3.0.3 | stable | Not tested | Not yet tested Details | 2026-02-27 11:03:26 |
| 3.0.2 | stable | Not tested | Not yet tested Details | 2026-02-26 10:07:19 |
| 3.0.1 | stable | Not tested | Not yet tested Details | 2026-02-25 14:04:58 |
| 3.0.0 | stable | Not tested | Not yet tested Details | 2026-02-17 20:49:21 |
| 2.5.0 | stable | Not tested | Not yet tested Details | 2025-11-25 20:42:43 |
| 2.4.1 | stable | Not tested | Not yet tested Details | 2020-02-25 20:58:59 |
| 2.3.5 | stable | Not tested | Not yet tested Details | 2019-12-11 17:39:39 |
| v2.0.0 | stable | Not tested | Not yet tested Details | 2019-05-31 18:39:04 |
| v1.0.2 | stable | Not tested | Not yet tested Details | 2019-02-05 10:12:07 |
| 1.0.0 | stable | Not tested | Not yet tested Details | 2018-02-20 16:05:17 |
| 0.9.17 | stable | Not tested | Not yet tested Details | 2017-11-14 13:14:08 |
| 0.9.16 | stable | Not tested | Not yet tested Details | 2017-07-17 19:27:44 |
| 0.9.15 | stable | Not tested | Not yet tested Details | 2017-06-28 17:17:16 |
| 0.9.13 | stable | Not tested | Not yet tested Details | 2017-03-22 18:29:37 |
| 0.9.12 | stable | Not tested | Not yet tested Details | 2017-03-06 14:34:25 |
| 0.9.11 | stable | Not tested | Not yet tested Details | 2017-02-23 18:12:31 |
| 0.9.10 | stable | Not tested | Not yet tested Details | 2017-02-23 17:38:17 |
| 0.9.9 | stable | Not tested | Not yet tested Details | 2017-02-23 17:15:29 |
| 0.9.8 | stable | Not tested | Not yet tested Details | 2017-02-23 15:23:13 |
| 0.9.7-beta | beta | Not tested | Not yet tested Details | 2017-02-23 15:21:09 |
| 0.9.6-beta | beta | Not tested | Not yet tested Details | 2017-02-23 15:18:52 |
| 0.9.4-beta | beta | Not tested | Not yet tested Details | 2017-02-23 15:09:57 |
No dependencies declared
This package's composer.json doesn't declare any required, suggested, replaced, or conflicting packages.
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. A phpcs finding can't make a module incompatible.
Static analysis
Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.
| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 170 | 12 errors, 158 warnings (ruleset: Magento2), 98 auto-fixable with phpcbf |
| PHPMD | Warning | 52 | 52 rule violations (UnusedPrivateField:52) |
| Cpd | Warning | 2 | 2 duplicated chunks spanning 23 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Info | 2 | valid; 2 advisory notes (composer validate --strict) |
PHPStan
Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
Unit tests
Integration tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
Turn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.