Skip to main content

Getting Started

A clean, lightweight, developer-friendly PHP wrapper for the Paystack API.

Installation​

composer require matscode/paystack-php-sdk

Initialization​

Instantiate the Paystack client using your secret key from the Paystack Dashboard:

use Matscode\Paystack\Paystack;

$paystack = new Paystack('sk_test_your_secret_key');
Keep Your Secret Key Safe

Never expose your Paystack secret key (sk_live_...) in frontend client-side code or public repositories. Always load it from environment variables (e.g., $_ENV['PAYSTACK_SECRET_KEY']) on your backend server.

SDK Architecture Resources are accessed directly as properties on the $paystack instance, mirroring the SDK's directory and namespace layout​

CategoryProperty AccessAvailable Methods
Transaction$paystack->transactioninitialize(), verify(), list(), fetch()
Plan$paystack->plancreate(), list(), fetch(), update()
Bank$paystack->miscellaneous->banklist(), resolve(), validate()
Subscription$paystack->subscriptioncreate(), list(), fetch(), enable(), disable()
Card$paystack->miscellaneous->cardresolveInfo()
Country$paystack->miscellaneous->countrylist()
Currency Denominations

Paystack expects all transaction and plan amounts in the lowest currency denomination (for example, kobo for NGN or pesewas for GHS). Multiply your base amount by 100 before passing it to the SDK.