Bonaventure OgetoBy Bonaventure Ogeto|

Why Paystack Means You Should Never Touch Card Data

When you use Paystack Inline or the Paystack Popup, the customer enters card details on a Paystack-hosted form. Those details are tokenized in the customer's browser and sent directly to Paystack's servers — they never pass through your backend. You only receive an authorization_code, not the card number. Never build a custom card form that collects card numbers and posts them to your own server.

How Paystack Keeps Card Data Off Your Servers

When a customer pays on your site using Paystack Inline:

  1. The Paystack JavaScript widget renders a secure iframe
  2. The customer types their card number into the iframe — your code cannot read this input
  3. Paystack's code tokenizes the card and sends it directly to Paystack's servers over TLS
  4. Your server receives a callback/webhook with a reference and authorization_code — not the card number

Your backend never touches the card number. It is technically impossible for your server to accidentally log or store it through the normal Paystack flow.

// WRONG — do not build your own card form
// This takes card data through your server
app.post('/charge-card', async (req, res) => {
  var { cardNumber, cvv, expiryMonth, expiryYear } = req.body; // NEVER DO THIS
});

// RIGHT — let Paystack handle card input
// Your backend only receives the reference after checkout
app.post('/webhook', async (req, res) => {
  var event = req.body;
  if (event.event === 'charge.success') {
    var reference = event.data.reference; // Safe to store
    var last4 = event.data.authorization.last4; // Safe to store for display
    var authCode = event.data.authorization.authorization_code; // Safe to store for re-use
    // No card number here — ever
  }
});

PCI DSS Scope Reduction

PCI DSS (Payment Card Industry Data Security Standard) is a set of security requirements for organizations that handle card data. Compliance is tiered:

  • SAQ A — Lightest. All card processing outsourced to a compliant provider. Your site just redirects to their checkout. This is where Paystack puts you.
  • SAQ A-EP — Your page loads scripts that touch card data (e.g., custom Inline implementation). Heavier requirements.
  • SAQ D — Heaviest. You store, process, or transmit card data. Requires full annual audit.

By never touching card data and using Paystack's hosted or inline checkout, you remain in SAQ A — the simplest compliance tier, achievable with a self-assessment questionnaire.

Learn More

Key Takeaways

  • Paystack handles all card number input, tokenization, and transmission — you never see the raw PAN.
  • The authorization_code you receive is a safe token, not a card number. Store it for recurring charges.
  • Never build a custom HTML form that POSTs card numbers to your server — this puts you in scope for PCI DSS SAQ D.
  • Using Paystack Inline/Popup reduces your PCI scope to SAQ A (the lightest compliance level).
  • If you are collecting card data in any way — even "temporarily" — stop and redesign the flow using Paystack's hosted checkout.
  • The last4 and bin fields in Paystack responses are safe to store for display purposes — they are not the full card number.

Frequently Asked Questions

Is it safe to store the authorization_code in my database?
Yes. The authorization_code is a safe, tokenized representation of the card. It is not the card number. Store it encrypted in your database for recurring charges. It is already useless without your Paystack secret key, but encryption adds an extra layer.
What if my mobile app needs to accept card payments without leaving the app?
Use Paystack's mobile SDK (for iOS and Android) or the official React Native/Flutter packages. These embed a secure card capture form that handles tokenization in the mobile environment. Still no raw card data passes through your backend.
Can I build a custom-styled checkout with Paystack without handling card data?
Yes. Use the Paystack Charge API with Paystack Inline JavaScript. You can style the form container, but the actual card input fields are rendered in a Paystack-controlled iframe. This keeps you in SAQ A scope while having a custom-looking checkout.
What happens if I accidentally log a card number in my server logs?
Treat it as a security incident. Immediately rotate your Paystack keys. Purge the affected logs. Notify Paystack and your payment processor. Check if the log files were accessed. Depending on your country and the card networks involved, you may have a regulatory notification obligation.

Ready to build real-world apps?

Join the McTaba Labs full-stack marathon (4 months full-time · 6 months part-time). Learn M-Pesa, USSD, and WhatsApp engineering while shipping 8 production apps.

Apply to the McTaba Marathon