McTaba Labs logo
Software EngineeringThe WhiteboardProjectsEventsMasterclassesWebinarsLearn
Book Call

500+ developers already in the community

Get answers, find accountability partners, and stay ahead

Join Discord →
McTaba Labs logo

Educating 1 million students in tech by 2030.

Programs

  • HighSchool Graduates Launchpad
  • AI & Business Automation
  • Corporate Training
  • McTaba Story & Mission
  • Full-Stack Curriculum
  • Course Pricing & Plans
  • Frequently Asked Questions

Resources

  • Join Discord Community
  • Tech Events in Nairobi
  • Masterclasses
  • Free Resources
  • Learn
  • Campus
  • Africa Tech Talent Report
  • Partner With Us
  • Start a Project
  • Our Work

Contact Us

  • 124 Manyani East Road, Lavington, Nairobi
  • +254727795603
  • Book a Discovery Call

Office Hours:

Mon-Fri: 9am - 2pm EAT

Sat: 10am - 12pm EAT

© 2027 McTaba Labs - A product of Edtech Industries. All rights reserved.

Privacy PolicyTerms of ServiceRefund Policy
  1. Learn
  2. Paystack for African Developers
  3. Paystack Integration Guides by Language and Framework
Bonaventure OgetoBy Bonaventure Ogeto|Updated July 20, 2026

Paystack Integration Guides by Language and Framework

Paystack works with any language or framework that can make HTTP requests. The API is REST-based with JSON payloads, so the integration pattern is the same everywhere: initialize a transaction on your server, redirect the customer to pay, verify the result, and listen for webhooks. The only thing that changes between frameworks is the HTTP client you use and where you put your route handlers.

In this article

  1. 1. How Paystack Integration Works Across Languages
  2. 2. JavaScript and TypeScript
  3. 3. Python
  4. 4. PHP
  5. 5. Other Languages
  6. 6. Mobile
  7. 7. The Four Tasks Every Integration Needs
  8. 8. What This Cluster Covers
  9. 9. Stay Updated on African Payment Integrations

How Paystack Integration Works Across Languages

Paystack does not care what language you write. It is a REST API. You send HTTP requests to https://api.paystack.co, include your secret key in the Authorization header, and send or receive JSON. That is the entire protocol.

Here is what a transaction initialization looks like as a raw HTTP request:

POST https://api.paystack.co/transaction/initialize
Authorization: Bearer sk_test_xxxxxxxxxxxxx
Content-Type: application/json

{
  "email": "customer@example.com",
  "amount": 500000,
  "currency": "KES",
  "callback_url": "https://yourapp.com/payment/callback"
}

That request is the same whether you send it from Node.js, Python, PHP, Go, Ruby, Java, C#, or Dart. The language is just the HTTP client. fetch in JavaScript, requests in Python, Guzzle in PHP, net/http in Go. Different syntax, same bytes on the wire.

This is good news. It means three things:

  • No vendor lock-in to a specific SDK. Paystack provides official libraries for some languages, but you never need them. The API is simple enough to call directly.
  • You can port integrations between frameworks quickly. If you built Paystack into a Django app and now need it in FastAPI, the API calls are identical. Only the routing and request/response handling change.
  • Debugging is framework-independent. When something fails, you check the HTTP status code, the Paystack error message, and your request payload. The framework is rarely the problem. The error reference applies to every stack.

The guides in this cluster take this universal API and show you exactly where to put each piece in your specific framework. Where does the secret key go? How do you set up the route for webhooks? How do you verify a signature in your middleware? Those are framework questions, not Paystack questions, and that is what each guide answers.

For the full picture of how Paystack works before you pick a framework guide, read the complete engineering guide.

JavaScript and TypeScript

JavaScript is the most common language in the Paystack ecosystem. Most African startups run Node.js on the backend and React or Vue on the frontend, so this is where the largest chunk of our guides live.

Next.js App Router

Next.js with the App Router (Next.js 13+) uses React Server Components and Route Handlers. Your Paystack secret key lives in a Route Handler (app/api/paystack/route.ts), and the frontend uses Paystack Inline or redirects. Server Actions can also initialize transactions directly.

  • Accept payments in Next.js App Router
  • Verify payments in Next.js App Router
  • Handle webhooks in Next.js App Router
  • Build subscriptions in Next.js App Router

