Skip to content
QA Knowledge Hub

Test cases for a payment gateway integration

Updated 2026-11-13 · 6 min read

Thirty merchant integration cases that separate authorisation, capture and refund states. Focuses on server verification, event races and recovery without duplicate fulfilment.

How to answer in an interview

Ask which provider, methods and capture policy are in scope, then identify the server evidence that makes an order paid. Cover successful payment, definitive failure and unknown outcome separately. Explain why a return URL alone cannot authorise fulfilment, and why retrying an unknown payment needs care.

Scope and test data

Assume a merchant order for ₹1,030 INR, server-side payment verification and fulfilment only after capture. Use the selected provider’s sandbox instruments and event fixtures, never real card details. Razorpay documents server-side order creation, signature verification and capture checks; its webhook guidance warns of duplicate and out-of-order deliveries. The cases are merchant integration requirements, not a promise that every provider exposes the same states or retry controls. Confirm the adapter’s state mapping before execution.

The 30 cases below are a test design, not an execution report. Replace the example rules with approved requirements before recording pass or fail. Performance budgets and supported device versions must be agreed before execution.

Creation and normal outcomes

IDCategoryTest caseExpected result
P01FunctionalCreate a sandbox payment for the ₹1,030 orderProvider order is linked to merchant order with the exact amount and INR currency
P02SecurityModify browser amount or currency before payment creationServer uses the stored order amount and currency or rejects the mismatch
P03FunctionalComplete a sandbox payment through captureMerchant order becomes paid with one linked captured payment
P04FunctionalReceive authorisation while capture is still pendingOrder is not fulfilled and payment remains awaiting capture
P05NegativeSimulate capture failure after authorisationOrder remains unfulfilled and capture recovery is visible to operations
P06NegativeUse the provider definitive-decline fixtureAttempt is marked failed with retry guidance; order is unpaid
P07NegativeCancel the payment dialog before approvingUI returns to the order without marking it paid
P08FunctionalSwitch a supported payment method before approvalNew method retains the same approved order amount

Callback and event trust

IDCategoryTest caseExpected result
P09SecurityForge a success callback without a valid signatureMerchant rejects confirmation and does not mark the order paid
P10SecuritySubmit a genuine payment identifier linked to a different orderOrder binding check rejects it
P11SecuritySubmit a signed test event with an amount mismatchMismatch is recorded and fulfilment is withheld
P12SecuritySubmit a signed test event with a currency mismatchEvent does not pay the INR order
P13SecurityAlter a webhook payload while keeping its old signatureSignature validation fails and no business state changes
P14FunctionalDeliver the same valid capture event twiceOne paid transition and one fulfilment action occur
P15FunctionalDeliver authorisation after the capture eventCaptured state does not regress to awaiting capture
P16FunctionalRace callback processing against a capture webhookBoth resolve to the same payment with one fulfilment action
P17NegativeFail event storage before acknowledging deliveryFailure remains retryable and no event is silently acknowledged as processed
P18FunctionalRecover and redeliver the event after storage failureEvent is processed once and the order reaches the correct state

Unknown outcomes and refunds

IDCategoryTest caseExpected result
P19NegativeLose the create-payment response after provider acceptanceRecovery finds the existing attempt before creating a potentially duplicate payment
P20NegativeLose browser connectivity immediately after approvalUI reports an unresolved state until server verification resolves it
P21FunctionalDeliver verified capture after the browser has closedOrder becomes paid without needing the return page
P22NegativeTime out a status lookup while payment is pendingUI does not label the transaction definitively failed or invite an unsafe blind retry
P23FunctionalRetry after a confirmed failed attemptNew attempt is traceable and the failed attempt cannot fulfil the order
P24FunctionalRequest a full refund of a captured sandbox paymentRefund is linked to that payment and shown as pending until confirmed
P25FunctionalConfirm a partial refund of ₹100Refunded total becomes ₹100 and remaining refundable amount is ₹930
P26BoundaryRequest another refund exceeding the remaining amountRequest is rejected without increasing the refunded total
P27FunctionalDeliver the same successful refund event twiceRefunded total is updated once, not doubled

Usability and operations

IDCategoryTest caseExpected result
P28UIOpen, cancel and recover the payment dialog using keyboard and zoomControls remain reachable and focus returns to a meaningful merchant control
P29PerformanceDeliver the agreed peak event volume including duplicatesProcessing meets the agreed backlog budget without duplicate fulfilment
P30CompatibilityComplete sandbox return and recovery on supported desktop and mobile browsersBrowser differences do not alter the server-confirmed order state

Evidence and prioritisation

Prioritise P03, P09, P14, P16 and P20. Keep merchant order ID, provider order/payment IDs, event IDs and state timestamps, with sensitive fields redacted. A common mistake is asserting only a green success message. Check fulfilment count and the durable payment record too. For a follow-up on settlements, explain that capture, customer refunds and merchant settlement need different assertions; this suite does not test bank settlement.

Downloads

Quick answers

Can a success callback prove payment?

It must be validated and bound to the server order. Apply the provider capture and verification requirements before fulfilment.

Should every timeout trigger a fresh payment?

No. A timeout may hide a completed payment. Reconcile the existing attempt before allowing a new one.

Sources

Want a project you can show in interviews?

The portfolio project kit walks you through testing a deliberately buggy app with Selenium or Playwright and API tests, then explaining it. The app itself is free.