Valet API: payments, gift cards and refunds (for developers)

What software connected through Valet sends and gets back: payment types, receipt data, gift card loads and balances, and refund rules.

Where to find this in Storey: storeypos.com/valet/docs (also /openapi.json and /llms-full.txt)

Gift cards and store credit: two kinds of stored value

Gift cards are value already paid for: transferable digital cash, whoever holds the code holds the value. Sell or load through Valet; customers get a code and link to a digital card with a QR code and Code 128 barcode, both encoding the plain code. The link showing the balance is intentional.

Store credit is not bought. It comes from a return or owner/manager goodwill (with a reason), belongs to a customer's account and is spent later. Create it in Storey, not through the Valet load call.

Both modules are off by default. The business switches each on in its own back office. Customers type, scan or show a code; refunds and voids go back to the same gift card or store credit.

Choose the kind of transaction

See the table and full example answers in /valet/docs, /openapi.json and /llms-full.txt, all generated from one reference.

  • Card: POST /api/public/valet/sale; paymentType omitted or card. Gift card: same call with paymentType gift_card and giftCardCode. Store credit: paymentType store_credit and giftCardCode (not a field named code). Send referenceId, subtotal, total and optional tax/tip/shipping amounts.
  • Refund: POST /sale/{storeyTransactionId}/refund, optional amount. Void: POST /sale/{storeyTransactionId}/void, no body. Both inherit the original payment type.
  • Status: GET /sale/{storeyTransactionId}. Cancel: POST /cancel with referenceId, before terminal sending only. Load: POST /giftcards/load with referenceId, amount and optional code. Balance: GET /giftcards/{code}/balance.
  • Hosted creation: POST /api/public/valet/session with kind sale (default) and sale amounts, or kind refund/void with storeyTransactionId (UUID) and optional refund amount. All three kinds support all three original payment types. On a sale, select paymentType and giftCardCode at POST /session/{token}, not creation; key-entry card sends provider cardToken. Refund/void run needs no body and inherits the original sale. No new endpoint or field was needed.
  • GET /session/{token} returns the window view and summaries, not the full run answer. /session/{token}/card initializes the secure provider field. /session/{token}/receipt sends a processor copy only for an approved processor card sale with its gateway reference, not a gift card.

Every approved sale, refund and void returns the same receiptData keys for card, gift card and store credit; a value that does not apply is null, never missing. Keys: kind (sale, refund or void), valetReference, storeyTransactionId (always the original sale, so you can link back), reversalId, valorTransactionId (this transaction's own Valor ID), originalValorTransactionId (the sale's Valor ID on refunds and voids), valorRefundTransactionId (refunds only, kept for older integrations), approvalCode, rrn, dateTime, cardBrand, last4 (last four only), entryMode, amount, taxAmount, feeAmount, batchNumber, tranNumber, originalAmounts (subtotal, taxAmount, tipAmount, shippingAmount, feeAmount, total), refundedSoFar, remaining, paymentType, giftCardLast4, balanceAfter. A void cancels the whole sale: amount, tax and fee are the original sale's. A refund is the amount you sent; Storey does not split it into items, so its taxAmount and feeAmount are null. Batch and transaction numbers appear when Valor returns them. Card receipts have null giftCardLast4 and balanceAfter; stored-value receipts have null brand, last4, fee, batch and transaction numbers. receiptData is null unless approved. Load has its own balance/link answer, not receiptData.

HTTP 200 includes approved/declined results; stored-value pay refusals have no ticket and consume no referenceId. Balance lookup of a known zero-balance card is 200 with its balance/message. 400: invalid fields/state or saveCard true on sale/session creation; 401: bad key/tag; 403: module off/reversals disabled; 404: unknown ticket/code/session; 409: incompatible state; 410: expired token or removed card-on-file routes after key/tag validation; 429: rate limited; 500/502: server/provider error. Stored-value reasons: card_not_found, no_store_credit, zero_balance, insufficient_balance, not_activated, expired, voided. Error bodies keep error plus optional reason where applicable.

This is for the developer of the software that connects to Storey through Valet. Full field lists are in the Valet docs.

Payment type

  • Send `paymentType` as `card`, `gift_card` or `store_credit`. Leave it out and the sale is a card sale, exactly as before.
  • Gift card and store credit payments both send `giftCardCode` (the gift card or store credit code).
  • A gift card or store credit payment is all or nothing: if the balance is too low the answer is "declined" and nothing is taken.
  • The business must have its Gift cards or Store credit module switched on, or the answer is 403.

Receipt data

  • Approved sales, refunds and voids all return the same receiptData keys listed above, with null where a value does not apply.
  • Card sales show the card brand and last four digits only.
  • Gift card and store credit answers have no card brand or last four; they add `paymentType`, `giftCardLast4` and `balanceAfter`.

Loading and checking gift cards

  • `POST /giftcards/load` only ever adds money. Send a `referenceId`: sending the same one again returns the first answer with `replayed: true` and never loads twice. Leave out the code to create a new digital card.
  • `GET /giftcards/{code}/balance` returns the balance.
  • The digital card link is the gift card code itself, never a payment card token.

