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. Build Paystack Subscriptions in React Native
Bonaventure OgetoBy Bonaventure Ogeto|Updated July 22, 2026

Build Paystack Subscriptions in React Native

To subscribe a customer in React Native, call your backend to initialize a transaction with a Paystack plan code. Open the authorization URL with react-native-paystack-webview or expo-web-browser. After checkout, Paystack creates the subscription automatically. Your backend receives the subscription.create webhook. React Native polls or receives a push notification about the new subscription status.

In this article

  1. 1. Subscription Checkout Flow
  2. 2. Subscription Status Hook
  3. 3. Learn More

Subscription Checkout Flow

// screens/PlanSelectionScreen.tsx
import React, { useState } from 'react';
import { View, Text, TouchableOpacity, ActivityIndicator, Alert } from 'react-native';
import PaystackWebView from 'react-native-paystack-webview';

interface Plan {
  name: string;
  price: string;
  planCode: string;
  amount: number;
}

var PLANS: Plan[] = [
  { name: 'Pro Monthly', price: 'NGN 5,000/month', planCode: 'PLN_xxxxxxxxxxxx', amount: 5000 },
  { name: 'Pro Annual', price: 'NGN 50,000/year', planCode: 'PLN_yyyyyyyyyyyy', amount: 50000 },
];

export function PlanSelectionScreen({ navigation, route }: any) {
  var userEmail = route.params?.email;
  var [selectedPlan, setSelectedPlan] = useState<Plan | null>(null);
  var [showCheckout, setShowCheckout] = useState(false);
  var [loading, setLoading] = useState(false);

  async function handleSubscribe(plan: Plan) {
    setLoading(true);
    try {
      var response = await fetch('https://your-backend.com/api/subscribe', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ email: userEmail, planCode: plan.planCode }),
      });
      var data = await response.json();

      if (data.authorization_url) {
        setSelectedPlan(plan);
        setShowCheckout(true);
      } else {
        Alert.alert('Error', data.error || 'Failed to initialize subscription');
      }
    } catch (e) {
      Alert.alert('Error', 'Network error');
    }
    setLoading(false);
  }

  if (showCheckout && selectedPlan) {
    return (
      <PaystackWebView
        paystackKey="pk_test_xxxxxxxxxxxx"
        amount={selectedPlan.amount}
        billingEmail={userEmail}
        autoStart={true}
        onSuccess={async (response) => {
          setShowCheckout(false);
          var ref = response.transactionRef?.reference;
          if (ref) {
            // Check subscription status
            await checkSubscriptionStatus(ref);
            navigation.navigate('SubscriptionActive');
          }
        }}
        onCancel={() => setShowCheckout(false)}
      />
    );
  }

  return (
    <View style={{ flex: 1, padding: 16 }}>
      <Text style={{ fontSize: 20, fontWeight: 'bold', marginBottom: 16 }}>Choose a Plan</Text>
      {PLANS.map(plan => (
        <TouchableOpacity
          key={plan.planCode}
          onPress={() => handleSubscribe(plan)}
          disabled={loading}
          style={{ borderWidth: 1, borderColor: '#ddd', borderRadius: 8, padding: 16, marginBottom: 12 }}
        >
          <Text style={{ fontSize: 16, fontWeight: 'bold' }}>{plan.name}</Text>
          <Text style={{ color: '#666' }}>{plan.price}</Text>
        </TouchableOpacity>
      ))}
      {loading && <ActivityIndicator color="#4CAF50" />}
    </View>
  );
}

async function checkSubscriptionStatus(reference: string) {
  var response = await fetch(
    'https://your-backend.com/api/subscription/status?reference=' + reference
  );
  return response.json();
}

Subscription Status Hook

// hooks/useSubscription.ts
import { useState, useEffect } from 'react';

export interface SubscriptionStatus {
  active: boolean;
  planName?: string;
  nextBillingDate?: string;
  subscriptionCode?: string;
}