Next.js Pages Router

The Pages Router uses API Routes (pages/api/) instead of Route Handlers. If your project is on Next.js 12 or earlier, or you have not migrated to the App Router yet, these guides are for you.

  • Accept payments in Next.js Pages Router
  • Verify payments in Next.js Pages Router
  • Handle webhooks in Next.js Pages Router
  • Build subscriptions in Next.js Pages Router

React (Client-Side with Separate Backend)

Plain React apps (Create React App, Vite, etc.) have no server. You use Paystack Inline on the client to collect payment, then call your own backend API to verify. The backend can be Express, FastAPI, Laravel, or anything else. These guides cover the React side.

  • Accept payments in React
  • Verify payments in React
  • Handle webhooks with a React frontend
  • Build subscriptions in React

Vue

Vue integrations follow the same pattern as React: Paystack Inline on the client, backend API for verification and webhooks. Vue's composition API makes the Paystack popup easy to wrap in a composable.

  • Accept payments in Vue
  • Verify payments in Vue
  • Handle webhooks with a Vue frontend
  • Build subscriptions in Vue

Nuxt

Nuxt gives you server routes out of the box (server/api/), so you get the full-stack experience without a separate backend. Your Paystack secret key goes in a server route, and Nuxt handles the rest.

  • Accept payments in Nuxt
  • Verify payments in Nuxt
  • Handle webhooks in Nuxt
  • Build subscriptions in Nuxt

Angular

Angular uses services and dependency injection. The Paystack integration lives in a service that loads Paystack Inline, and your backend (often a separate Node or .NET API) handles verification and webhooks.

  • Accept payments in Angular
  • Verify payments in Angular
  • Handle webhooks with an Angular frontend
  • Build subscriptions in Angular

Svelte and SvelteKit

SvelteKit has server-side load functions and API endpoints (+server.ts files) that make Paystack integration clean. Plain Svelte without SvelteKit needs a separate backend, similar to plain React or Vue.

  • Accept payments in Svelte/SvelteKit
  • Verify payments in Svelte/SvelteKit
  • Handle webhooks in Svelte/SvelteKit
  • Build subscriptions in Svelte/SvelteKit

Node.js and Express

Express is still the most common Node.js backend framework in Africa. The integration is straightforward: Express routes handle initialization, verification, and webhook receipt. Use fetch (Node 18+) or axios to call the Paystack API.

  • Accept payments in Node.js/Express
  • Verify payments in Node.js/Express
  • Handle webhooks in Node.js/Express
  • Build subscriptions in Node.js/Express

NestJS

NestJS adds structure to Node.js with modules, controllers, services, and decorators. Your Paystack logic lives in a service, the controller handles routes, and guards can protect webhook endpoints. NestJS's dependency injection makes testing Paystack calls easy to mock.

  • Accept payments in NestJS
  • Verify payments in NestJS
  • Handle webhooks in NestJS
  • Build subscriptions in NestJS

Supabase Edge Functions

Supabase Edge Functions run on Deno. They are good for serverless Paystack integrations where you want to keep your backend light. The function receives the request, calls Paystack, writes to your Supabase database, and returns. No server to manage.

  • Accept payments in Supabase Edge Functions
  • Verify payments in Supabase Edge Functions
  • Handle webhooks in Supabase Edge Functions
  • Build subscriptions in Supabase Edge Functions

Firebase Cloud Functions

Firebase Cloud Functions (v2, based on Cloud Run) let you write Paystack handlers as serverless functions. You deploy them alongside your Firestore rules and Firebase Auth. Good for teams already deep in the Firebase ecosystem.

  • Accept payments in Firebase Cloud Functions
  • Verify payments in Firebase Cloud Functions
  • Handle webhooks in Firebase Cloud Functions
  • Build subscriptions in Firebase Cloud Functions

Get weekly developer tips

Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.

No spam. Unsubscribe anytime.

Python