Wrong or unusable codes

  • Codes must match exactly. Storey never uses a near match or a similar number.
  • When a code can't pay, the answer is still `status: "declined"` (HTTP 200), with `storeyTransactionId: null`, a plain sentence in `error`, and an optional `reason`: `card_not_found`, `no_store_credit`, `zero_balance`, `insufficient_balance`, `not_activated`, `expired` or `voided`.
  • These refusals are not recorded, so fix the code and send it again with the same `referenceId`.
  • The balance call and gift card load add the same `reason` to their error when it applies (for example 404 with `card_not_found`). Other errors keep the usual `{ "error": "..." }` shape.

Retries

  • Reusing a `referenceId` returns the first recorded answer. Refused codes (above) are never recorded, so they don't use it up.

Hosted payment window

  • The window offers gift card and store credit on its own when the business has that module on. Nothing changes in your session call.
  • Its GET answer adds `paymentOptions` (`card`, `giftCard`, `storeCredit`), and its POST accepts the optional `paymentType` and `giftCardCode`. Same balance rule and the same receipt data as `POST /sale`.

Refunds and voids

  • Refunds and voids go back to where the money came from: the same card, gift card or store credit. Partial and repeated refunds are allowed up to the amount left.
  • When the business's referenced-refund setting is On, a card refund is one request to Valor using the original sale's transaction ID; Off uses the original terminal method. Storey never tries a second method by itself and never falls back to a terminal refund by amount. If Valor refuses, the answer says why and nothing was refunded.

Saved cards removed

  • Valet is checkout only and stores no cards.
  • `GET` and `POST /payment-methods`, `DELETE /payment-methods/{pmId}` and `POST /charge` now answer 410 with `{ "error": "..." }`.
  • Sending `saveCard: true` on a sale or session gets a 400 before the terminal wakes. `customerRef` is accepted and ignored.
  • Sale and session answers no longer include `paymentMethod` or `saveCardError`.
  • Storey's own card on file (register, invoices, work orders) is not affected.

Card difference fee (cash discounting) and the smallest request

The only required money field is subtotal. taxAmount, tipAmount and shippingAmount default to 0, and total is optional (if you send it, it must equal the sum). Smallest sale: {"referenceId": "order-10490", "subtotal": 100}.

At a location boarded for cash discounting, Valet adds the card difference fee to CARD sales itself, using only the location's boarded percent. cashDiscountPercent in a request is accepted and ignored.

Terminal stations: by default ("Storey adds it") Valet sends the terminal AMOUNT = cash price + fee (in cents, e.g. 10350 for $100.00 at 3.5%) with no separate fee tag; the terminal is set to traditional in Valor and adds nothing. If the terminal still reports its own fee, the sale reply carries warnings: ["double_card_fee"]. Hosted window: amount = cash price + fee with surchargeAmount = fee. Locations Storey staff set to "The Valor terminal adds it" send the cash price to the terminal and record the fee it reports; keyed sales there carry no fee. Every sale reply now includes warnings (an array, empty when nothing is wrong).

Fee = (total − tipAmount) × percent, rounded to the cent. Example: $100.00 at 3.5% → cardDifferenceFee 3.50, amountCharged 103.50.

New reply keys (in amounts and receiptData, every existing key unchanged): cardDifferenceFee, amountRequested (cash price; amounts.total stays the cash price), amountCharged (what the card paid), cardFeePercent (null when no fee). Refunds add cardFeeReturned. Without cash discounting, or for gift card and store credit: fee and percent null, amountCharged = amountRequested.

  • Terminal stations: Valet sends the cash price; the terminal adds its own fee and the fee it reports is recorded (a difference from Valet's maths is logged).
  • Hosted window, key entry: Valet sends amount = cash price + fee with surchargeAmount = fee; the window shows the fee and card total first.
  • Refunds are stated against the cash price. Partial refunds return no fee; the refund that completes the cash price returns the whole fee once (cardFeeReturned). A void reverses the whole charged amount.
  • A refund run on the terminal itself (not by reference) never adds the fee back; the terminal owns its fee.

Docs pages and AI

Each topic has its own page under /valet/docs (for example /valet/docs/sale, /valet/docs/refund, /valet/docs/card-difference-fee), with Previous and Next links. Sale: card, Refund, Void and Quickstart show the same request with two answers side by side: Standard account and Cash discounting account ($100.00 at 3.5% charges $103.50; a full refund returns the $3.50). Every page is also Markdown at the same address plus .md, and Copy this page for AI copies it. Give an AI assistant https://storeypos.com/llms-full.txt and https://storeypos.com/openapi.json; keep VALET_KEY and VALET_TAG in server-side environment variables, never in the chat. Old links such as /valet/docs#create-a-sale open the right page.

Still stuck? We're here to help.

If you are calling about Storey sales, support, hardware or an integration, press 3.