<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: adi chauhan</title>
    <description>The latest articles on DEV Community by adi chauhan (@mywebrank).</description>
    <link>https://dev.to/mywebrank</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4262396%2Fde1bf349-93d1-4961-bc1f-4399cd741c45.png</url>
      <title>DEV Community: adi chauhan</title>
      <link>https://dev.to/mywebrank</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mywebrank"/>
    <language>en</language>
    <item>
      <title>Designing a Reward Points Ledger: Earn, Bonus and Redeem Without Breaking Balances</title>
      <dc:creator>adi chauhan</dc:creator>
      <pubDate>Fri, 27 Nov 2026 06:21:17 +0000</pubDate>
      <link>https://dev.to/mywebrank/designing-a-reward-points-ledger-earn-bonus-and-redeem-without-breaking-balances-43id</link>
      <guid>https://dev.to/mywebrank/designing-a-reward-points-ledger-earn-bonus-and-redeem-without-breaking-balances-43id</guid>
      <description>&lt;p&gt;Every rewards app looks simple from the outside. A customer buys something, they earn reward points, and later they redeem rewards for cash or a gift card. Under the hood, the part that decides whether users trust you is the points ledger.&lt;/p&gt;

&lt;p&gt;If balances drift, double credit, or go negative, support tickets pile up fast. Here is a practical way to model it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Never store a balance as the source of truth
&lt;/h2&gt;

&lt;p&gt;Store every movement as an immutable ledger entry and derive the balance from it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;points_ledger&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;            &lt;span class="kt"&gt;BIGSERIAL&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;user_id&lt;/span&gt;       &lt;span class="kt"&gt;BIGINT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;entry_type&lt;/span&gt;    &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- EARN, BONUS, REDEEM, EXPIRE, REVERSAL&lt;/span&gt;
  &lt;span class="n"&gt;points&lt;/span&gt;        &lt;span class="kt"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;-- positive for credit, negative for debit&lt;/span&gt;
  &lt;span class="n"&gt;source_ref&lt;/span&gt;    &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- order id, scan id, campaign id&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt;    &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nb"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;UNIQUE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;source_ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;UNIQUE (entry_type, source_ref)&lt;/code&gt; constraint is the cheapest protection you will ever add. If a webhook fires twice or a user double taps, the second insert fails and nobody earns twice for the same purchase.&lt;/p&gt;

&lt;p&gt;You can still keep a cached &lt;code&gt;balance&lt;/code&gt; column for fast reads, but update it in the same transaction as the ledger insert, and rebuild it from the ledger if they ever disagree.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Treat bonus reward points as their own entry type
&lt;/h2&gt;

&lt;p&gt;Marketing teams love campaigns like "double points this weekend" or "50 bonus points on your first scan". Do not fold these into the base EARN row. Write a separate BONUS row linked to the campaign.&lt;/p&gt;

&lt;p&gt;Why this matters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can report how much a campaign actually cost&lt;/li&gt;
&lt;li&gt;You can reverse a bonus without touching the base earn&lt;/li&gt;
&lt;li&gt;Bonus reward points can have a shorter expiry than regular points&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Make redemption a two step process
&lt;/h2&gt;

&lt;p&gt;Redeeming is where money leaves the system, so be strict:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Reserve&lt;/strong&gt;: insert a REDEEM row with negative points inside a transaction that checks the derived balance is enough (&lt;code&gt;SELECT ... FOR UPDATE&lt;/code&gt; on the user row).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fulfil&lt;/strong&gt;: call the payout or gift card provider.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confirm or reverse&lt;/strong&gt;: on failure, insert a REVERSAL row. Never delete the REDEEM row.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This keeps an audit trail for every rupee or point that moved.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Tie earning to a verifiable event
&lt;/h2&gt;

