Skip to main content

Integrate Redemption

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 using the server-side API.
2

Initiate Redemption

User requests redemption through your app UI.
3

Backend Validation

Your backend validates and calls Gameball server API to create the redemption transaction.
4

Update UI

Backend returns success/failure and the app updates accordingly.

Get Customer Balance

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

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

async function redeemPoints(pointsToRedeem: number) {
  try {
    // Call your backend endpoint
    const response = await fetch('https://your-backend.com/api/redeem', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        customerId: 'customer-123',
        points: pointsToRedeem,
      }),
    });

    const data = await response.json();

    if (data.success) {
      // Show success message
      Alert.alert('Success', 'Points redeemed successfully!');
      
      // Optionally refresh the profile widget
      // to show updated balance
    } else {
      Alert.alert('Error', data.message);
    }
  } catch (error) {
    Alert.alert('Error', '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