Track your customer’s orders for cashback and achievements.
Start tracking customer’s orders on your platform upon order completion and successful payment. This enables rewarding the customer with cashback wallet points for paid amounts as per your cashback program configuration on Gameball.
Cashback rewarding and order tracking can be done via server side Order API which is a tailored API to support e-commerce platforms.
Order Tracking Implementation
To track orders and provide cashback rewards in your Flutter app, you’ll need to integrate with the Order API on your backend server.
Backend Integration
The order tracking is typically handled on your backend server using the Order API:
POST https://api.gameball.co/api/v3.0/integrations/order
Content-Type : application/json
apiKey : your_api_key
{
"playerUniqueId" : "customer_123" ,
"orderId" : "ORD-12345" ,
"orderDate" : "2024-01-15T10:30:00Z" ,
"orderTotal" : 99.99 ,
"orderLineItems" : [
{
"productId" : "PROD-001" ,
"productName" : "Sample Product" ,
"productPrice" : 99.99 ,
"productQuantity" : 1 ,
"productCategory" : "Electronics"
}
]
}
Flutter Implementation
In your Flutter app, you can track order completion by calling your backend API:
// Track order completion
Future < void > trackOrderCompletion ( String customerId, Map < String , dynamic > orderData) async {
try {
// Call your backend API to track the order
final response = await http. post (
Uri . parse ( ' ${ your_backend_url } /track-order' ),
headers : {
'Content-Type' : 'application/json' ,
'Authorization' : 'Bearer ${ customer_token } ' ,
},
body : jsonEncode ({
'customerId' : customerId,
'orderData' : orderData,
}),
);
if (response.statusCode == 200 ) {
final result = jsonDecode (response.body);
// Handle successful order tracking
print ( 'Order tracked successfully: ${ result [ 'orderId' ]} ' );
} else {
// Handle error
print ( 'Failed to track order: ${ response . statusCode } ' );
}
} catch (e) {
// Handle exception
print ( 'Error tracking order: $ e ' );
}
}
Cashback Configuration
Configure cashback rewards in your Gameball dashboard:
Set Cashback Rate
Configure the percentage of order value to be awarded as cashback
Define Minimum Order Value
Set the minimum order amount required to earn cashback
Configure Maximum Cashback
Set limits on maximum cashback amount per order
Enable Category-Based Rewards
Configure different cashback rates for different product categories
Order Status Tracking
Track different order statuses to provide appropriate rewards:
Completed Orders
Orders that have been successfully delivered
Full cashback rewards are awarded
Customer achievements are updated
Cancelled Orders
Orders that have been cancelled by customer or merchant
Cashback rewards are reversed if already awarded
Order history is maintained for analytics
Refunded Orders
Orders that have been refunded
Cashback rewards are reversed
Refund events are tracked for customer service
Partial Refunds
Orders with partial refunds
Cashback is recalculated based on final amount
Updated rewards are applied accordingly
Testing Order Tracking
Test Order Creation
Create test orders with various amounts and products
Verify Cashback Calculation
Ensure cashback is calculated correctly based on your configuration
Check Order History
Verify that orders appear in customer’s order history
Test Edge Cases
Test with minimum order values, maximum cashback limits, and special categories
Best Practices
Always track orders after successful payment confirmation
Implement proper error handling for failed API calls
Store order tracking responses for debugging purposes
Test order tracking in your staging environment before going live
Make sure to handle order tracking failures gracefully. If the Gameball API is temporarily unavailable, you should retry the request or queue it for later processing.