&lt;p&gt;The biggest leak in most programs is fraud on the earn side: fake receipts, shared promo codes, scripted sign ups. A stronger pattern is to tie each earn to a one time token that only a real buyer can get, for example a unique QR code printed under a scratch layer on the product pack.&lt;/p&gt;

&lt;p&gt;This is the model used by &lt;a href="https://assuredrewards.in/" rel="noopener noreferrer"&gt;Assured Rewards&lt;/a&gt;, a QR cashback and loyalty platform in India. Each code can be redeemed once, the scan confirms the product is genuine, and the reward lands in a wallet that the user can withdraw through UPI or use to &lt;a href="https://assuredrewards.in/" rel="noopener noreferrer"&gt;redeem rewards&lt;/a&gt; on gift cards. In ledger terms, the scan id becomes the &lt;code&gt;source_ref&lt;/code&gt;, so the unique constraint above blocks reuse for free.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Handle expiry as a scheduled job, not a query filter
&lt;/h2&gt;

&lt;p&gt;If points expire, write an EXPIRE entry when they do. Filtering old rows out at read time makes balances change silently, which users read as theft.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;A good points system is mostly accounting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Append only ledger&lt;/li&gt;
&lt;li&gt;Idempotency keys on every credit&lt;/li&gt;
&lt;li&gt;Separate rows for base points and bonus points&lt;/li&gt;
&lt;li&gt;Reserve, fulfil, confirm on every redemption&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Get that right and features like tiers, streaks or daily rewards deals become easy additions instead of rewrites.&lt;/p&gt;

</description>
      <category>database</category>
      <category>fintech</category>
      <category>sql</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to Build Daily Rewards Deals and Bonus Reward Points That Users Cannot Game</title>
      <dc:creator>adi chauhan</dc:creator>
      <pubDate>Wed, 25 Nov 2026 06:18:31 +0000</pubDate>
      <link>https://dev.to/mywebrank/how-to-build-daily-rewards-deals-and-bonus-reward-points-that-users-cannot-game-3e6a</link>
      <guid>https://dev.to/mywebrank/how-to-build-daily-rewards-deals-and-bonus-reward-points-that-users-cannot-game-3e6a</guid>
      <description>&lt;p&gt;Daily rewards are one of the oldest retention tricks in apps: open the app, claim something, come back tomorrow. They are also easy to get wrong. Users find ways to claim twice, streaks break because of time zones, and the "deal of the day" quietly costs more than it earns.&lt;/p&gt;

&lt;p&gt;Here is a practical way to build daily rewards deals and bonus reward points that hold up in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Define the day on the server, in the user's time zone
&lt;/h2&gt;

&lt;p&gt;A "day" is not midnight UTC. Store each user's time zone and compute the reward day on the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- reward_day is a DATE in the user's local time zone&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="no"&gt;AT&lt;/span&gt; &lt;span class="kt"&gt;TIME&lt;/span&gt; &lt;span class="no"&gt;ZONE&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tz&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;date&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;reward_day&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Never trust the client clock. Phones are set to the wrong date more often than you would think, sometimes on purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Make claiming idempotent
&lt;/h2&gt;

&lt;p&gt;Use a unique constraint so a double tap, a retry or a race condition can only ever create one claim:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;daily_claims&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;user_id&lt;/span&gt;    &lt;span class="kt"&gt;BIGINT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;reward_day&lt;/span&gt; &lt;span class="kt"&gt;DATE&lt;/span&gt;   &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;points&lt;/span&gt;     &lt;span class="kt"&gt;INT&lt;/span&gt;    &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nb"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reward_day&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Insert with ON CONFLICT DO NOTHING and return the existing row if the claim already happened. The ledger credit should be written in the same transaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Streaks should forgive, not punish
&lt;/h2&gt;

&lt;p&gt;Hard streak resets are the fastest way to make users quit. A common pattern is one free "freeze" per week, or decaying the streak by a few days instead of dropping it to zero. Derive the streak from daily_claims so you can change the rules later without migrations.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Separate bonus points from real money
&lt;/h2&gt;

