Skip to main content

Send Orders & Calculate Cashback Rewards

Use the Gameball Android SDK to track customer orders and trigger cashback rewards. This is typically done once a customer completes a paid order, ensuring accurate points and cashback calculation.

Send an Order to Gameball

val order = OrderRequest.builder()
  .orderId("order-123")
  .customerId("customer-123")
  .amount(99.99)
  .currency("USD")
  .status("paid")
  .build()

GameballApp.getInstance(context).sendOrder(
  order,
  object : Callback<Boolean> {
      override fun onSuccess(success: Boolean) {
          // Order tracked successfully
      }

      override fun onError(error: Throwable) {
          // Handle error
      }
  }
)

Order Parameters

orderId
string
required
Unique identifier for the order.
customerId
string
required
The customer who placed the order.
amount
double
required
Total order amount.
currency
string
required
Currency code (e.g., "USD", "EUR", "GBP").
status
string
required
Order status such as "paid", "pending", "cancelled", "refunded".
lineItems
List<OrderLineItem>
List of items included in the order.
Important: Only send orders when they are actually marked as paid.
For Cash-on-Delivery (COD), track the order only after payment is successfully captured to avoid incorrect point or cashback allocation.

Order With Line Items

val lineItem1 = OrderLineItem.builder()
    .productId("PROD-123")
    .productName("Wireless Headphones")
    .quantity(1)
    .price(79.99)
    .build()

val lineItem2 = OrderLineItem.builder()
    .productId("PROD-456")
    .productName("Phone Case")
    .quantity(2)
    .price(19.99)
    .build()

val order = OrderRequest.builder()
    .orderId("order-123")
    .customerId("customer-123")
    .amount(119.97)
    .currency("USD")
    .status("paid")
    .lineItems(listOf(lineItem1, lineItem2))
    .build()

Cashback Rewards

Cashback is automatically calculated based on your Gameball Program Configuration. Gameball checks:
  • Cashback rules
  • Order amount
  • Eligible customer
  • Reward tiers
  • Any applicable campaigns
Once the order is tracked with a “paid” status, cashback (if configured) is granted automatically.
For more advanced or secure implementations, consider using the server-side Order API

Next Steps