Skip to main content
POST
/
api
/
v4.0
/
integrations
/
orders
/
cashback
Calculate Order Cashback
curl --request POST \
  --url https://api.gameball.co/api/v4.0/integrations/orders/cashback \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --data '
{
  "totalPaid": 350,
  "totalDiscount": 0,
  "totalShipping": 0,
  "customerId": "cust_12345abc",
  "email": "john.doe@example.com",
  "mobile": "+1234567890",
  "totalPrice": 350,
  "lineItems": [
    {
      "productId": "875511",
      "quantity": 1,
      "price": 150,
      "sku": "sku123",
      "tags": [
        "<string>"
      ],
      "category": [
        "<string>"
      ],
      "weight": 123,
      "vendor": "<string>",
      "collection": [
        "123"
      ],
      "title": "<string>",
      "taxes": 0,
      "discount": 0,
      "extra": {}
    }
  ],
  "merchant": {
    "uniqueId": "MERCH001",
    "name": "TechGadgetStore",
    "branch": {
      "uniqueId": "BRANCH001",
      "name": "Downtown Branch"
    }
  }
}
'
{
  "totalPoints": 19000,
  "totalScore": 0,
  "lineItems": [
    {
      "productId": "875511",
      "quantity": 1,
      "totalDecimalPoints": 15000,
      "totalPoints": 15000,
      "totalScore": 0,
      "rewardWalletFactor": 20,
      "campaignId": 2149,
      "campaignName": "5x Points Campaign",
      "campaignEndDate": "2024-11-01T08:39:00",
      "campaignImpactWalletFactor": 5,
      "campaignImpactPoints": 12000
    }
  ]
}
Calculate the cashback points to be rewarded for a specific order. This estimates rewards based on your configured rules and eligibility; it does not perform any reward.
Security: Provide apikey header.

Authorizations

apikey
string
header
required

Body

application/json
totalPaid
number
required

The actual amount paid by the customer for the order, accounting for any discounts or coupons applied. Unlike totalPrice, which reflects the original cost of the order, totalPaid represents the final amount the customer paid at checkout after all adjustments. This value is used for reward calculations in Gameball to determine the points or benefits earned from the order. Example: A customer purchases items worth $120, including taxes and shipping. If a $20 coupon is applied, the totalPaid becomes $100, reflecting the discounted amount the customer paid. This is the value used to calculate any points or rewards earned from the order.

Example:

350

totalDiscount
number
required

Total discount applied to the order. Must be positive.

Required range: x >= 0
Example:

0

totalShipping
number
required

Total shipping cost for the order.

Example:

0

customerId
string

Unique identifier for the customer that you can reference across the customer's whole lifetime. Could be a database ID, random string, email or anything that uniquely identifies the customer. If provided, the cashback calculation will consider the customer's tier. Special tier-based configurations, such as enhanced point accrual rates, may affect the points calculation.

Example:

"cust_12345abc"

email
string

Customer's email address. Note: This is required if your account uses email-based channel merging.

Example:

"john.doe@example.com"

mobile
string

Customer's mobile number. Note: This is required if your account uses mobile-based channel merging.

Example:

"+1234567890"

totalPrice
number

The total cost of the order, including all item prices, shipping, taxes, and tips. This value does not account for any discounts or coupons applied and is not used for calculations in Gameball; it is solely saved as historical data linked to the order. Must be a positive value. Example: A customer purchases items worth $120, including taxes and shipping. Even if a $20 coupon is applied, the totalPrice remains $120 as it represents the original cost of the order before any discounts are applied.

Example:

350

lineItems
object[]

An array containing details about each product in the order. If not provided, the calculation will only consider the total order values.

merchant
object

This object contains details about the specific merchant involved in the transaction, which is particularly important for businesses managing multiple merchants or branches under the same Gameball account. This object can provide identifying information about both the main merchant and any associated branch where the transaction took place.

Response

200 - application/json

Cashback calculated successfully

totalPoints
number

Total points expected to be earned from the entire order.

Example:

19000

totalScore
number

Total score expected to be earned from the entire order.

Example:

0

lineItems
object[]

An array of individual line items and their cashback calculation details.