&lt;p&gt;If your program has both cashback and points, keep them as different balance types in the ledger. Bonus reward points from daily claims usually carry an expiry date; cashback from a real purchase should not. Mixing them makes support tickets painful and accounting worse.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Tie the best rewards to real actions
&lt;/h2&gt;

&lt;p&gt;Daily check in rewards drive opens, not revenue. The higher value rewards should be attached to actions that matter: a purchase, a referral, a verified product scan. Product based cashback programs such as &lt;a href="https://assuredrewards.in/" rel="noopener noreferrer"&gt;Assured Rewards&lt;/a&gt; do this by putting a unique QR code on each pack, so the reward is earned only when a genuine product is bought and scanned.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Watch the unit economics
&lt;/h2&gt;

&lt;p&gt;Track cost per active user per day and the lift in purchases from users who claim versus those who do not. If daily rewards deals only increase app opens, cap them and move the budget to purchase linked rewards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;A good daily rewards system is mostly boring engineering: server side dates, idempotent writes, a clean ledger and rules you can tune. Get those right and you can experiment freely with the fun parts.&lt;/p&gt;

&lt;p&gt;How do you handle streaks and time zones in your apps? Share in the comments.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>database</category>
      <category>fintech</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Designing a Rewards Store: How Cashback Wallets, Points and Gift Card Redemption Fit Together</title>
      <dc:creator>adi chauhan</dc:creator>
      <pubDate>Wed, 25 Nov 2026 06:06:01 +0000</pubDate>
      <link>https://dev.to/mywebrank/designing-a-rewards-store-how-cashback-wallets-points-and-gift-card-redemption-fit-together-2o62</link>
      <guid>https://dev.to/mywebrank/designing-a-rewards-store-how-cashback-wallets-points-and-gift-card-redemption-fit-together-2o62</guid>
      <description>&lt;p&gt;Most rewards products start simple: "give users some cashback". Within a few months the team is dealing with points that expire, vouchers that run out of stock, partial redemptions and users asking where their money went. The difference between a rewards program people trust and one they abandon is mostly in how the wallet and the rewards store are designed.&lt;/p&gt;

&lt;p&gt;Here is a practical way to structure it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. One ledger, several balances
&lt;/h2&gt;

&lt;p&gt;Keep a single append only ledger table and derive every balance from it. Each row has a user, an amount, a currency type and a reason:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;type&lt;/th&gt;
&lt;th&gt;meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cashback&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;real money, withdrawable to UPI or bank&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;points&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;program currency, only redeemable in the store&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bonus_points&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;promotional points with an expiry date&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Never update a balance column in place. Credits and debits are new rows, which makes audits, refunds and disputes far easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Decide what is cash and what is not
&lt;/h2&gt;

&lt;p&gt;This decision affects regulation, accounting and user trust. Cashback that can be withdrawn behaves like money, so it needs reliable payouts and reconciliation. Points are a promise that can be redeemed only inside your catalogue. Be explicit in the UI about which is which. Users get angry when something called "cashback" turns out to be store credit.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Expiry that users can see
&lt;/h2&gt;

&lt;p&gt;If promotional points expire, show the expiry date next to the balance and send a reminder before it happens. Process expiry as a ledger debit with reason &lt;code&gt;expired&lt;/code&gt;, rather than silently deleting anything. Spend the oldest points first (FIFO) so expiry hits as few users as possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Designing the catalogue
&lt;/h2&gt;

&lt;p&gt;A rewards store only works if people want what is in it. Things that matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Everyday brands first.&lt;/strong&gt; Vouchers for groceries, fuel, food delivery and fashion get redeemed far more than niche items.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low entry price.&lt;/strong&gt; Make sure there is something users can redeem with a small balance, so they experience the reward early.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live stock and price sync.&lt;/strong&gt; Gift card inventory comes from aggregators via API. Cache availability, but re check stock at checkout.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good real world example of a consumer facing &lt;a href="https://assuredrewards.in/store" rel="noopener noreferrer"&gt;rewards store&lt;/a&gt; is one that sits right next to the cashback wallet, so the user can choose between withdrawing cash and redeeming for a voucher from the same screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The redemption flow
&lt;/h2&gt;