Python is the second most popular backend language among African developers, especially for fintech teams and data-heavy products. Paystack integration in Python means using the requests library (or httpx for async) to call the API, then plugging the routes into your framework of choice.

Django

Django's view system handles Paystack routes. Your webhook endpoint is a Django view with @csrf_exempt (because Paystack cannot send CSRF tokens). Use Django's ORM to record transactions. The guides cover both function-based and class-based views.

  • Accept payments in Django
  • Verify payments in Django
  • Handle webhooks in Django
  • Build subscriptions in Django

Django REST Framework (DRF)

If your Django project exposes a REST API through DRF, these guides show you how to build Paystack endpoints as DRF views with serializers and proper response formatting. Useful for mobile apps and SPAs that talk to a Django API.

  • Accept payments in DRF
  • Verify payments in DRF
  • Handle webhooks in DRF
  • Build subscriptions in DRF

FastAPI

FastAPI is async-native, so you can use httpx.AsyncClient to call Paystack without blocking. Type hints and Pydantic models give you automatic request validation. FastAPI's dependency injection works well for sharing a Paystack client across routes.

  • Accept payments in FastAPI
  • Verify payments in FastAPI
  • Handle webhooks in FastAPI
  • Build subscriptions in FastAPI

Flask

Flask is minimal by design. You add routes, call Paystack with requests, and return JSON. No batteries included means no magic to fight. If you want the simplest possible Python integration, Flask is it.

  • Accept payments in Flask
  • Verify payments in Flask
  • Handle webhooks in Flask
  • Build subscriptions in Flask

PHP

PHP runs a large share of web applications in Africa, especially in Nigeria where Laravel is the dominant framework. Paystack itself was built in Lagos, so PHP support is first-class. The official paystack-php library exists, but you can also call the API directly with Guzzle or even curl.

Laravel

Laravel is the most popular PHP framework for Paystack integrations. You can use the paystack-php library or call the API through Laravel's HTTP client (which wraps Guzzle). Webhook routes go in routes/api.php to skip CSRF verification. Laravel's event system works well for dispatching jobs after payment confirmation.

  • Accept payments in Laravel
  • Verify payments in Laravel
  • Handle webhooks in Laravel
  • Build subscriptions in Laravel

Symfony

Symfony is less common than Laravel in the African dev scene but used in larger enterprise projects. The integration uses Symfony's HttpClient component and controller routes. Webhook handling works through a dedicated controller action.

  • Accept payments in Symfony
  • Verify payments in Symfony
  • Handle webhooks in Symfony
  • Build subscriptions in Symfony

Other Languages

These frameworks are less common in the African startup scene but popular in enterprise environments, fintech backends, and teams with specific language preferences.

Ruby on Rails

Rails handles Paystack with Net::HTTP or the httparty gem. Controllers receive webhooks, models store transaction records, and Active Job processes async work after payment. Rails conventions make the integration predictable.

  • Accept payments in Ruby on Rails
  • Verify payments in Ruby on Rails
  • Handle webhooks in Ruby on Rails
  • Build subscriptions in Ruby on Rails

Go

Go's net/http standard library is all you need. No external dependencies required. Go's strong typing and built-in JSON marshalling make Paystack response handling clean. Good for high-throughput payment services where you want low latency and small memory footprint.

  • Accept payments in Go
  • Verify payments in Go
  • Handle webhooks in Go
  • Build subscriptions in Go

Spring Boot (Java/Kotlin)

Spring Boot is common in African banks and large fintech companies. The integration uses RestTemplate or WebClient (reactive) to call Paystack. Spring's @RestController annotation handles webhook endpoints. Spring Security can validate webhook signatures in a filter.

  • Accept payments in Spring Boot
  • Verify payments in Spring Boot
  • Handle webhooks in Spring Boot
  • Build subscriptions in Spring Boot

