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

Verify Paystack Payments in React Native

After checkout, react-native-paystack-webview calls your onSuccess callback with the transaction reference. Send this reference to your backend. Your backend calls GET https://api.paystack.co/transaction/verify/:reference with the secret key. Return the result to React Native and navigate to a success or failure screen.

In this article

  1. 1. React Native Payment Service
  2. 2. Verification Screen
  3. 3. Learn More

React Native Payment Service

// services/paymentService.ts
const BASE_URL = 'https://your-backend.com';

export interface VerifyResult {
  verified: boolean;
  amount?: number;
  currency?: string;
  reference?: string;
  error?: string;
}

export async function verifyPayment(reference: string): Promise<VerifyResult> {
  try {
    var response = await fetch(
      BASE_URL + '/api/pay/verify?reference=' + encodeURIComponent(reference),
      {
        method: 'GET',
        headers: { 'Content-Type': 'application/json' },
      }
    );

    var data = await response.json();

    if (response.ok && data.verified) {
      return {
        verified: true,
        amount: data.amount,
        currency: data.currency,
        reference: data.reference,
      };
    }

    return { verified: false, error: data.error || 'Payment not verified' };
  } catch (error) {
    return { verified: false, error: 'Network error. Please check your connection.' };
  }
}

Verification Screen

// screens/VerifyPaymentScreen.tsx
import React, { useEffect, useState } from 'react';
import { View, Text, ActivityIndicator, TouchableOpacity, StyleSheet, Alert } from 'react-native';
import { verifyPayment, VerifyResult } from '../services/paymentService';

interface Props {
  route: { params: { reference: string } };
  navigation: any;
}

export function VerifyPaymentScreen({ route, navigation }: Props) {
  var { reference } = route.params;
  var [loading, setLoading] = useState(true);
  var [result, setResult] = useState<VerifyResult | null>(null);

  useEffect(() => {
    runVerification();
  }, []);

  async function runVerification() {
    setLoading(true);
    var res = await verifyPayment(reference);
    setResult(res);
    setLoading(false);

    if (res.verified) {
      // Navigate to success screen after a brief delay
      setTimeout(() => {
        navigation.replace('OrderSuccess', { reference: res.reference });
      }, 1500);
    }
  }

  if (loading) {
    return (
      <View style={styles.center}>
        <ActivityIndicator size="large" color="#4CAF50" />
        <Text style={styles.loadingText}>Verifying your payment...</Text>
      </View>
    );
  }

  if (!result?.verified) {
    return (
      <View style={styles.center}>
        <Text style={styles.errorTitle}>Verification Failed</Text>
        <Text style={styles.errorText}>{result?.error}</Text>
        <TouchableOpacity style={styles.retryButton} onPress={runVerification}>
          <Text style={styles.retryText}>Retry</Text>
        </TouchableOpacity>
        <TouchableOpacity onPress={() => navigation.navigate('Support', { reference })}>
          <Text style={styles.supportText}>Contact Support</Text>
        </TouchableOpacity>
      </View>
    );
  }

  return (
    <View style={styles.center}>
      <Text style={styles.successTitle}>Payment Confirmed!</Text>
      <Text>{result.currency} {result.amount?.toFixed(2)}</Text>
      <Text style={styles.ref}>Ref: {result.reference}</Text>
    </View>
  );
}

var styles = StyleSheet.create({
  center: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 24 },
  loadingText: { marginTop: 12, color: '#666' },
  errorTitle: { fontSize: 20, fontWeight: 'bold', color: '#e53935', marginBottom: 8 },
  errorText: { color: '#666', marginBottom: 24, textAlign: 'center' },
  retryButton: { backgroundColor: '#4CAF50', padding: 12, borderRadius: 8, marginBottom: 12 },
  retryText: { color: '#fff', fontWeight: 'bold' },
  supportText: { color: '#666', textDecorationLine: 'underline' },
  successTitle: { fontSize: 24, fontWeight: 'bold', color: '#4CAF50', marginBottom: 8 },
  ref: { color: '#999', marginTop: 8, fontSize: 12 },
});

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 transaction reference comes from the onSuccess callback of react-native-paystack-webview.
  • ✓Verification must happen on your backend — never call the Paystack API with a secret key from React Native.
  • ✓Call your backend verify endpoint, check the verified flag, and navigate accordingly.
  • ✓Handle network failures gracefully — mobile networks are unreliable. Always show a retry option.
  • ✓Your backend should also receive a webhook from Paystack. The webhook is more reliable than the mobile verification call.
  • ✓Store the reference locally (AsyncStorage) before checkout in case the app crashes during verification.

Frequently Asked Questions

What reference format does react-native-paystack-webview return?
The onSuccess callback receives an object. The reference is typically in response.transactionRef.reference or response.transactionRef depending on the library version. Log the full response object in development to see the exact shape.
What if verification fails but the money was deducted?
Your backend webhook handler receives the charge.success event from Paystack regardless of what happens in the mobile app. If the webhook fires, the payment was successful. Check your webhook logs. The mobile verification failure was likely a network issue on the device.
Should I store the reference in AsyncStorage before checkout?
Yes. Store the reference before opening the WebView. If the app crashes or the user force-closes it during or after checkout, you can detect on the next launch that there is an unverified payment and run verification again.
How do I verify payments when the user is offline?
Queue the verification for when connectivity returns. Use NetInfo from @react-native-community/netinfo to detect when the network is available, then run the queued verification. In the meantime, your backend webhook should have already confirmed the payment.

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

Transaction Not Found on Paystack Verify

Paystack returns "Transaction not found" when the reference you pass to the verify endpoint does not match any transaction in the current environment. The causes range from wrong reference strings to test/live key confusion to URL encoding problems. This guide covers every cause with specific fixes.

Read more

Idempotency in Paystack Payment Flows

Duplicate charges are the nightmare scenario for any payment integration. A customer clicks pay twice, a network timeout triggers a retry, or a webhook fires before the redirect callback. Idempotency is the engineering discipline that makes sure the same payment operation produces the same result no matter how many times it runs.

Read more

Paystack Currency Not Supported Error

Paystack returns "Currency not supported" when you try to charge in a currency that is not enabled for your account. This guide explains which currencies each country supports, how to check and enable currencies, and common format mistakes that trigger this error.

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.