&lt;p&gt;Redemption is a distributed transaction between your ledger and a third party gift card provider, so treat it carefully:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;code&gt;redemption&lt;/code&gt; record with status &lt;code&gt;pending&lt;/code&gt; and an idempotency key.&lt;/li&gt;
&lt;li&gt;Place a hold (debit) on the user's balance in the ledger.&lt;/li&gt;
&lt;li&gt;Call the provider to issue the card, passing the idempotency key.&lt;/li&gt;
&lt;li&gt;On success, store the card code encrypted and mark the redemption &lt;code&gt;completed&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;On a definite failure, reverse the hold with a credit row. On a timeout, poll the provider before deciding.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This pattern means a user is never charged twice and never loses balance because a provider was slow.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Delivering gift cards safely
&lt;/h2&gt;

&lt;p&gt;Show the code inside the app behind authentication, not only by SMS or email. Mask it by default and let the user reveal it. Log every reveal. Most gift card fraud comes from leaked codes, not from the redemption API itself.&lt;/p&gt;

&lt;p&gt;Offering both cash withdrawal and the option to &lt;a href="https://assuredrewards.in/gift-cards" rel="noopener noreferrer"&gt;redeem cashback for gift cards&lt;/a&gt; gives users a choice, and in practice many prefer vouchers for brands they already shop at.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Rewards systems look like a marketing feature but behave like a small bank: ledgers, holds, idempotency and reconciliation. Get those right first and the fun parts, campaigns, bonus points and catalogue design, become much easier to change later.&lt;/p&gt;

&lt;p&gt;What is the trickiest part of rewards you have had to build? I would love to hear about it in the comments.&lt;/p&gt;

</description>
      <category>fintech</category>
      <category>backend</category>
      <category>database</category>
      <category>architecture</category>
    </item>
    <item>
      <title>How QR Code Cashback Systems Work: Unique Codes, Fraud Checks and UPI Payouts</title>
      <dc:creator>adi chauhan</dc:creator>
      <pubDate>Tue, 24 Nov 2026 11:41:45 +0000</pubDate>
      <link>https://dev.to/mywebrank/how-qr-code-cashback-systems-work-unique-codes-fraud-checks-and-upi-payouts-8g7</link>
      <guid>https://dev.to/mywebrank/how-qr-code-cashback-systems-work-unique-codes-fraud-checks-and-upi-payouts-8g7</guid>
      <description>&lt;p&gt;Cashback used to mean one thing: a percentage back on a card or wallet payment. In India, a newer model is growing fast. Brands print a unique QR code on every pack, the buyer scans it after purchase, and money lands in their UPI account within minutes. It looks simple from the outside. Under the hood it is a small but interesting system that has to solve code generation, fraud, and payouts at scale.&lt;/p&gt;

&lt;p&gt;This post walks through how a typical QR cashback platform is put together.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Generating codes that cannot be guessed
&lt;/h2&gt;

&lt;p&gt;Every pack needs its own code, and those codes must be impossible to predict. If codes were sequential, anyone could script a loop and claim thousands of rewards.&lt;/p&gt;

&lt;p&gt;A common approach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generate a random token per unit (for example 12 to 16 characters from a URL safe alphabet), or sign a serial number with an HMAC so the server can verify it without storing every code in advance.&lt;/li&gt;
&lt;li&gt;Encode a short URL into the QR, such as &lt;code&gt;https://example.com/s/&amp;lt;token&amp;gt;&lt;/code&gt;, so the scan works with any phone camera and needs no app.&lt;/li&gt;
&lt;li&gt;Store each token with its batch, SKU, campaign and reward amount, plus a status field: &lt;code&gt;unused&lt;/code&gt;, &lt;code&gt;claimed&lt;/code&gt;, &lt;code&gt;blocked&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Printing partners receive batches as CSV files, and the codes are usually hidden under a scratch panel so they cannot be read on the shelf before purchase.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The claim flow
&lt;/h2&gt;

