All All News Products Insights Community

Test Cases for a Payment Gateway: Complete Guide + Free Templates

Joe Sturgess
Joe Sturgess
Updated on

A failed payment is never just a technical failure. It is the moment a customer loses confidence in your platform, abandons their purchase, and often does not return. Unlike most bugs, a payment failure has a direct and immediate cost. This guide gives you the test cases to prevent that.
Test Cases Payment Gateways

Below you will find over 50 test cases organised by type and filterable by category, guidance on using AI to speed up your test suite, and a pre-launch checklist you can work through before every release. Take what is useful and adapt it to your stack.

Why payment gateway testing is its own discipline

Most functional testing is a conversation between your application and its own logic. Payment gateway testing adds a third party to that equation: the gateway itself, and behind it, the issuing bank and card network. Failures can originate at any of those layers, and they do not always come back with a clear error message.

Always test in sandbox. Every major gateway (Stripe, Razorpay, PayU, PayPal) provides a sandbox environment with test card numbers and simulated decline codes. Use those. Never run test transactions against a live account, and make sure no real card numbers appear anywhere in your test data or logs.

Error handling is at least half the work. A successful payment gives you one data point. A failed one can mean dozens of different things: insufficient funds, a blocked card, a network timeout, an incorrect CVV, an OTP expiry, or a gateway error. Your test suite needs to cover all of them, not just the happy path.

You are also dealing with redirects and webhooks in ways most application flows do not require. The user leaves your application, completes authentication on a third-party page, and returns. A lot can go wrong in that gap, and edge case testing is where you find it.

The four test case categories

The test cases in this guide fall into four types. Understanding what each one is for makes it easier to know which cases belong in your daily regression suite versus a full pre-release run. If you are new to writing test cases, our guide on how to write test cases covers the fundamentals before diving in here.

  • Functional — Happy path testing. Does the core flow work end to end across all supported payment methods?
  • Negative — What happens when something goes wrong? Declined cards, wrong credentials, gateway errors, exhausted retries.
  • Edge case — Unusual states and boundary conditions. Double clicks, session timeouts, network drops, concurrent sessions.
  • Compatibility — Does the payment flow work consistently across browsers, devices, card networks, and payment methods?

The test cases

Use the filters to focus on a specific category. Every test case includes a suggested priority: High cases belong in your P1 regression suite, Medium in a full pre-release run, and Low in periodic or exploratory testing. You can also use the test case template from our library to document these in your preferred format.

Using AI to generate payment gateway test cases

AI tools can meaningfully speed up the first draft of a test suite. They are not a replacement for domain knowledge: they get gateway-specific error codes wrong surprisingly often, and edge case coverage can be thin. But as a starting point they save real time, particularly when you need to cover a new payment method quickly or produce a first-pass regression list.

Here are three prompts that produce solid results.

Prompt 1: Full suite from scratch

Generate a comprehensive set of test cases for a [Razorpay / Stripe / PayU] payment gateway integration on a [B2C ecommerce / SaaS subscription] application. Include functional, negative, and edge case scenarios. Format each test case as: Test Case ID, Scenario, Preconditions, Test Steps, Expected Result, Priority (High / Medium / Low).

Swap in your actual gateway and application type for noticeably better output.

Prompt 2: Add payment-method-specific cases

I have test cases covering credit and debit card payments. Now generate additional test cases specifically for UPI payment flows, including: successful completion, incorrect VPA, expired UPI intent, user cancellation, and timeout scenarios. Use the same format as the existing cases.

This works equally well for adding net banking, wallet, or BNPL cases to an existing suite.

Prompt 3: Build a lean regression subset

From the following test cases, identify the ten most critical to run before every release. Justify your selection based on failure impact and likelihood. Flag any cases you would automate first. [paste your test case list here]

Useful when you have a large suite and need to build a fast, CI-friendly regression set.

One thing to watch for. AI-generated expected results for edge cases are often plausible but wrong, particularly around what happens when a gateway returns an error mid-redirect or how partial payments should be handled. Always review with someone who knows the implementation before these cases go into your suite.

