An online merchant may investigate fraud carefully yet still allow a legitimate customer refund to be paid twice, returned to a changed destination or issued against another customer’s order. This workbook gives e-commerce, payment and security teams a synthetic test matrix for refund integrity. Run it only in a sandbox that cannot move real funds. The objective is to prove which business operations are permitted, which are rejected and how ambiguous gateway responses are reconciled. A client-side “refund” button is not an adequate security boundary when background workers and provider callbacks can modify the final payment state.
Prepare the sandbox and decision owners
Assign a merchant payments owner, store operations lead, application engineer, payment service provider contact, fraud specialist and independent test observer. Create three synthetic customers, two orders per customer and a dummy payment source supported by the provider’s test environment. The first order is delivered and eligible for a partial adjustment. The second is cancelled or already refunded. Keep identifiers and expected balances in a test ledger separate from the application. No real card numbers, bank destinations or customer personal information should enter the exercise.
Agree the refund policy under test, including which staff roles can propose an adjustment, approve an exception and execute the final transaction. The security team can test enforcement but should not invent commercial rules. If the shop supports store credit and original-payment refunds, treat these as different actions. A customer service representative may be able to offer store credit while a finance approver controls cash reimbursement. Record the accepted ceiling, eligible order state and time window before running any cases.
Map the transaction across systems
Diagram the customer service console, merchant application, refund API, asynchronous queue, payment service provider and reconciliation ledger. Mark which component decides the order’s remaining refundable amount and which component actually sends money. A webhook from a payment provider may update local status after a delay. A queue worker may execute an approval after the employee signs out. If different systems calculate refund totals independently, document the source of truth and the conflict-resolution rule.
Choose a durable correlation identifier that follows a proposal from the UI through the payment gateway and back to the order ledger. Do not rely on the latest support ticket number alone. Record the authenticated staff identity, customer account scope, order, refund amount, destination type, approval and provider transaction reference. This trail makes it possible to distinguish a repeated UI click from a repeated provider settlement and prevents the team from mistakenly reporting an error response as proof that no money moved.
Case 01 — Valid partial refund
With the approved staff role, request a small partial refund against the eligible synthetic order. The interface should display the remaining refundable balance and the policy justification. Obtain the specified approval, submit once and capture the provider reference. The merchant ledger must decrement the eligible balance exactly once and mark the adjustment against the correct order. After the callback arrives, the state should settle to the same total shown by the provider. This case establishes that security restrictions do not prevent legitimate customer service.
Save the before-and-after ledger snapshots, approval ID, outbound request reference and webhook event. Confirm that a read-only support role can view an authorised status without acquiring the permission to issue another payment. If customer support uses an AI agent to draft recommendations, treat its output as untrusted proposal text and preserve the same approval requirement at the transaction service.
Case 02 — Wrong-customer order substitution
Using the same synthetic staff session, change the order identifier to a record belonging to another test customer or merchant tenant. The backend must perform resource-level authorisation, not infer permission from a valid login. Expected result: the refund request is rejected without revealing the other customer’s order details or creating a queued job. Repeat the test through a direct sandbox API call, because a hidden field or disabled screen button may not enforce the underlying restriction.
If the service uses one shared integration token for many merchants, observe how tenant context is derived. A caller-controlled tenant field must not override the authenticated merchant scope. Capture the denial event and verify the payment provider received no instruction. Do not classify a failed UI rendering as a pass unless the final transaction system also shows no effect.
Case 03 — Amount above remaining eligible value
Submit an amount greater than the outstanding refundable balance, then attempt two smaller requests whose combined value exceeds the same limit. These tests reveal whether the application checks eligibility only when an operator first opens the order. The authoritative service should calculate the current refundable amount when committing the transaction and reserve or update it atomically. An earlier approved draft is insufficient if another staff member has already processed a credit.
Include a currency mismatch test if multiple currencies are supported. Exchange conversion and rounding belong to an explicitly defined payments rule, not to free-form customer support text. Record which amount, currency and precision the provider accepted in the sandbox. The business should decide how any rounding remainder is treated before production release.
Case 04 — Duplicate submission and lost acknowledgement
Prepare a valid request and submit it twice with the same idempotency key. Only one financial adjustment should result, even if the network client receives an ambiguous timeout. Next, replay the request with a different key but the same order and adjustment reference to confirm the ledger recognises an already completed business action. A naive retry loop can cause two legitimate-looking refunds if every request is assigned a new reference.
Simulate a provider response that arrives after the merchant has marked the first attempt uncertain. Reconcile the provider’s transaction ledger before sending another instruction. Document the exception queue for requests that cannot be safely resolved automatically. The acceptable outcome is a single settled adjustment or a clearly held item requiring investigation, not two disbursements masked by a successful HTTP response.
Case 05 — Destination or payee change
Attempt to redirect the adjustment to a bank account or wallet that differs from the policy-authorised destination. Where the provider permits refund-to-original-method only, confirm the merchant cannot silently override that constraint through a support note or API parameter. For any legitimate alternate-destination process, require the appropriate independent approval and verification supported by the provider. Do not perform real account changes during testing; use dummy payment instruments available in the sandbox.
The approval screen must show the effective destination and the reason for the exception. A generated customer-service summary saying “finance approved” is not itself a finance approval. Test that a customer-authored chat message or uploaded attachment cannot alter the merchant’s destination field. The final payment system should enforce destination rules regardless of what the front end displays.
Case 06 — Approval withdrawn before queued execution
Create an approved refund draft and pause the test worker. Revoke the approving employee’s permission or withdraw the business exception before allowing the job to execute. Determine the merchant’s intended rule: should outstanding approved work continue, expire or return to finance for re-approval? Then verify the implementation matches the rule at execution time. A queue that trusts a stale UI approval forever can keep paying after the conditions that justified it have changed.
Record job state transitions and the identity under which the queue worker sends the request. The worker’s broad service credential must not become a means for ordinary users to bypass amount and tenant restrictions. If cancellation cannot be guaranteed after provider submission, document the last reversible point and the separate reconciliation path.
Case 07 — Forged or repeated provider webhook
Submit a synthetic callback with an invalid signature and verify that the merchant ignores it for financial state updates. Replay a previously valid sandbox callback and confirm that the same provider event does not generate a second ledger entry. If callbacks can arrive out of order, the application should reconcile with the provider’s authoritative transaction state rather than overwrite newer status with an older message. The test must follow the provider’s supported signature and event model; do not assume one gateway’s semantics apply to another.
Inspect event records for sufficient identifiers without exposing secret verification material. A callback can accurately announce that a payment failed while the merchant’s internal ledger says refunded. The exercise should show how that inconsistency is detected and assigned to an owner. A retry should not conceal a prolonged discrepancy from finance and customer support.
Case 08 — Staff role and export segregation
Try an adjustment from a read-only role, a temporary contractor role and an expired support session. All should be denied unless specifically authorised. Confirm that refund reporting exports do not include more customer data than the role requires. A staff member allowed to export a reconciliation file should not automatically gain refund execution privileges, and vice versa. Inspect inherited administrator groups and alternate service endpoints rather than restricting the test to the normal helpdesk view.
Document exceptions: for example, finance supervisors may have high-value approval privileges but should not approve their own exceptional payments where policy requires dual control. A test that merely demonstrates one privileged user can refund proves functionality, not separation of duties. Include a second user with a different role to establish the denied path.
Evaluate and transfer the matrix
For every case record precondition, actor, order, action, expected result, actual response, provider outcome, ledger outcome and evidence reference. Mark pass, fail, blocked or not tested; do not convert missing provider logs into a pass. Hold deployment if a wrong-customer, over-balance or duplicate-settlement case succeeds. Assign other deviations to an accountable owner with a retest date. Ensure a failed negative test cannot move any production money because the entire exercise remains on synthetic rails.
After remediation, rerun the valid partial refund and all relevant negative cases to ensure the fix did not break ordinary service. Repeat the matrix when checkout logic, refund policies, gateway, AI support workflow or background job architecture changes. The key release claim is narrow and demonstrable: authorised adjustments settle once to the permitted destination, and altered scopes, stale approvals and duplicate requests do not create extra payments. That is more useful than reporting a single green result for “payment security.”
Sources and further reading
Explore Next Defence expertise
Next Defence can help organisations assess the technical and business exposure examined in a refund integrity test matrix for online merchants. Our team can review the available source records, test the relevant access or operational controls and work with accountable owners to deliver payment sandbox worksheet with six state-transition cases and acceptance evidence.