&lt;p&gt;When a buyer scans, the backend has to answer three questions in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Is this code real?&lt;/strong&gt; Look up or verify the token. An unknown token means a counterfeit or a typo.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Has it been used?&lt;/strong&gt; Claiming must be atomic. Use a conditional update such as &lt;code&gt;UPDATE codes SET status = 'claimed' WHERE token = ? AND status = 'unused'&lt;/code&gt; and check the affected row count, so two simultaneous scans cannot both win.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who gets the reward?&lt;/strong&gt; Attach the claim to a verified user, normally by mobile number with OTP.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A nice side effect of step 1 is product authentication. A scan that returns "unknown" or "already claimed" on a pack that was just opened is a strong signal of a fake or tampered product. Some platforms turn this into a visible feature, for example &lt;a href="https://assuredrewards.in/how-verify-works" rel="noopener noreferrer"&gt;genuine product verification&lt;/a&gt; shown to the buyer right after the scan.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Fraud controls that actually matter
&lt;/h2&gt;

&lt;p&gt;Money attracts abuse, so a few controls go a long way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rate limits&lt;/strong&gt; per device, per IP and per mobile number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Velocity checks&lt;/strong&gt;: one user claiming 40 codes from the same batch in an hour is not a normal shopper.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Geo sanity checks&lt;/strong&gt;: a batch shipped to Kerala being scanned in bulk in one city elsewhere deserves a review.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hold and release&lt;/strong&gt;: small rewards pay instantly, unusual patterns go to a short manual review queue.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blocking whole batches&lt;/strong&gt; if a printer leak is discovered.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Wallets and UPI payouts
&lt;/h2&gt;

&lt;p&gt;Paying out every few rupees as a separate bank transfer would be expensive and noisy, so most platforms credit an internal wallet first. The wallet is a ledger, not a single balance column: every credit and debit is an immutable row, and the balance is derived from it. That makes reconciliation and audits much easier.&lt;/p&gt;

&lt;p&gt;When the user withdraws, the platform calls a bank's UPI payout (disbursement) API. Important details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Send an &lt;strong&gt;idempotency key&lt;/strong&gt; with every payout request, so a retry after a timeout never pays twice.&lt;/li&gt;
&lt;li&gt;Treat payouts as asynchronous. Record the request as &lt;code&gt;pending&lt;/code&gt;, then confirm via callback or status polling.&lt;/li&gt;
&lt;li&gt;Run a daily reconciliation between your ledger and the bank statement.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. What brands get out of it
&lt;/h2&gt;

&lt;p&gt;For the brand, each scan is a first party data point: which SKU, which city, what time, and whether this buyer has scanned before. That turns a product sold through thousands of small retail stores into something closer to a direct relationship, which is the real reason brands run these &lt;a href="https://assuredrewards.in/vendor" rel="noopener noreferrer"&gt;cashback and loyalty campaigns&lt;/a&gt; instead of plain price discounts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;A QR cashback system is a good example of a product that looks like marketing but is really an exercise in idempotency, concurrency and ledger design. If you want to see the consumer side of this flow in production, &lt;a href="https://assuredrewards.in/" rel="noopener noreferrer"&gt;Assured Rewards&lt;/a&gt; is one Indian platform built on this model, from scan to UPI withdrawal.&lt;/p&gt;

&lt;p&gt;If you have built something similar, I would love to hear how you handled duplicate scans and payout retries in the comments.&lt;/p&gt;

