---
title: "Verify a declined sandbox payment preserves a recoverable checkout"
description: "Decline a payment using provider test fixtures, check honest error and order state, then retry with a valid method without creating duplicate purchases."
canonical_url: "https://vostride.com/agent-library/checkout-payments/declined-card-retry.md"
md_url: "https://vostride.com/agent-library/checkout-payments/declined-card-retry.md"
content_kind: "recipe"
topic: "checkout-payments"
---

# Verify a declined sandbox payment preserves a recoverable checkout

Decline a payment using provider test fixtures, check honest error and order state, then retry with a valid method without creating duplicate purchases.

## Risk

A declined charge should not produce a paid order or discard the customer cart. The retry needs to target the same intended purchase, with clear distinctions between failed payment attempts and completed charges.

## Fixtures

- A test customer with a single run-owned cart and independently known total.
- Provider-supported declined and successful sandbox payment methods.
- Hooks for payment attempts, order status, cart contents, and inventory reservations.

## Steps

1. Open checkout and verify the intended product quantity, address, and total before entering the declining sandbox method.
2. Submit payment once and verify a clear decline message with a usable payment-method correction path.
3. Inspect order and payment hooks and verify no successful charge or paid order exists; verify the cart and selected delivery details remain available.
4. Replace the payment method with the successful sandbox fixture and retry once.
5. Verify the final order confirmation and inspect reconciliation state for one completed purchase, the documented failed attempt, and no duplicate inventory reservation.

## Expected results

- The declined attempt remains failed and does not grant paid-order status.
- Checkout retains the information the product promises to preserve for retry.
- The corrected retry results in one completed order and one successful charge.

## False-pass traps

- A payment provider error may occur after an application has prematurely marked the order paid.
- Counting payment attempts as successful charges would incorrectly flag a normal failed-then-successful retry as duplicate billing.

## Cleanup

- Refund or cancel the sandbox order and restore the fixture inventory.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa hooks](/docs/agent-qa/guides/hooks.md)
- [agent-qa auth state](/docs/agent-qa/guides/auth-state.md)

- [Checkout and payment QA recipes](/agent-library/checkout-payments.md)
- [Software factory QA library](/agent-library.md)
