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 Test Mode: Complete Guide
Bonaventure OgetoBy Bonaventure Ogeto|Updated July 22, 2026

Paystack Test Mode: Complete Guide

Paystack test mode is activated by using your test API keys (sk_test_... and pk_test_...) instead of live keys. In test mode: no real money moves, test cards are accepted, webhooks still fire to your registered URL, and all API endpoints work the same as live. To switch environments, swap the API key in your backend — no other code change needed.

In this article

  1. 1. Test Mode vs Live Mode: What Changes
  2. 2. Receiving Test Webhooks Locally
  3. 3. Switching from Test to Live
  4. 4. Learn More

Test Mode vs Live Mode: What Changes

FeatureTest ModeLive Mode
API key prefixsk_test_ / pk_test_sk_live_ / pk_live_
Real moneyNoYes
Test cards acceptedYesNo
Real cards acceptedNoYes
Webhooks fireYes (to registered URL)Yes
Transaction dataIsolated from liveIsolated from test
Subaccounts / plansTest-only, won't carry to liveLive-only
SettlementsNo real settlementSettles to your bank

Receiving Test Webhooks Locally

Paystack webhooks fire to your registered URL — even in test mode. To receive them during local development, expose your local server with a tunneling tool:

# Using ngrok
ngrok http 3000
# Copy the HTTPS URL: https://abc123.ngrok.io

# Register it in Paystack dashboard:
# Settings → API Keys & Webhooks → Test Webhook URL
# Set to: https://abc123.ngrok.io/webhook

Alternatively, use the Paystack test dashboard's webhook simulator to send test events manually without a running server — useful for unit testing webhook handlers.

Get weekly developer tips

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

No spam. Unsubscribe anytime.

Switching from Test to Live

When you are ready to go live:

  1. Replace sk_test_... with sk_live_... in your backend environment variables
  2. Replace pk_test_... with pk_live_... in your frontend configuration
  3. Update your webhook URL in the Paystack dashboard to your production URL (Settings → Live webhook URL)
  4. Re-create any subaccounts, plans, or split codes you created in test mode — they do not carry over
  5. Test one small live transaction manually before announcing go-live

Common mistake: updating only the backend key. If your frontend still sends pk_test_... while the backend uses sk_live_..., transactions will be created in test mode and verification against the live API will fail.

Learn More

This guide is part of the Paystack testing guide.

Sign up for the McTaba newsletter

Key Takeaways

  • ✓Test mode is controlled by which API key you use — sk_test_... means test mode, sk_live_... means live mode.
  • ✓Test transactions, subaccounts, plans, and customers are separate from live — they do not carry over when you go live.
  • ✓Webhooks fire in test mode to your registered webhook URL — your local server needs to be publicly accessible (use ngrok or similar).
  • ✓The Paystack dashboard has a separate transaction history for test vs live — toggle the environment switcher in the dashboard.
  • ✓Never use a live secret key in a development or staging environment — accidental live charges happen this way.
  • ✓When going live, you must switch both the secret key (backend) and public key (frontend) — missing either causes mixed-mode errors.

Frequently Asked Questions

Can I use the same webhook URL for test and live mode?
Paystack lets you register separate webhook URLs for test and live mode. Use different URLs — point test webhooks at your staging server and live webhooks at your production server. This prevents test events from being processed by your production system.
Do test transactions count toward my Paystack transaction limits?
No. Test transactions are completely separate from live transactions and do not count toward any live usage limits, fee calculations, or settlement totals. Test as much as you need without affecting your live account.
Why do I see "Invalid key" errors after switching to live mode?
Usually caused by using a test public key with a live secret key or vice versa. Both frontend (public key) and backend (secret key) must use the same mode. Also check that environment variables were actually reloaded — some frameworks cache env vars at startup.
How do I test recurring subscriptions in test mode?
Paystack test mode simulates subscription billing — you can create plans, subscribe customers with test cards, and receive subscription.create, invoice.update, and charge.success events. Billing intervals are not compressed in test mode though — you cannot fast-forward a monthly subscription to see the second charge without using the webhook simulator.

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

Testing Paystack Integrations: The Complete Guide

A complete guide to testing Paystack integrations at every level: test mode, test cards, unit tests with mocks, integration tests, end-to-end flows with Playwright, webhook simulation, contract testing, CI pipelines, staging environments, load testing, and coverage targets for payment code.

Read more

Unit Testing Paystack Integrations

Unit tests for Paystack integrations focus on your business logic, not the Paystack API itself. The goal is to test that your code responds correctly to different Paystack responses — without ever calling the real API. This guide shows what to unit test and how.

Read more

Integration Testing Paystack Flows End to End

Integration tests for Paystack test the real flow — your backend calls the actual Paystack test API, a webhook fires to your server, and your database is updated. Unlike unit tests with mocks, integration tests catch issues that only appear when the real API is involved.

Read more

Seeding Test Data for a Payments Feature

Good test data is essential for testing payment features. This guide covers creating Paystack test mode resources (plans, subaccounts, split codes) and seeding your application database with matching payment records for realistic test scenarios.

Read more

Paystack Signature Verification Failed: The Definitive Fix

Paystack signature verification fails when the body you hash does not match the exact bytes Paystack signed. The most common cause is your framework parsing the JSON body before you compute the HMAC. This guide covers every cause and gives you working fixes for Express, Django, Laravel, and Next.js.

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.