Skip to main content

Integrate Redemption (Wallet / Points)

Enable customers to redeem their earned points for rewards, discounts, or other benefits within your app.

Redemption Flow

1

Check Customer Balance

Query the customer’s points balance to determine if they have enough points to redeem.
2

Initiate Redemption

User requests redemption through your app UI.
3

Backend Validation

Your backend validates the redemption request and calls Gameball server API.
4

Update UI

Backend returns success/failure and the app refreshes the customer profile.

Get Customer Balance

Use the server-side Customer Points Balance API to check if the customer has enough points for redemption.

Refresh Profile After Redemption

After a successful redemption on your backend, you can refresh the Gameball profile widget to show updated balances.

Redemption Implementation

Your backend should:
  1. Verify the customer has sufficient points
  2. Call Redeem API to create redemption transaction
  3. Return the result to your app
  4. Update order/cart with the discount if applicable

App Implementation Example

Future<void> redeemPoints(int pointsToRedeem) async {
  try {
    // Call your backend endpoint
    final response = await yourBackendAPI.createRedemption(
      customerId: "customer-123",
      points: pointsToRedeem,
    );

    if (response.success) {
      // Show success message
      showSuccessDialog("Points redeemed successfully!");
      
      // Refresh the profile widget to show updated balance
      // You may need to rebuild the widget or navigate back
    } else {
      showErrorDialog(response.message);
    }
  } catch (e) {
    showErrorDialog("Failed to redeem points");
  }
}

E-Commerce Redemption

For e-commerce businesses, points redemption is typically done during checkout using the Order API. The redemption details (points to redeem and discount amount) should be handled on your backend.
Always validate redemptions on your backend to prevent fraud and ensure accurate point deductions.
For non-e-commerce scenarios, use the Redeem API to create redemption transactions.

Next Steps