export function useSubscription(userEmail: string) {
  var [subscription, setSubscription] = useState<SubscriptionStatus>({ active: false });
  var [loading, setLoading] = useState(true);

  async function refresh() {
    setLoading(true);
    try {
      var response = await fetch(
        'https://your-backend.com/api/subscription/status?email=' + encodeURIComponent(userEmail)
      );
      var data = await response.json();
      setSubscription(data);
    } catch (e) {
      console.error('Failed to fetch subscription status', e);
    }
    setLoading(false);
  }

  useEffect(() => {
    refresh();
  }, [userEmail]);

  return { subscription, loading, refresh };
}

// Usage in a screen:
// var { subscription, refresh } = useSubscription(user.email);
// if (!subscription.active) <PlanSelectionScreen />;

Get weekly developer tips

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

No spam. Unsubscribe anytime.

Learn More

This guide is part of the Paystack integration guides by language and framework series.

Sign up for the McTaba newsletter

Key Takeaways

  • ✓The subscription checkout flow is the same as one-time payment — just pass a plan code on the backend.
  • ✓After checkout, Paystack handles renewals automatically. The app does not need to trigger them.
  • ✓Check subscription status from your backend API. Do not call Paystack directly from React Native.
  • ✓Use React Context or Zustand to manage subscription state and gate features accordingly.
  • ✓Display next billing date and plan details fetched from your backend, not from Paystack directly.
  • ✓For cancellation, call a backend endpoint that calls POST /subscription/disable with the subscription code.

Frequently Asked Questions

How does React Native know when a subscription is active?
The backend receives the subscription.create webhook and marks the user as subscribed. React Native polls a backend status endpoint or receives a push notification. After checkout, call your backend status API and refresh the subscription state in the app.
Can users manage their subscription within the React Native app?
Yes. Build a subscription management screen that fetches subscription details from your backend. Add cancel, upgrade, and downgrade options that call backend endpoints. The backend makes the Paystack API calls on behalf of the user.
How do I show a paywall in React Native for premium features?
Wrap premium screens with a check against your subscription state. Use React Context or Zustand. If subscription.active is false, render the plan selection screen instead of the premium content. Refresh the subscription status on app focus to stay current.
What happens to subscriptions when a renewal fails in React Native?
Paystack fires invoice.payment_failed to your backend. Your backend marks the subscription as inactive and sends a push notification to the React Native app. The app detects the inactive subscription on next status check and prompts the user to update their payment method.

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

Paystack Integration Guides by Language and Framework

A complete directory of Paystack integration guides organized by programming language and framework. Each guide covers accepting payments, verifying transactions, handling webhooks, and building subscriptions in your specific stack.

Read more

Accept Payments with Paystack in React Native

Accept Paystack payments in a React Native app using a WebView-based checkout. This guide covers using the react-native-paystack-webview library, building a custom WebView approach, and wiring up backend initialization and verification.

Read more

Handle Paystack Webhooks in React Native

Paystack webhooks are server-to-server — your React Native app cannot receive them directly. This guide explains building the backend webhook handler and notifying the React Native app via push notifications, polling, or deep links.

Read more

Handling subscription.create, subscription.disable and invoice Events

A complete walkthrough of every Paystack subscription and invoice webhook event. Covers subscription.create, subscription.not_renew, subscription.disable, invoice.create, invoice.payment_failed, and invoice.update with production-ready Node.js handlers.

Read more

Paystack Subscription Not Charging

Your Paystack subscription exists but recurring charges are not happening. The subscription might be disabled, the authorization code might not be reusable, the card might have expired, the plan amount might have changed, or the subscription might be in arrears. This guide walks through every cause with a systematic debug checklist.

Read more

Paystack Card Not Supported for Recurring

When Paystack says a card is not supported for recurring charges, the card type or issuing bank blocks tokenization. This guide covers why it happens, which card types are affected, how to handle it gracefully, and alternative billing strategies.

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.