# Codes and refusals

> Exact-match codes and the plain reasons a gift card or store credit can't pay.

Valet developer docs — Stored value. Web page: https://storeypos.com/valet/docs/codes-and-refusals. Full reference for AI: https://storeypos.com/llms-full.txt. OpenAPI: https://storeypos.com/openapi.json.

Codes must match exactly — never a near match. Customers can type, scan or show a code; scanners that type the code and press Enter work, and spaces around the code are trimmed.

When a code can't pay, the sale answer is still status "declined" but nothing is recorded (`storeyTransactionId` is null), so fix the code and retry with the same referenceId. The optional `reason` tells your software why:

| reason | Meaning |
| --- | --- |
| card_not_found | Card not found. Check the number and try again. (Also a code that fails the Valet check digit.) |
| no_store_credit | No store credit found. Check the number and try again. |
| zero_balance | This card has no balance. |
| insufficient_balance | Not enough balance. Balance is $X. |
| not_activated | This card has not been activated yet. |
| expired | This card has expired. |
| voided | This card has been cancelled. |

Refused example:

```json
{
  "storeyTransactionId": null,
  "referenceId": "ORDER-1002",
  "status": "declined",
  "error": "Card not found. Check the number and try again.",
  "reason": "card_not_found",
  "paymentType": "gift_card",
  "giftCard": null,
  "receiptData": null,
  "replayed": false
}
```

---

Previous: [Check a balance](https://storeypos.com/valet/docs/gift-card-balance.md)
Next: [Receipt fields](https://storeypos.com/valet/docs/receipt-fields.md)
