Order

The order endpoints are used to track a new order. They are designed specifically for E-Commerce Solutions.

Available Endpoints

POST - Order

https://api.gameball.co/api/v3.0/integrations/order

After successfully placing a new order on your system, this endpoint can be used to track order details, optionally redeem points, and finally rewarding the customer for the placed order.

This endpoint performs multiple operations internally including sending an event, reward wallet points, redeem wallet points as per your configured programs. It offers a hassle-free single point of integration for e-commerce cases.

Order endpoint internally triggers a "place_order" event, so no need to manually send such event to Gameball after placing an order

For more information about tracking orders and cashback reward, check checkout integration example tutorial

mobile or email should be sent along with the playerUniqueId in case (only if) your account supports channel merging.

In cases where channel merging is supported, you have the flexibility to identify users by their mobile number or email. For accounts utilizing separate systems for online and offline channels, it's advisable to consider changing the customer's unique ID to either their mobile number or email address for enhanced efficiency.

Request

Body

lineItems Object

The (*) in the required column denotes that this value is required only if you wish to use the Custom Cashback configurations.

merchant object

In case the customer doesn't exist on Gameball before sending the Orders API call, the customer will be created automatically on Gameball.

Sample Request Body

{
  "playerUniqueId":"player456",   
  "orderId": "6253e03b",
  "orderDate":"2019-09-21T16:53:28.190Z",
  "totalPrice": "100",
  "totalPaid": "90",
  "totalDiscount": "0",
  "totalShipping": "0",
  "totalTax": "0", 
  "lineItems":[
    {
      "productId":"197765",
      "tag": ["VIP"],
      "quantity": 2,
      "category": [
        "natural",
        "cosmetics"
      ],
      "weight": "20",
      "vendor": "nike",
      "collection": ["14313", "4343"],
    },
    {
      "productId":"875511",
      "title": "XPS-15s",
      "category": [
        "electronics"
      ],
      "vendor": "Dell"
    }
  ],
  "discountCodes": [
      "AU7X-8Q7L",
      "BY3V-22GK"
  ],
  "extra": {
    "paymentMethod": "credit card",
    "billingAddress": "Alabama"
  },
  "redeemedAmount": 20,
  "holdReference": null,
  "guest": false
}

Response

lineItem response object

Sample Response Body

{
    "playerUniqueId": "player456",
    "redeemedPoints": null,
    "rewardedPoints": 1000,
     "lineItems": [
        {
            "productId": "875511",
            "quantity": "1",
            "decimalPoints": 400.0,
            "points": 400,
            "score": 0
        },
        {
            "productId": "197765",
            "quantity": "2",
            "decimalPoints": 300.0,
            "points": 300,
            "score": 0
        }
    ]
}

Usage Example

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' \
       -H 'secretKey: klmb041b7d354259l3u4ft35e1q2r3703' --data-raw '{
  "playerUniqueId":"player456",   
  "orderId": "6253e03b",
  "orderDate":"2019-09-21T16:53:28.190Z",
  "totalPrice": "100",
  "totalPaid": "90",
  "totalDiscount": "0",
  "totalShipping": "0",
  "totalTax": "0", 
  "lineItems":[
    {
      "productId":"197765",
      "tag": ["VIP"],
      "quantity": 2,
      "category": [
        "natural",
        "cosmetics"
      ],
      "weight": "20",
      "vendor": "nike",
      "collection": ["14313", "4343"],
    },
    {
      "productId":"875511",
      "title": "XPS-15s",
      "category": [
        "electronics"
      ],
      "vendor": "Dell"
    }
  ]
  "discountCodes": [
      "AU7X-8Q7L",
      "BY3V-22GK"
  ],
  "extra": {
    "paymentMethod": "credit card",
    "billingAddress": "Alabama"
  },
  "redeemedAmount": 20,
  "holdReference": null,
  "guest": false
}' -v -i 'https://api.gameball.co/api/v3.0/integrations/order'

POST - Calculate Order Cashback

https://api.gameball.co/api/v3.0/integrations/order/cashback

This API is used to calculate the order cashback points to be rewarded based on your cashback config. It can be also used to show the cashback points to be rewarded for a single product by providing a single line item in the request.

mobile or email should be sent along with the playerUniqueId in case (only if) your account supports channel merging.

Request

Header

Body

lineItems Object

The (*) in the required column denotes that this value is required only if you wish to use the Custom Cashback configurations.

merchant object

Sample Request Body

{
   "playerUniqueId":"player456",
   "totalPaid":300,
   "totalPrice":180,
   "totalDiscount":30,
   "totalShipping":30,
   "totalTax":0,
   "lineItems":[
      {
         "productId":"875511",
         "price":150,
         "quantity":2,
         "collection":[
            "14313",
            "4343"
         ],
         "taxes":0,
         "discount":30
      }
   ]
}

Response

lineItem response object

Sample Response

{
    "totalPoints": 300,
    "totalScore": 0,
    "lineItems": [
        {
            "productId": "875511",
            "quantity": 2,
            "decimalPoints": 135.0,
            "points": 135,
            "score": 0
        },
        {
            "productId": "Shipping",
            "quantity": 1,
            "decimalPoints": 30.0,
            "points": 30,
            "score": 0
        }
    ]
}

Usage Example

curl --location --request POST 'https://api.gameball.co/api/v3.0/integrations/order/cashback' \
--header 'apiKey: 47369abf791640aaa3c319ce07a61727' \
--header 'Content-Type: application/json' \
--data-raw '{
    "playerUniqueId": "player456",
    "totalPaid": 300,
    "totalPrice": 180,
    "totalDiscount": 30,
    "totalShipping": 30,
    "totalTax": 0,
    "lineItems": [
        {
            "productId": "875511",
            "price": 150,
            "quantity": 2,
            "collection": [
                "14313",
                "4343"
            ],
            "taxes": 0,
            "discount": 30
        }
    ]
}