---
title: "Calculate Order Cashback"
method: POST
path: "/api/v4.0/integrations/orders/cashback"
tags: ["Orders"]
---

# Calculate Order Cashback

`POST /api/v4.0/integrations/orders/cashback`

This API calculates the cashback points to be rewarded for a specific order in Gameball, based on provided order details. It considers configured cashback rules and customer eligibility.

**Security:** Requires `apiKey` header.

**Channel Merging Available:** If your system uses different customer IDs across multiple channels (e.g., online and offline), Gameball's channel merging feature helps unify customer profiles. By including the customer's mobile number or email (based on your merging configuration) with each request, Gameball will combine activities into a single profile.

**Important:** This API calculates the expected cashback points but does not perform any actual reward or action for the customer.

## Request body

- object
  - `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.
  - `email` string — Customer's email address. **Note:** This is required if your account uses email-based channel merging.
  - `mobile` string — Customer's mobile number. **Note:** This is required if your account uses mobile-based channel merging.
  - `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.
  - `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.
  - `totalDiscount` number, required — Total discount applied to the order. Must be positive.
  - `totalShipping` number, required — Total shipping cost for the order.
  - `lineItems` object[] — An array containing details about each product in the order. If not provided, the calculation will only consider the total order values.
    - `productId` string — Unique identifier for the product or service being purchased.
    - `quantity` number — Number of units purchased for this product or service.
    - `price` number — The original price of a single product before any tax or discount is applied. This reflects the cost of one unit of the item, not the total for multiple quantities in an order. **Example:** If the original price of a product is $50 and a customer buys two units, the price for each item would still be recorded as $50, regardless of quantity.
    - `sku` string — Stock Keeping Unit (SKU) for the product.
    - `tags` string[] — Tags associated with the product for categorization or promotional purposes.
    - `category` string[] — Product category, such as fashion or electronics. It can include one or multiple categories. Example: ["natural", "cosmetics"]
    - `weight` number — Weight of the product.
    - `vendor` string — Vendor or manufacturer of the product.
    - `collection` string[] — Collection ID(s) to which the product belongs. It can include one or multiple collections. Example: ["14313", "4343"]
    - `title` string — Product title or name.
    - `taxes` number — The total amount of taxes applied to the line item, expressed in the shop's currency. This amount must be positive and reflects the total taxes based on the quantity of the item.
    - `discount` number — The total discount applied to this line item, expressed as a positive value. This amount should reflect the total discounts based on the quantity of the item.
    - `extra` object — Key-value pairs containing any extra information about the product, such as size, color, or other custom attributes. The values must be of type string or number.
  - `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.
    - `uniqueId` string — Unique identifier for the merchant.
    - `name` string — Name of the merchant.
    - `branch` object — Branch information where the order took place.
      - `uniqueId` string — Unique identifier for the branch where the order took place.
      - `name` string — Name of the branch where the order took place.

## Response `200`

Cashback calculated successfully

- object
  - `totalPoints` number — Total points expected to be earned from the entire order.
  - `totalScore` number — Total score expected to be earned from the entire order.
  - `lineItems` object[] — An array of individual line items and their cashback calculation details.
    - `productId` string — Unique identifier for the product.
    - `quantity` number — The quantity of the product purchased.
    - `totalDecimalPoints` number — The total decimal points earned for this line item, including any campaign impact.
    - `totalPoints` number — The total points earned for this line item, including any campaign impact. **Example:** If the base points for a product are 50 and a campaign adds 150 points, the totalPoints would be 200.
    - `totalScore` number — The total score earned for this line item. This value is separate from point and is based on your cashback rewards configuration.
    - `rewardWalletFactor` number — The multiplier applied to the product price to calculate the base points earned for this line item. This factor represents how many points are earned per unit of currency spent on the product. **Example:** If the store rewards 10 points for every $1 spent, the rewardWalletFactor would be 10.
    - `campaignId` integer, nullable — The unique identifier for the active transactional campaign that affects the cashback reward for purchasing this line item. If no campaign is applicable, this field will be null.
    - `campaignName` string, nullable — The name of the active transactional campaign that affects the cashback reward for purchasing this line item. If no campaign is applicable, this field will be null. **Example:** If a store is running a "Double Points Weekend" campaign, the campaignName could be "Double Points Weekend."
    - `campaignEndDate` string, date-time, nullable — The end date of the active campaign affecting the line item. This is the date when the campaign will no longer influence points or rewards.
    - `campaignImpactWalletFactor` number — The multiplier applied by the campaign to the base points calculation. This factor adjusts the final points earned for the line item based on the campaign's impact. Present only if a campaign is applicable. **Example:** If the campaign offers 3x points, the campaignImpactWalletFactor would be 3, multiplying the regular points earned by three.
    - `campaignImpactPoints` number — The total number of points given for this line item due to the campaign's impact. This value reflects the additional points earned from the campaign. **Example:** If the base points for an item are 100 and the campaign offers 5x points, the campaignImpactPoints would be 400 (totaling 500 points with the base points included).

---

[API](https://skmtc.net/gameballers/apis/gameball-api.md) · [All operations](https://skmtc.net/gameballers/apis/gameball-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gameballers/gameball-api/versions/3b11e1670d61/schema)
