> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gameball.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Calculate Order Cashback

> Calculate expected cashback points for an order (no reward applied).

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.

<Info>
  Security: Provide `apikey` header.
</Info>


## OpenAPI

````yaml POST /api/v4.0/integrations/orders/cashback
openapi: 3.1.0
info:
  title: Gameball API
  description: >-
    Gameball REST API v4.0 - Complete API reference for integrating loyalty,
    gamification, and customer engagement features
  version: 4.0.0
servers:
  - url: https://api.gameball.co
security:
  - bearerAuth: []
paths:
  /api/v4.0/integrations/orders/cashback:
    post:
      tags:
        - Orders
      summary: Calculate Order Cashback
      description: >-
        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.
      operationId: calculateOrderCashback
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - totalPaid
                - totalDiscount
                - totalShipping
              properties:
                customerId:
                  type: string
                  description: >-
                    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:
                  type: string
                  description: >-
                    Customer's email address. **Note:** This is required if your
                    account uses email-based channel merging.
                  example: john.doe@example.com
                mobile:
                  type: string
                  description: >-
                    Customer's mobile number. **Note:** This is required if your
                    account uses mobile-based channel merging.
                  example: '+1234567890'
                totalPaid:
                  type: number
                  description: >-
                    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
                totalPrice:
                  type: number
                  description: >-
                    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
                totalDiscount:
                  type: number
                  description: Total discount applied to the order. Must be positive.
                  minimum: 0
                  example: 0
                totalShipping:
                  type: number
                  description: Total shipping cost for the order.
                  example: 0
                lineItems:
                  type: array
                  description: >-
                    An array containing details about each product in the order.
                    If not provided, the calculation will only consider the
                    total order values.
                  items:
                    type: object
                    properties:
                      productId:
                        type: string
                        description: >-
                          Unique identifier for the product or service being
                          purchased.
                        example: '875511'
                      quantity:
                        type: number
                        description: Number of units purchased for this product or service.
                        example: 1
                      price:
                        type: number
                        description: >-
                          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.
                        example: 150
                      sku:
                        type: string
                        description: Stock Keeping Unit (SKU) for the product.
                        example: sku123
                      tags:
                        type: array
                        items:
                          type: string
                        description: >-
                          Tags associated with the product for categorization or
                          promotional purposes.
                      category:
                        type: array
                        items:
                          type: string
                        description: >-
                          Product category, such as fashion or electronics. It
                          can include one or multiple categories. Example:
                          ["natural", "cosmetics"]
                      weight:
                        type: number
                        description: Weight of the product.
                      vendor:
                        type: string
                        description: Vendor or manufacturer of the product.
                      collection:
                        type: array
                        items:
                          type: string
                        description: >-
                          Collection ID(s) to which the product belongs. It can
                          include one or multiple collections. Example:
                          ["14313", "4343"]
                        example:
                          - '123'
                      title:
                        type: string
                        description: Product title or name.
                      taxes:
                        type: number
                        description: >-
                          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.
                        example: 0
                      discount:
                        type: number
                        description: >-
                          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.
                        example: 0
                      extra:
                        type: object
                        additionalProperties: true
                        description: >-
                          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:
                  type: object
                  description: >-
                    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.
                  properties:
                    uniqueId:
                      type: string
                      description: Unique identifier for the merchant.
                      example: MERCH001
                    name:
                      type: string
                      description: Name of the merchant.
                      example: TechGadgetStore
                    branch:
                      type: object
                      description: Branch information where the order took place.
                      properties:
                        uniqueId:
                          type: string
                          description: >-
                            Unique identifier for the branch where the order
                            took place.
                          example: BRANCH001
                        name:
                          type: string
                          description: Name of the branch where the order took place.
                          example: Downtown Branch
      responses:
        '200':
          description: Cashback calculated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  totalPoints:
                    type: number
                    description: Total points expected to be earned from the entire order.
                    example: 19000
                  totalScore:
                    type: number
                    description: Total score expected to be earned from the entire order.
                    example: 0
                  lineItems:
                    type: array
                    description: >-
                      An array of individual line items and their cashback
                      calculation details.
                    items:
                      type: object
                      properties:
                        productId:
                          type: string
                          description: Unique identifier for the product.
                          example: '875511'
                        quantity:
                          type: number
                          description: The quantity of the product purchased.
                          example: 1
                        totalDecimalPoints:
                          type: number
                          description: >-
                            The total decimal points earned for this line item,
                            including any campaign impact.
                          example: 15000
                        totalPoints:
                          type: number
                          description: >-
                            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.
                          example: 15000
                        totalScore:
                          type: number
                          description: >-
                            The total score earned for this line item. This
                            value is separate from point and is based on your
                            cashback rewards configuration.
                          example: 0
                        rewardWalletFactor:
                          type: number
                          description: >-
                            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.
                          example: 20
                        campaignId:
                          type:
                            - integer
                            - 'null'
                          description: >-
                            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.
                          example: 2149
                        campaignName:
                          type:
                            - string
                            - 'null'
                          description: >-
                            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."
                          example: 5x Points Campaign
                        campaignEndDate:
                          type:
                            - string
                            - 'null'
                          format: date-time
                          description: >-
                            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.
                          example: '2024-11-01T08:39:00'
                        campaignImpactWalletFactor:
                          type: number
                          description: >-
                            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.
                          example: 5
                        campaignImpactPoints:
                          type: number
                          description: >-
                            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).
                          example: 12000
      security:
        - apiKey: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKey:
      type: apiKey
      in: header
      name: apikey

````