Designing a Digital Coupon Issuance and Redemption System: A Full Technical Reference

    This article presents a complete engineering design for digital consumer voucher campaigns—covering spend-threshold discounts, new-user coupons, referral rewards, and merchant-specific redemption flows. It explains how to model coupon rules, eligibility checks, lifecycle states, three redemption paths (in-store QR scanning, code-based exchange, and store-specific voucher selection), concurrency control, payment consistency, refunds, reconciliation, and security observability. It is a general solution reference for developers building coupon or voucher platforms, based on a real-world municipal consumer subsidy scenario in Changchun, China, and does not imply the original campaign adopted this architecture.

    1. From a Consumer Voucher Campaign to a Technical Problem

    A consumer voucher campaign in Changchun, China, targeting supermarkets, shopping malls, and similar retail scenarios, included spend-threshold discounts, exclusive coupons for new members, referral rewards, and differentiated redemption flows for different merchants. From the consumer’s perspective, the key questions are: “Am I eligible to claim it? Where can I use it? How much does it deduct?” For developers and operators, the problems are eligibility determination, rule configuration, inventory management, credential verification, cross-system exchange, and financial reconciliation.

    Such an activity is therefore not merely “distributing a QR code.” A complete digital coupon system must connect user identity, campaign conditions, coupon benefits, merchant scope, and consumption transactions—ensuring every change in entitlement has a verifiable basis.

    This article uses the original campaign’s rules and operational paths as business context and discusses general implementation approaches. The technical designs presented are proposals, not descriptions of the actual campaign architecture. Since the original material does not specify campaign start/end dates, claim entry points, the full list of participating stores, or stacking conditions, readers should not assume the campaign is currently active or that all stores participate.

    2. Decomposing Promotions into Executable Rules

    1. Spend-threshold discounts must bind both the threshold and the merchant scope

    The original campaign listed five tiers: for spending of CNY 118, deductions of CNY 50, 40, 38, 35, and 32 respectively. Different tiers correspond to different merchants or subsets of stores—one coupon cannot arbitrarily choose its deduction amount.

    In a technical model, a threshold-discount entitlement must express at minimum:

    • The spending threshold amount
    • The deduction amount
    • The applicable merchant and store set
    • Effective start and end times
    • Per-user claim and usage limits
    • The eligible product or transaction scope
    • Combination rules with other promotions

    Restrictions not stated in the source material must be supplied by the official campaign rules; implementations must not assume them.

    As an arithmetic illustration: if a transaction meets all usage conditions with a rule-qualified amount of CNY 118, applying a CNY 50 coupon leaves CNY 68 payable. This does not mean any CNY 118 order qualifies—excluded products or an out-of-scope store can still fail validation.

    2. Avoid precision ambiguity in amount calculation

    Internally, amounts should be represented as integers in the smallest currency unit—for example, CNY 118 stored as 11,800 units. This avoids inconsistent boundary checks caused by floating-point arithmetic.

    For rules that forbid deduction exceeding the eligible amount, the system should reject non-conforming transactions; for rules allowing partial deduction, the published cap should be applied. The two must not be mixed, and the decision must never be made on the client side.

    3. “No minimum spend” does not mean “no other restrictions”

    In the original campaign, qualifying new members received a CNY 10 no-threshold coupon, and qualifying referrers received two CNY 5 no-threshold coupons.

    “No threshold” typically means no minimum purchase amount—it does not automatically mean valid at all merchants, on all products, redeemable for cash, or infinitely stackable. “Exclusive coupons” in particular may still be bound to a specific scope. Systems and user interfaces should present the amount threshold and other constraints separately rather than substituting a single label for the full rule.

    3. Eligibility: Separating Registration, Verification, and Membership Status

    1. New-user determination requires complete conditions

    New-user eligibility in the original campaign was not simply “first time opening the app.” It was tied to conditions such as completing identity verification for the first time during the campaign period, or joining the membership program and completing verification during the campaign—combined with a normal membership status.

    Eligibility checking therefore involves at least: registration record, verification completion time, membership join time, membership status, and the campaign time window. In development, “first account registration” and “first identity verification” should be recorded as distinct events; otherwise, users who registered but never verified may be wrongly excluded, or previously verified users may claim twice.

    Identity verification data should be handled on a minimum-necessary basis. Coupon business logic typically only needs to know whether verification passed and a stable internal identity identifier—full identity details should not be copied into every claim, referral, or redemption record.

    2. Claim eligibility and usage eligibility should be defined separately

    Satisfying conditions at claim time does not allow the system to assume identical conditions at usage time. Whether a coupon remains usable after a membership status change must be explicitly stated in the campaign rules.

    Technically, the system should retain the claim-time determination basis and configure which items must be re-validated at redemption. Merchant scope, validity period, and coupon status usually need re-checking at redemption time; whether membership status is re-checked depends on the published rules. This supports auditing and prevents eligibility requirements from being silently changed in the backend.

    4. Referral Rewards: Driven by Valid Events, Not Click Counts

    In the referral campaign, the referrer must have completed identity verification and hold normal membership status; the invitee must meet conditions such as first-time registration plus verification, or joining membership and verifying during the campaign. Merely clicking an invitation link should never directly trigger a reward.

    The referral flow should be decomposed into four stages: establish relationship → complete qualifying event → validate → issue reward. The referral relationship record should capture the campaign, referrer, invitee, creation time, and source. The original material does not specify how multiple invitations are attributed, so attribution priority must be defined in campaign rules.

    Reward issuance requires idempotent control: the same valid referral event, even if processed multiple times due to network retries, duplicate notifications, or task compensation, must result in exactly one reward.

    Additionally, “two CNY 5 coupons” must not be simplified into “one CNY 10 coupon.” Two independent coupons each carry their own status and usage records; whether they can be used together in one transaction requires explicit rule support. Preserving this distinction in the data model is necessary to represent user entitlements accurately.

    5. A Unified Coupon Lifecycle for Different Redemption Paths

    1. Issuance state and exchange state should not be conflated

    A digital coupon can adopt lifecycle states such as “pending activation, usable, in processing, used, expired, voided.” These names are generic design examples, not any existing platform’s interface convention.

    For coupons that require cross-system exchange, the exchange process should be recorded separately—for example: not exchanged, exchange in progress, exchange succeeded, exchange failed. A successful exchange does not necessarily mean consumption occurred: the user may have only converted the original entitlement into a consumption voucher within the target system.

    Recording exchange and consumption separately prevents the system from wrongly showing “already consumed” immediately after a user completes a coupon conversion.

    2. Every state change must have a business basis

    Each state transition should record the operation time, operator or source system, associated transaction, result, and failure reason. Client-side display is only a presentation of results; it must never be the authoritative state.

    For example, after a user’s screen displays a QR code, the coupon should remain in “usable” state. Only after the server confirms redemption conditions are met and commits the state transition should the coupon be marked as used.

    6. Implementation Focus of the Three Redemption Paths

    1. In-store QR code redemption

    The first path: the user opens the coupon in their mobile wallet, shows the redemption QR code to the merchant, the merchant confirms usage on-site, and any amount beyond the deduction is paid separately.

    The QR code should be treated as an entitlement credential, not a plain image. The original material warns that credentials are confidential and screenshots are prohibited, but warnings alone cannot stop screenshots from spreading. A more robust general approach is to use short-lived, single-use random credentials, with the server verifying coupon status, validity period, merchant authorization, and transaction conditions.

    The QR code should not directly embed full identity data. Likewise, a “personal use only” requirement cannot be enforced by QR content alone; whether additional identity verification is needed should be decided based on risk and official rules.

    2. Code exchange followed by consumption

    The second path requires the user to view and copy a redemption code, enter the corresponding mall’s consumer service portal, exchange the code at the correct mall location, and then use the resulting voucher for consumption.

    This flow requires mapping between the original coupon, the redemption code, and the post-exchange entitlement. The key requirements are that the code can only be exchanged per the rules, and that exchange results are queryable and traceable.

    If an exchange request times out, the system must not simply declare failure and allow unlimited retries—the target system may have already processed it successfully and only the response was lost. The correct approach is to query the result first, then retry with the same business identifier or route to manual processing, preventing duplicate entitlement creation.

    Redemption codes are sensitive credentials. Logs, customer service screenshots, and admin pages should apply appropriate masking to avoid widening the leak surface during troubleshooting.

    3. Selecting a store-specific voucher

    The third path: the user opens a coupon in the wallet and selects an applicable voucher for the corresponding store.

    The interface may filter candidate coupons based on the user’s selection, but the server must still verify that the actual transaction store is within the applicable set. Relying solely on user selection or page copy is unsafe, because the store where the transaction actually occurs may differ from the earlier selection.

    Scopes such as “participating supermarkets” or “participating malls” should be expressed as maintainable store lists with change history. If rules allow scope changes, the system should specify which version applies to already-claimed coupons, avoiding disputes at checkout.

    7. Concurrency and Payment Consistency in Redemption

    The same coupon may be submitted simultaneously by two checkout terminals, or multiple requests may arise from repeated user actions. The system must use transactions, conditional updates, or equivalent mechanisms to ensure only one request successfully occupies the entitlement.

    Conceptually, the core constraint can be stated as:

    “Only when a coupon is still usable, within its validity period, and meets the transaction conditions may it transition to redemption-in-processing.”

    Subsequent requests that find the state already changed should receive a clear result rather than deducting again.

    Coupon deduction and payment of the remaining amount must stay consistent. If the coupon is permanently marked as used before payment fails, the user may lose the entitlement; if payment is collected first and the coupon redemption then fails, overcharging or transaction interruption may occur.

    A viable pattern is: reserve the entitlement → complete payment → confirm redemption; if payment fails, release the reservation based on verifiable transaction results. The exact ordering depends on the checkout and payment flow—there is no single implementation that fits every scenario. The key is defining explicit failure-recovery paths and never releasing a coupon while the payment outcome is still uncertain.

    8. Refunds, Reconciliation, and Exception Handling

    1. Refund does not imply coupon return by default

    The original material does not state refund rules, so one cannot assert that a refunded order always returns the coupon. The campaign should explicitly define handling for full refunds, partial refunds, and expired coupons.

    The system should separately record cash payment, coupon deduction, and refund amounts, linked to the original transaction. If the rules permit coupon returns, it should happen through controlled state transitions, never by deleting the original redemption record. If returns are not permitted, users must be clearly informed before purchase.

    2. Reconciliation must cover multiple transaction streams

    At minimum, reconcile coupon issuance/state streams, merchant consumption streams, and related payment or settlement streams. Cross-system exchange scenarios add exchange records to reconciliation.

    Common discrepancies include: consumption succeeded but coupon state not synced; coupon shows used with no corresponding transaction; exchange succeeded but mapping missing; and duplicate accounting for the same business event. Exceptions should enter a traceable processing queue recording evidence, responsible stage, and resolution—never mask problems by directly adjusting balances.

    9. Security and Operational Observability

    Merchant-side access should be role-restricted so cashiers can only operate transactions for authorized stores. High-risk backend operations—queries, bulk issuance, state corrections—should keep audit logs with review mechanisms proportional to risk.

    Monitoring metrics can include claim success rate, eligibility rejection reasons, exchange failure rate, redemption latency, duplicate request volume, and reconciliation discrepancies. Metrics serve problem localization; performance numbers should not be claimed without measured evidence.

    On the user side, prioritize displaying validity period, applicable stores, minimum spend conditions, remaining payment amount, and an exception-handling entry point. Error messages should state a next actionable step—verify store scope, refresh the credential, or wait for a result query—rather than a generic “operation failed.”

    10. Conclusion

    The technical challenge of a consumer voucher campaign is not displaying an electronic coupon, but forming a verifiable closed loop across eligibility, discount rules, merchant scope, exchange flows, payment transactions, and settlement records.

    Starting from this Changchun retail scenario, a general methodology emerges: configure rules only after they are explicit; retain the basis for eligibility decisions; make reward issuance idempotent; perform redemption with server-side validation; equip cross-system operations with query and compensation mechanisms; and record funds and entitlements separately with continuous reconciliation. Only by balancing user experience, transaction consistency, and credential security together can a digital coupon truly become a reliable consumer entitlement rather than just a campaign entry point.