pstk / paystack-magento2-module

pstk/paystack-magento2-module

  • Olayode Ezekiel
magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Fail Tests: Fail Security: Pass MIT

Are you the maintainer of pstk?

Packagento pulls pstk's Composer packages from the public registry so buyers can find them here.

Claim the namespace to take ownership, publish new releases directly, and start charging for premium versions.

Claim this namespace →

Latest Version on Packagist
Software License
Total Downloads

Paystack Magento 2 Module

Paystack payment gateway Magento2 extension

Version: 3.0.10 (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:

  1. Go to Stores > Configuration > Sales > Payment Methods.
  2. 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
  3. Click Save Config.

Webhook Setup

For reliable payment confirmation (especially for the redirect flow), set up a webhook in your Paystack dashboard:

  1. Go to Settings > API Keys & Webhooks on your Paystack dashboard
  2. Set the Webhook URL to: https://yourdomain.com/paystack/payment/webhook
  3. The module handles charge.success events and automatically updates order status

Development Environment

A Docker-based development environment is included in the dev/ directory for contributors and testing.

Prerequisites

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.4.

[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.php called curl_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
    implements MethodInterface directly instead of extending AbstractMethod,
    and getInfoInstance() 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 CSP PolicyCollector replaced Magento's entire Content-Security-Policy,
    dropping 'self' from script-src and 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, additive etc/csp_whitelist.xml mechanism.
  • MFTF PaystackPaymentConfigAvailableTest 404'd in the Adobe pipeline. The
    test navigated with a raw amOnPage url="admin/..." that resolved to
    /admin/admin/.... Switched to an area="admin" page object (emits a correct
    base-relative URL) and core AdminLoginActionGroup/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 ConfigProvider and the payment model.

Added

  • First vendor MFTF test (PaystackPaymentConfigAvailableTest) verifying the
    payment method appears in admin configuration.
  • Empty etc/adminhtml/di.xml to 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
    PaymentManagementInterface preference to frontend/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.10 were not individually tagged; see the commit history since
v3.0.4 for details.

Versions
Version Stability QA Status Compatibility Released
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.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

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.

Static analysis results
Tool Status Findings Summary
PHPCS Fail 170 12 errors, 158 warnings (ruleset: Magento2), 98 auto-fixable with phpcbf
PHPMD Warning 43 43 rule violations (UnusedFormalParameter:19, MissingImport:14, TooManyMethods:2, TooManyPublicMethods:2, ExcessiveClassComplexity:2)
Cpd Warning 1 1 duplicated chunk spanning 11 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.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 17 17
2.4.8 17 17
2.4.9 17 17

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

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 12 18
2.4.8 12 12
2.4.9 12 12

Integration tests

Integration tests results by Magento and PHP version
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.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
MIT
Authors
Make it pay

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.