bhekor / paymish-php
Official-style PHP SDK for the Paymish payment gateway API
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.0
- psr/simple-cache: ^3.0
Requires (Dev)
- phpunit/phpunit: ^10.0|^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-11 15:56:59 UTC
README
Framework-agnostic PHP SDK for the Paymish payment gateway. Covers transactions, transfers, virtual accounts, subscriptions, products, customers, and more.
Official API docs: https://api.paymish.com/api/user-service/external/v1/docs/
For Laravel apps, see also bhekor/laravel-paymish.
Requirements
- PHP 8.2+
- Guzzle 7+
- PSR-16 Simple Cache (optional, for token caching)
Installation
composer require bhekor/paymish-php
Quick start
use Bhekor\Paymish\PaymishClient; $paymish = new PaymishClient( publicKey: getenv('PAYMISH_PUBLIC_KEY') ?: null, secretKey: getenv('PAYMISH_SECRET_KEY') ?: null, // or: email: '...', password: '...', baseUrl: 'https://api.paymish.com', isLive: false, timeout: 30, ); // Initialize (hosted / redirect flow) $response = $paymish->transaction()->initialize([ 'email' => 'customer@email.com', 'amount' => '10000', 'currency' => 'NGN', 'channels' => ['card', 'ussd', 'nqr', 'transfer'], 'callback_url' => 'https://your-site.com/callback', ]); // Verify after callback or webhook $response = $paymish->transaction()->verify('transaction-reference'); // data.status: completed | failed | pending | reversed
The client auto-authenticates before API calls (in-memory bearer JWT; optional PSR-16 cache).
Amounts for initialize / DVA / transfers are in NGN major units (send 1100 for ₦1,100). OpenAPI may mention subunits; live Paymish treats the value as naira.
Security
- Never hardcode live card numbers, CVVs, or BVNs in application code.
- Prefer
initialize()+ Paymish hosted checkout over rawwithCard()when possible (PCI scope). - Examples below use sandbox/test placeholders only.
- Always re-verify payments server-side (
transaction()->verify()) and on webhooks — do not trust client redirects alone.
Configuration
| Constructor arg | Description | Default |
|---|---|---|
publicKey / secretKey |
OpenAPI keys (preferred) | null |
email / password |
Alternate auth | null |
baseUrl |
API base URL | https://api.paymish.com |
timeout |
HTTP timeout (seconds) | 30 |
isLive |
Live mode flag | false |
tokenCacheSeconds |
Bearer TTL when using cache | 3500 |
cache |
Psr\SimpleCache\CacheInterface |
null (in-memory only) |
endpoints |
Override endpoint map | bundled Config/endpoints.php |
Example with a PSR-16 cache:
use Bhekor\Paymish\PaymishClient; use Psr\SimpleCache\CacheInterface; /** @var CacheInterface $cache */ $paymish = new PaymishClient( publicKey: getenv('PAYMISH_PUBLIC_KEY') ?: null, secretKey: getenv('PAYMISH_SECRET_KEY') ?: null, cache: $cache, );
Documentation
| Topic | Guide |
|---|---|
| Authentication | docs/authentication.md |
| Transactions | docs/transactions.md |
| Transfers & recipients | docs/transfers.md |
| Virtual accounts | docs/virtual-accounts.md |
| Subscriptions & plans | docs/subscriptions-plans.md |
| Products & payment pages | docs/products-payment-pages.md |
| Customers & business | docs/customers-business.md |
| Splits & subaccounts | docs/splits-subaccounts.md |
| Disputes | docs/disputes.md |
| Webhooks | docs/webhooks.md |
| Errors & responses | docs/errors-responses.md |
Usage overview
use Bhekor\Paymish\PaymishClient; $paymish = new PaymishClient( publicKey: '...', secretKey: '...', ); $paymish->auth(); $paymish->transaction(); $paymish->transfer(); $paymish->recipient(); $paymish->dedicatedVirtualAccount(); $paymish->virtualAccount(); $paymish->subscription(); $paymish->plan(); $paymish->paymentPage(); $paymish->product(); $paymish->customer(); $paymish->business(); $paymish->splitPage(); $paymish->subaccount(); $paymish->dispute();
Testing
composer test
Changelog
Please see CHANGELOG.md for recent changes.
Contributing
Contributions are welcome — open a pull request or issue.
Credits
License
The MIT License (MIT). Please see LICENSE.md for more information.