Skip to main content

Overview

Paystack is a payment gateway for African businesses, supporting card payments, mobile money, and bank transfers. TelemanAI integrates with Paystack for seamless subscription payments.

Prerequisites

  • Paystack business account
  • API keys (Public and Secret)
  • Verified business in Nigeria, Ghana, or South Africa

Configuration

Environment Variables

Add these variables to your .env file:
# Paystack Configuration
PAYSTACK_PUBLIC_KEY=pk_live_your_public_key
PAYSTACK_SECRET_KEY=sk_live_your_secret_key
PAYSTACK_PAYMENT_URL=https://api.paystack.co
MERCHANT_EMAIL=[email protected]
MERCHANT_CURRENCY=NGN
PAYSTACK=YES
PAYSTACK_PUBLIC_KEY
string
required
Your Paystack public key for initializing payments
PAYSTACK_SECRET_KEY
string
required
Your Paystack secret key for API authentication
PAYSTACK_PAYMENT_URL
string
API endpoint (default: https://api.paystack.co)
MERCHANT_EMAIL
string
required
Your business email registered with Paystack
MERCHANT_CURRENCY
string
Currency code: NGN (Nigeria), GHS (Ghana), ZAR (South Africa)
PAYSTACK
string
Set to YES to enable, NO to disable

Supported Currencies

  • NGN - Nigerian Naira
  • GHS - Ghanaian Cedi
  • ZAR - South African Rand
  • USD - US Dollar (for international cards)

Setup Steps

1

Create Paystack Account

Register at paystack.com and complete KYC verification.
2

Get API Keys

Go to Settings → API Keys & Webhooks in your Paystack dashboard.
Use test keys (pk_test_, sk_test_) during development.
3

Configure Environment

Add your Paystack credentials to .env as shown above.
4

Set Up Webhooks

Add webhook URL in Paystack dashboard:
https://your-domain.com/paystack/callback
5

Enable Gateway

Set PAYSTACK=YES and restart your application:
php artisan config:clear
php artisan cache:clear
6

Test Payment

Use Paystack test cards:
  • Card: 4084084084084081
  • CVV: 408
  • Expiry: Any future date
  • PIN: 0000

Payment Methods

Paystack supports multiple payment methods:
  • Card Payments - Visa, Mastercard, Verve
  • Bank Transfer - Direct bank transfers
  • USSD - Mobile banking codes
  • QR Code - Scan to pay
  • Mobile Money - MTN, Vodafone, Airtel

Testing

Test Cards

Card NumberTypeCVVPINResult
4084084084084081Visa4080000Success
5060666666666666666Verve1230000Success
507850785078507812Verve8840000Insufficient funds

Test Mode Keys

PAYSTACK_PUBLIC_KEY=pk_test_your_test_key
PAYSTACK_SECRET_KEY=sk_test_your_test_key

Webhook Events

Paystack sends webhook notifications for:
  • charge.success - Payment successful
  • charge.failed - Payment failed
  • subscription.create - Recurring subscription created
  • subscription.disable - Subscription cancelled

Troubleshooting

  • Verify API keys are correct
  • Check PAYSTACK=YES is set
  • Ensure email matches Paystack account
  • Clear config cache
  • Verify webhook URL is publicly accessible
  • Check webhook secret is configured
  • Test webhook using Paystack dashboard
  • Enable HTTPS for production
  • Verify your Paystack account country
  • NGN, GHS, ZAR only for local accounts
  • USD requires international verification

Security

Never commit API keys to version control. Always use environment variables.
  • Store keys securely in .env
  • Use HTTPS in production
  • Verify webhook signatures
  • Monitor for suspicious transactions
  • Implement rate limiting

Next Steps

Flutterwave

Alternative African payment gateway

Payment Overview

Compare all payment gateways

Subscription Setup

Configure pricing packages

Stripe

International payment option

Build docs developers (and LLMs) love