Managing this test suite in Katalon

Once you have your test cases, you need somewhere sensible to manage test cases at scale. A few things that make payment gateway testing easier in Katalon True Platform:

  • Organise cases into suites by category (Functional, Negative, Edge Case, Compatibility) so you can run subsets without manual filtering.
  • Link test cases to requirements or user stories for traceability. Useful when your gateway provider updates their API and you need to know which cases are affected.
  • Use the AI-assisted test case generation feature to produce test steps from a plain-language description, then refine from there rather than starting from a blank document.
  • Set up your P1 suite to run automatically before each deployment inside your CI/CD pipeline. Payment failures in production are expensive; a ten-minute automated run is not.

Organising your test suite by priority

Not every test case needs to run with every deployment. A practical structure for most teams:

  • P1 (every build): Core happy path across all supported payment methods, declined card with error message, incorrect OTP handling, duplicate payment prevention, amount precision check.
  • P2 (pre-release): Full negative suite, all edge cases, primary browser and device matrix, session and network failure scenarios.
  • P3 (periodic): Full compatibility matrix, locale and currency variants, remaining low-priority edge cases, exploratory testing of new payment methods.

The goal is a P1 suite fast enough to run in CI and a P2 suite thorough enough to catch regressions before they reach users. Most teams find that P1 cases can be automated; P3 cases are often best kept as manual checks.

Payment gateway testing for specific application types

The test cases above apply broadly, but the risk profile shifts depending on what you are building. For ecommerce applications, the highest-risk scenarios tend to be cart abandonment after a declined card and duplicate order creation from double-clicks. For banking applications, the focus shifts to precise amount validation, transaction reversal handling, and regulatory compliance flows. BFSI teams can find additional context in our guide to BFSI testing.

If you are building or expanding your regression suite for payment flows, our regression testing starter kit provides a reusable structure you can adapt for gateway-specific coverage.

Frequently asked questions

What is payment gateway testing?

+

Payment gateway testing is the process of verifying that a payment integration works correctly across all scenarios — successful transactions, declined cards, network failures, and edge cases. Because a payment gateway involves your application, the gateway provider, and the issuing bank, failures can originate at any layer and don't always return a clear error message. Testing in a sandbox environment before release is the only reliable way to catch them.

What are the four types of payment gateway test cases?

+

Payment gateway test cases fall into four categories: Functional (does the happy path work end to end across all payment methods?), Negative (what happens when something goes wrong — declined cards, wrong OTP, gateway errors?), Edge case (unusual states like double-clicks, session timeouts, concurrent sessions, and network drops), and Compatibility (does the flow work consistently across browsers, devices, and card networks?).

Which payment gateway test cases should run on every build?

+

A P1 regression suite that runs on every deployment should cover: the core happy path across all supported payment methods, a declined card with the correct error message displayed, incorrect OTP handling, duplicate payment prevention, and amount precision validation. These cases have the highest failure impact and can typically be automated to run in under ten minutes.

How do I test a payment gateway without using real card numbers?

+

Every major gateway — Stripe, Razorpay, PayU, PayPal — provides a sandbox environment with test card numbers and simulated decline codes. Always use these for testing. Never run test transactions against a live account, and ensure no real card numbers appear anywhere in your test data, logs, or source code.

Can AI generate payment gateway test cases?

+

Yes, AI tools can produce a solid first draft of a payment test suite quickly. The most reliable approach is to provide the specific gateway name (Stripe, Razorpay, PayU) and application type (B2C ecommerce, SaaS subscription) in your prompt. The main limitation is that AI-generated expected results for edge cases — particularly around mid-redirect errors and partial payment handling — are often plausible but wrong. Always review with someone who knows the implementation before adding AI-generated cases to your suite.

Joe Sturgess
Joe Sturgess
Joe is Director of Performance Marketing at Katalon. Before Katalon, he launched AI software products in the US. He's spent 14 years in B2B and B2C tech marketing across the UK, US and Asia, has a track record of backing the right channels and the wrong football team (COYS). Currently based in Ho Chi Minh City.
Click