# Reward Customers with Airtime and Data

Turn surveys, referrals, and loyalty milestones into instant airtime or data rewards on MTN, Telecel, and AT using the Sales APIs. There is no payment step: rewards are paid from a pre-funded wallet.

## Before you begin

Create a Sell on Our Platform Service in the Moolre App, fund its linked wallet, and send that wallet as accountnumber on every Sales request. See the [Sales guide](https://docs.moolre.com/guides/sales).

## Reward flow

1. The customer qualifies: a survey is submitted, a referral converts, or a milestone is reached.
2. Check eligibility and budget: one reward per person per campaign, within the campaign budget and the [Account Status](https://docs.moolre.com/api/accounts/status) balance.
3. Send the reward with [Airtime](https://docs.moolre.com/api/sales/airtime) (from GHS 1.00) or [Data](https://docs.moolre.com/api/sales/data) (bundle ID from [Bundles](https://docs.moolre.com/api/sales/bundles)).
4. Confirm with [Sales Status](https://docs.moolre.com/api/sales/status) using idtype 1 and the same reference, then notify the customer.

## Design the campaign

- Use a stable reference per campaign and person, such as RWD-survey-oct26-1042, so nobody is rewarded twice. The Sales API also rejects a reused external reference in the same wallet (ASL08).
- Set a total budget and stop issuing rewards when it is reached.
- Collect the recipient network, because the reward goes to the network sent as channel.
- Run rewards from a background queue, one at a time or in small batches.

## Handle every outcome

| txstatus | Outcome | Action |
| --- | --- | --- |
| 0 | Pending | Check Sales Status again later. Do not resend the reward. |
| 1 | Sent | Mark the reward as paid and send a thank-you SMS. |
| 2 | Failed and refunded | The wallet was refunded. Retry once with a new reference, or offer a different reward. |
| 3 | Not found | No sale exists for that reference. Flag the reward for review. |

## Prevent abuse

- Verify phone number ownership with an SMS one-time code.
- Enforce one reward per person with the stable reference and a unique database constraint.
- Cap rewards per phone number, device, and IP address per day.
- Pay referral rewards only after the referred customer completes a real action.
- After a timeout or ASL06, check Sales Status with the original reference before any retry. Only a final txstatus 2 makes it safe to send again with a new reference.
- Alert when the wallet balance nears the remaining campaign budget, and pause the queue.
