Sign in

Developer Tools

Server SDKs

View as Markdown

In a nutshell

Install Paystack's official server SDKs for Node.js, Python and Ruby, and find community libraries for other languages.

Paystack's server SDKs call the Paystack API from your backend with your secret key. Use one to initialize and verify transactions, manage customers, send transfers and handle any other server-side call. If your language isn't listed, call the API with any HTTP client.

Keep your secret key on your server

Read your secret key from an environment variable or a secrets manager. Don't commit it to source control or ship it in frontend or mobile code. See API keys.

Copy linkOfficial SDKs

Copy linkInstall

npm install @paystack/paystack-sdk
pip install paystack-sdk
gem install paystack-ruby

Copy linkInitialize a transaction

Each example reads your secret key from the PAYSTACK_SECRET_KEY environment variable and calls Initialize Transaction. The amount is in cents. Use your test secret key (sk_test_...) while you build.

const { Paystack } = require('@paystack/paystack-sdk');

const paystack = new Paystack(process.env.PAYSTACK_SECRET_KEY);

paystack.transaction
  .initialize({ email: '[email protected]', amount: 20000 })
  .then((response) => console.log(response.data.authorization_url))
  .catch((error) => console.error(error));
import os

import paystack

paystack.api_key = os.environ['PAYSTACK_SECRET_KEY']

response = paystack.Transaction.initialize(email='[email protected]', amount=20000)
print(response)
require "paystack"

paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))

result = paystack.transaction.initialize({ email: "[email protected]", amount: 20000 })
puts result.data[:authorization_url]

Send the customer to the returned authorization_url, or pass the access_code to InlineJS to complete the payment on your page. Then verify the payment on your server before you deliver value.

Each repository's README lists every resource and method the SDK supports.

Copy linkCommunity server libraries

Warning

Community maintainers own these libraries, not Paystack. If you have an issue with one, contact the maintainer or open an issue on its repository.

LanguageLibraryRepository
.NetPaystack .Netadebisi-fa/paystack-dotnet
.NetPaystack .Net SDKdeveloperslearnit/Paystack.Net.SDK
Erlang/OTP (rebar3)Erl Paystackabimbola/erlpaystack
GoPaystack Gorpip/paystack-go
Groovy/GrailsPaystack Grailsdubems/paystack-grails
JavaPaystack JavaSeunAdelekan/PaystackJava
NodeJSPaystackkehers/paystack
NodeJSPaystack APIpariola/paystack
PHPCakePHP Paystackjtad009/cakephp-paystack
PHPCashier Paystackwisdomanthoni/cashier-paystack
PHPLaravel Paystackunicodeveloper/laravel-paystack
PHPPaystack PHPperfectmak/paystack-php
PHPPaystackmatscode/paystack
PythonPy Paystackedwardpopoola/pypaystack
PythonPaystackojengwa/paystack
PythonPaystack Pythonandela-sjames/paystack-python
PythonPython PaystackChibuzor-IN/python-paystack
PythonPy Paystackfrier17/pypaystack
RPaystackebinabo/paystack
RubyPaystackrojengwa/paystackr
RubyPaystack RubyIkoroVictor/paystack-ruby
RubyPaystack Ruby APIsamuel52/PaystackRubyApi
YiiYii 2 Paystacksmladeoye/yii2-paystack

Copy linkCommunity client libraries

These wrap Paystack Popup or the mobile SDKs for frontend and mobile frameworks. They run on the customer's device, so use them with your public key only. For Flutter, Paystack maintains the official Flutter SDK.

FrameworkLibraryRepository
AngularAngular Paystacktoniton/angular-paystack
AngularAngular 4 Paystackashinzekene/angular4-paystack
CordovaCordova Plugin Paystacktolu360/Cordova-Plugin-Paystack
CordovaPaystack Cordova V2mrfoh/paystackcordovav2
FlutterPaystack Fluttermtellect/Flutter_Paystack
FlutterFlutter Paystackwilburt/flutter_paystack
NativeScriptNativeScript Paystackjogboms/nativescript-paystack
React JSReact Paystackiamraphson/react-paystack
React NativeReact Native Paystacktolu360/React-Native-Paystack
React NativeReact Native Paystack Webviewjust1and0/React-Native-Paystack-Webview
Vue JSVue Paystackiamraphson/vue-paystack
XamarinPaystackInline Forms PluginAkinnagbe/PaystackInline.Forms.Plugin
Was this page helpful?