ASP.NET Core (C#)

ASP.NET Core is used by some enterprise teams in South Africa, Kenya, and Nigeria. The integration uses HttpClient (injected via IHttpClientFactory) and controller actions. ASP.NET Core's middleware pipeline is a natural place for webhook signature verification.

  • Accept payments in ASP.NET Core
  • Verify payments in ASP.NET Core
  • Handle webhooks in ASP.NET Core
  • Build subscriptions in ASP.NET Core

Mobile

Mobile apps cannot safely store your Paystack secret key. The secret key must stay on your server. So every mobile Paystack integration has two parts: the mobile app (which shows the payment UI and collects the result) and a backend API (which initializes transactions, verifies payments, and receives webhooks).

The mobile guides in this cluster cover both parts. They show the mobile-side code and the backend calls your app needs to make.

Flutter

Flutter is the most popular cross-platform framework among African mobile developers. You can use the paystack_flutter package for a pre-built payment UI, or load Paystack Inline in a WebView. The backend is usually Node.js, Django, or Firebase Cloud Functions.

  • Accept payments in Flutter
  • Verify payments in Flutter
  • Handle webhooks for Flutter apps
  • Build subscriptions in Flutter

React Native

React Native integrations typically use react-native-paystack-webview to show the Paystack checkout inside your app. The JavaScript side calls your backend API, which does the actual Paystack API calls. If you already have a Node.js backend, the server code is identical to a web integration.

  • Accept payments in React Native
  • Verify payments in React Native
  • Handle webhooks for React Native apps
  • Build subscriptions in React Native

Android (Kotlin)

Native Android apps can use Paystack's Android SDK or load the checkout in a WebView using Android's WebViewClient. Kotlin coroutines handle async API calls to your backend. The webhook and verification logic lives on your server, not in the Android app.

  • Accept payments in Android/Kotlin
  • Verify payments in Android/Kotlin
  • Handle webhooks for Android apps
  • Build subscriptions in Android/Kotlin

iOS (Swift)

iOS apps can load the Paystack checkout in a WKWebView or use a native form with the Paystack iOS SDK. Swift's URLSession calls your backend to initialize and verify. As with all mobile platforms, the secret key must never appear in your app bundle.

  • Accept payments in iOS/Swift
  • Verify payments in iOS/Swift
  • Handle webhooks for iOS apps
  • Build subscriptions in iOS/Swift

The Four Tasks Every Integration Needs

No matter what framework you pick, your Paystack integration needs to handle four tasks. Every guide in this cluster is organized around these four tasks.

1. Accept a Payment

This is the starting point. You call POST /transaction/initialize with the customer's email, amount (in the smallest currency unit, e.g., kobo or cents), and a callback URL. Paystack returns an authorization_url where the customer pays. After payment, the customer is redirected back to your callback URL with a reference in the query string.

For frontend frameworks, you can skip the redirect and use Paystack Inline (a JavaScript popup) that handles payment in a modal without leaving your page.

See the accepting payments guide for the full breakdown of initialization, channels, and checkout options.

2. Verify a Payment

After the customer pays (or claims to have paid), you call GET /transaction/verify/:reference using your secret key. You check that the response shows status: "success" and that the amount and currency match what you expected. This is the single most important security step. Never grant access or deliver goods based on a client-side callback alone.

3. Handle Webhooks

Paystack sends POST requests to your webhook URL whenever something happens: a charge succeeds, a transfer completes, a subscription renews, a charge-back is filed. You must validate the x-paystack-signature header using HMAC SHA-512 with your secret key, return a 200 status immediately, then process the event asynchronously.

Webhooks are your safety net. If the customer closes the browser before the redirect, your webhook still fires. If the network drops during verification, the webhook still fires. Build your system so that webhooks are the source of truth, not redirects.

Read the webhooks engineering guide for retry logic, event types, and security patterns.

4. Build Subscriptions

Recurring billing means creating a Plan (with an interval and amount), then subscribing a customer to that plan. Paystack handles the charging schedule. You listen for subscription.create, invoice.payment_failed, and subscription.disable webhook events to keep your app in sync.

Each framework guide in this cluster covers all four tasks for your specific stack. Pick your framework from the lists above and work through the four guides in order.

What This Cluster Covers

This is the hub page for the framework integration cluster. It contains 100 spoke articles organized as a matrix of 25 frameworks and 4 tasks.

The 25 frameworks:

  • JavaScript/TypeScript (11): Next.js App Router, Next.js Pages Router, React, Vue, Nuxt, Angular, Svelte/SvelteKit, Node.js/Express, NestJS, Supabase Edge Functions, Firebase Cloud Functions
  • Python (4): Django, Django REST Framework, FastAPI, Flask
  • PHP (2): Laravel, Symfony
  • Other server-side (4): Ruby on Rails, Go, Spring Boot, ASP.NET Core
  • Mobile (4): Flutter, React Native, Android/Kotlin, iOS/Swift

The 4 tasks:

  • Accept payments (initialize a transaction, show checkout, handle callback)
  • Verify payments (confirm the transaction server-side before fulfilling)
  • Handle webhooks (receive events, validate signatures, process asynchronously)
  • Build subscriptions (create plans, subscribe customers, handle renewals and failures)

Every guide follows the same structure: what you need before you start, the complete code, an explanation of each step, and common mistakes to avoid. The code examples are designed to work as-is in a fresh project with your Paystack test keys.

How to Use This Cluster

  1. Read the pillar first. The complete engineering guide explains how Paystack works at a conceptual level. Read it before jumping into framework-specific code.
  2. Pick your framework. Find your stack in the lists above and open the "Accept payments" guide for that framework. That is your starting point.
  3. Work through all four tasks. Accept, verify, webhooks, subscriptions. Do them in order. Each guide builds on the previous one.
  4. Check the error reference. When you hit an error, check the error reference before searching Stack Overflow. The answer is probably there.

Which Framework Should You Choose?

If you are starting a new project and want a recommendation:

  • Solo developer building a web app: Next.js App Router. Full-stack in one project, great deployment story on Vercel, and the largest community of African developers using it with Paystack.
  • Team with Python experience: Django or FastAPI. Django if you want batteries included (admin panel, ORM, auth). FastAPI if you want async performance and modern Python conventions.
  • Team with PHP experience: Laravel. Dominant in Nigeria, strong Paystack community support, and plenty of local developers who know it.
  • Building a mobile app: Flutter with a Node.js or Supabase backend. Flutter gives you Android and iOS from one codebase. Supabase Edge Functions keep the backend minimal.
  • High-throughput payment service: Go. Minimal memory, fast startup, and the standard library is all you need.
  • Enterprise or banking environment: Spring Boot or ASP.NET Core. These are the frameworks your compliance team already trusts.

But honestly, it does not matter much. Paystack is a REST API. Pick the framework your team already knows and get building. You can always switch later because the API calls are identical.

Stay Updated on African Payment Integrations

Payment APIs in Africa change fast. New channels appear, country-specific rules shift, and frameworks release breaking updates that affect your integration code. We track all of it.

Join the McTaba Labs newsletter for practical updates on Paystack, M-Pesa, Flutterwave, and the full African payment stack. No hype, no filler. Just the technical changes that affect your code.

Subscribe to the newsletter

Key Takeaways

  • ✓Paystack is a REST API with JSON payloads. Any language or framework that can send HTTP requests and parse JSON can integrate with it. There is no language-specific SDK you must use.
  • ✓Every Paystack integration follows the same four tasks: accept a payment (initialize transaction), verify the payment (GET the transaction), handle webhooks (receive POST from Paystack), and manage subscriptions (create plans and subscribe customers).
  • ✓Frontend frameworks like React, Vue, and Angular use Paystack Inline (a JavaScript popup) on the client side, but still need a backend to verify payments and receive webhooks. Never trust the client alone.
  • ✓This cluster contains 100 framework-specific guides covering 25 frameworks across 4 integration tasks. Pick your stack from the list below and follow the guide that matches your task.
  • ✓The core API calls are identical across all frameworks. Once you understand the Paystack flow in one language, porting it to another takes minutes, not days.

Frequently Asked Questions

Does Paystack have official SDKs for every language?
No. Paystack provides official libraries for a few languages (Node.js, PHP, and some mobile SDKs), but not for every framework. You do not need an official SDK. The Paystack API is a standard REST API with JSON payloads. Any language with an HTTP client can call it directly. Many production integrations skip the SDK entirely and use plain HTTP requests.
Can I use Paystack with a frontend-only app (no backend)?
Not safely. You can use Paystack Inline (the JavaScript popup) to collect payments on the frontend, but you must verify the payment on a server using your secret key. Your secret key must never appear in client-side code. Frontend-only apps need at least a lightweight backend or serverless function for verification and webhook handling.
Is the Paystack integration different for each African country?
The API endpoints and authentication are the same regardless of country. What changes is the currency code (NGN, GHS, ZAR, KES, USD), the available payment channels (some countries have mobile money, others do not), and the KYC requirements for your Paystack business account. Your code structure stays the same.
Should I use Paystack Inline or the redirect checkout?
Paystack Inline (the JavaScript popup) keeps the customer on your page, which usually means better conversion. The redirect checkout sends the customer to a Paystack-hosted page, which is simpler to implement and works when you cannot load JavaScript (e.g., server-rendered pages or email links). For most web apps, Inline is the better choice. For mobile apps and API-first architectures, you typically initialize on the server and open the authorization URL in a WebView or browser.
Can I use the same Paystack integration code across multiple frameworks?
The API calls are identical. A POST to /transaction/initialize with the same headers and body produces the same result from any language. What changes between frameworks is the routing (how you define URL endpoints), the request/response objects (how you read headers and body), and the environment configuration (where you store your secret key). If you understand the Paystack flow in one framework, moving to another is a matter of learning the new framework's HTTP conventions, not re-learning Paystack.

Learn Paystack Integration

KES 2,999

The definitive guide to building payment systems with Paystack — from your first transaction to production-grade payment infrastructure across Africa. 9 modules, 47 lessons. Free preview available.

Start Paystack Course

Not ready? Create Free Account

Keep reading

Accept Payments with Paystack in Next.js App Router

Wire Paystack payments into a Next.js App Router project. This guide covers Route Handlers for initializing transactions, Server Actions for inline checkout, redirect callbacks, and server-side verification with full working code.

Read more

Verify Paystack Payments in Svelte and SvelteKit

Verify Paystack transactions in SvelteKit using server endpoints for popup verification and load functions for redirect callback verification. Covers amount validation, idempotent fulfillment, and SSR verification for instant results.

Read more

Handle Paystack Webhooks in Flask

Receive and verify Paystack webhooks in your Flask application. This guide covers accessing request.data for raw bytes, HMAC SHA-512 signature verification, processing charge.success events, and making handlers idempotent.

Read more

Build Paystack Subscriptions in ASP.NET Core

Implement Paystack recurring billing in ASP.NET Core. This guide covers creating plans, subscribing customers through transaction initialization, handling renewal webhooks with C#, and cancelling subscriptions.

Read more

Paystack Payment Channels: Card, Bank, USSD, Mobile Money, QR

Paystack supports six payment channels: card, bank transfer, USSD, mobile money, QR, and Apple Pay. Each channel has different availability by market, different settlement behaviors, and different user experiences. This guide covers all of them so you know what your customers can use and what your code needs to handle.

Read more

Paystack Amount Too Low Error

Paystack rejects transactions below a minimum amount that varies by currency. This guide lists every minimum, explains the kobo/pesewa/cents confusion that causes most "amount too low" errors, and gives you a server-side validation function to catch the problem before it reaches the API.

Read more

Explore related topics

M-Pesa & African Stack

M-Pesa Daraja API tutorials, USSD development, and WhatsApp Business API guides. The African Stack that global bootcamps do not teach.

Learn to Code in Kenya

Everything a Kenyan needs to know before writing their first line of code. Career paths, real costs, hardware requirements, and honest answers about what it takes.

Learning to Code

Roadmaps, language guides, and practical advice for learning to code and launching a programming career.

Breaking Into Tech

Practical, no-nonsense guides for anyone looking to start or change their career in tech. From choosing your first language to acing interviews.

The African Stack: Skills for This Market

The skills that make Kenyan developers hard to replace: M-Pesa, USSD, WhatsApp, fintech, and building for the African market.

Bonaventure Ogeto

Bonaventure Ogeto

Founder, McTaba Labs

Bonaventure is the founder of McTaba Labs, a coding bootcamp in Nairobi, Kenya. He has spent years building products for the African market and mentoring the next generation of developers across the continent.