</description>
      <category>fintech</category>
      <category>backend</category>
      <category>systemdesign</category>
      <category>startup</category>
    </item>
    <item>
      <title>Is Your Website Blocking ChatGPT? How to Check AI Crawler Access</title>
      <dc:creator>adi chauhan</dc:creator>
      <pubDate>Tue, 24 Nov 2026 10:30:39 +0000</pubDate>
      <link>https://dev.to/mywebrank/is-your-website-blocking-chatgpt-how-to-check-ai-crawler-access-5f65</link>
      <guid>https://dev.to/mywebrank/is-your-website-blocking-chatgpt-how-to-check-ai-crawler-access-5f65</guid>
      <description>&lt;p&gt;You may have done everything right for Google and still be invisible on ChatGPT, Perplexity and Gemini. One surprisingly common reason: your website is telling AI crawlers to stay away. Here is how to check, and how to fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What AI crawlers are
&lt;/h2&gt;

&lt;p&gt;Just as Google sends Googlebot to read websites, AI companies send their own bots. The main ones are:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Bot name&lt;/th&gt;
&lt;th&gt;Company&lt;/th&gt;
&lt;th&gt;Used for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GPTBot&lt;/td&gt;
&lt;td&gt;OpenAI&lt;/td&gt;
&lt;td&gt;Training ChatGPT's models&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OAI-SearchBot&lt;/td&gt;
&lt;td&gt;OpenAI&lt;/td&gt;
&lt;td&gt;ChatGPT search results&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PerplexityBot&lt;/td&gt;
&lt;td&gt;Perplexity&lt;/td&gt;
&lt;td&gt;Perplexity answers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google-Extended&lt;/td&gt;
&lt;td&gt;Google&lt;/td&gt;
&lt;td&gt;Gemini and AI features&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ClaudeBot&lt;/td&gt;
&lt;td&gt;Anthropic&lt;/td&gt;
&lt;td&gt;Claude&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If these bots cannot read your pages, the AI tools have less reason, and less information, to recommend you.&lt;/p&gt;

&lt;h2&gt;
  
  
  How websites block them by accident
&lt;/h2&gt;

&lt;p&gt;Access is controlled by a small file called robots.txt. Some security plugins, hosting presets and copy-pasted templates add lines like these:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;GPTBot&lt;/span&gt;
&lt;span class="nc"&gt;Disallow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That single rule tells OpenAI's crawler not to read any page on your site. Some setups go further and block every bot except Google.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to check in two minutes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open your browser and visit &lt;code&gt;yourdomain/robots.txt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Look for any of the bot names in the table above&lt;/li&gt;
&lt;li&gt;If a name appears with &lt;code&gt;Disallow: /&lt;/code&gt;, that bot is blocked&lt;/li&gt;
&lt;li&gt;Also check for &lt;code&gt;User-agent: *&lt;/code&gt; followed by &lt;code&gt;Disallow: /&lt;/code&gt;, which blocks everyone&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some firewalls and CDNs also block AI bots at the server level, so a clean robots.txt is not always the whole story. Check your CDN's bot settings too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Should you allow AI crawlers?
&lt;/h2&gt;

&lt;p&gt;For most businesses that want customers, yes. Being readable by AI is how you get recommended in AI answers. Publishers who sell their content may choose differently, but a dentist, a shop or a service firm almost always benefits from being visible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Go one step further
&lt;/h2&gt;

&lt;p&gt;Opening the door is step one. Step two is knowing whether AI tools actually mention you once they can read your site. &lt;a href="https://mywebrank.tech/" rel="noopener noreferrer"&gt;MyWebRank&lt;/a&gt; lets you check your AI visibility for free: it shows where you appear on ChatGPT, Gemini and Perplexity, and which fixes on your site will help most.&lt;/p&gt;

&lt;p&gt;A two-minute check of one small file could be the difference between being recommended and being ignored.&lt;/p&gt;

</description>
      <category>seo</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
