Duplicate card-code imports: identity checks and paid-order protection

Importing the same supplier file twice can create new row IDs for identical codes. Row locks may then sell two different rows containing the same secret. This guide covers owned or authorized digital goods intended for one-time delivery. It extends merchant inventory controls; it does not claim that 稳付pay hosts codes or provides automatic replenishment.

Continue by topic

Define code identity beyond the inventory primary key

Determine identity from the issuer’s redemption rules: issuer, redemption scope, serial identifier and secret may all matter. Include scope when identical codes can legitimately redeem independently. Conversely, different product IDs must not bypass checks when products share one redemption pool. A title, filename or random inventory ID does not identify the underlying code.

Do not silently trim spaces, change case or normalize Unicode when characters may be meaningful. Apply only a verified format rule and save its version. Quarantine uncertain identities or rule changes rather than merging similar-looking codes automatically.

Validate staged imports before publishing stock

Retain batch reference, file checksum, source and row outcomes. Check duplicates within the batch, against available stock and against previously sold stock. A file checksum detects identical files, not renamed, reordered or partly overlapping content. Retrying an import must reference the original batch instead of manufacturing new inventory.

A developer can build a keyed HMAC-SHA256 index of the normalized identity while storing the actual code separately under controlled encryption. The index is not encryption or proof of validity. Do not publish plaintext or indexes, or expose low-entropy secrets through ordinary unkeyed hashes. Separate indexing and encryption keys, version them, and check both old and new indexes during a controlled rotation.

Constrain both ingestion and allocation

Apply non-null uniqueness to the verified identity scope and index, shared by every import process. A pre-insert lookup alone is insufficient. Commit inventory publication and batch status transactionally; report conflicting rows without resetting sold or reserved stock through an overwrite option.

Payment confirmation still requires idempotent allocation and locking available stock. Example: batch B repeats code C already sold to order A. Quarantine B’s C; its new row ID does not make it available for order D. If D has paid and stock is unavailable, retain paid-awaiting-resolution and follow replenishment or agreed after-sales handling. Do not mark payment failed.

Investigate old conflicts before any resale

Freeze affected available candidates and examine reservations, payments, allocations, retrieval and redemption evidence. If two buyers already received the secret, deleting one row cannot repair delivery. Authorized staff must check revocation with the issuer, apply product rules and document customer communication without inventing replacement codes or automatic-refund guarantees.

Test retransmission, renamed and reordered files, within-batch duplicates, concurrent imports, sold-code conflicts and key rotation using dummy codes. Duplicate rows must not increase available stock, and callback retries must not allocate again. Database and HMAC references support technical mechanisms; actual identity and after-sales rules remain product-specific.

Frequently asked questions

Why are unique inventory IDs and row locks insufficient?

They protect one row against repeated allocation but do not ensure that two rows contain different redemption secrets. Deduplicate the underlying code identity during ingestion.

Can a duplicate import overwrite the old row and mark it available?

No. The old record may be reserved, sold or delivered. Preserve its history, quarantine the new conflict and review it before any permitted resale.

References