# Gamification

URL: https://www.digia.tech/docs/developer/moengage/gamification

MoEngage Change your setup in the sidebar
Run scratch cards, spin-the-wheel and other reward campaigns from MoEngage with Digia Engage: identify users, add the rewards page, set up webhooks.

Gamification campaigns, such as a wheel or a scratch card, give users rewards. Gamification is available in the Android, iOS, React Native and Flutter SDKs.

MoEngage decides who sees each campaign. Your campaign team connects it with `digia_campaign_key` . SeeStep 5: Connect MoEngage campaigns .

## 1. Identify users

Games need a user ID, and the user hash when user verification is on. Set them inStep 4: Identify users .

## 2. Open the rewards page

The rewards page shows the user's game chances and rewards. The SDK draws it. Open it from a "My rewards" button or a link. Identify the user before you open it.

- React Native - Android - iOS (Swift) - Flutter

```tsx
import { Button } from 'react-native';
import { Digia } from '@digia-engage/core';

export function RewardsButton() {
  return <Button title="My rewards" onPress={() => Digia.openRewards()} />;
}
```

```kotlin
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import com.digia.engage.Digia

@Composable
fun RewardsButton() {
    val context = LocalContext.current
    Button(onClick = { Digia.openRewards(context) }) {
        Text("My rewards")
    }
}
```

```swift
import SwiftUI
import DigiaEngage

struct RewardsButton: View {
    var body: some View {
        Button("My rewards") {
            Digia.openRewards()
        }
    }
}
```

```dart
import 'package:digia_engage/digia_engage.dart';
import 'package:flutter/material.dart';

class RewardsButton extends StatelessWidget {
  const RewardsButton({super.key});

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: Digia.openRewards,
      child: const Text('My rewards'),
    );
  }
}
```

To open it from a deep link, pass the link to `Digia.handleDeepLink(uri)` . It opens the rewards page for the SDK rewards link and returns `false` for anything else, so your own routing continues.

On iOS, including Flutter apps running on iOS, the rewards page needs iOS 17 or later.

## 3. Handle rewards on your server

- Webhooks : get a `reward.won` event when a user wins.
- Reward Used Callback : mark a reward as used.
- Reward Links : add a link to a reward.
