Send AddToCart Event

POST AddToCart

https://api.naqrat.sa/api/addtocart

AddToCart API

This API endpoint allows you to send a AddToCart event through the specified merchant when a customer adds any product to his cart on your site.

Request Body

  • merchant (Number): The ID of the merchant.

  • created_at (String): The timestamp of the purchase creation.

  • cookiesocial (Object): Contains social media tracking parameters.

    • scid (String): Social media campaign ID.

    • fbp (String): Facebook Pixel ID.

    • fbc (String): Facebook Click ID.

    • ttclid (String): Twitter Click ID.

    • ttp (String): TikTok Pixel ID.

    • ga (String): Google Analytics ID.

    • twclid (String): Twitter Click ID.

  • data (Object): Contains customer, ecommerce, and page data.

    • customer (Object): Information about the customer.

      • phone (Number): Customer's phone number.

      • email_hashed (String): Hashed customer email.

      • phone_hashed (String): Hashed customer phone number.

      • name (String): Customer's name.

    • products (Array): Ecommerce event and purchase details.

      • id (Number): Product ID.

      • category (String): Product category.

      • price (String): Product price.

      • quantity (Number): Quantity of the product.

    • currencyCode (Object): Information about the page.

    • event_id (Number): Unique event ID.

Response

  • status (String): Status of the purchase.

  • message (String): Additional message related to the purchase.

  • products_count (Number): Number of products in the purchase.

  • created_at (String): Timestamp of the purchase response creation.

AUTHORIZATION Bearer Token


Token <token>

HEADERS


Accept application/json


Body

{
    "merchant": 1539686597,
    "created_at":"2023-12-21 12:09:49",
    "cookiesocial":{
        "scid":"test pxil",
        "fbp":"facebook pxil",
        "fbc":"facebook pxil",
        "ttclid":"facebook pxil",
        "ttp":"facebook pxil",
        "ga":"facebook pxil",
        "twclid":"facebook pxil"
    },
    "data":{
        "customer":{
            "phone":201123036886,
            "email_hashed":"as@gmail.com (hash sha256)",
            "phone_hashed":"201123036886 (hash sha256)",
            "name":"Ahmed Saed",
         },
        "products":[
          {
              "id": 12789,
              "category": "فستان",
              "price": "127",
              "quantity": 4
          }
        ],
        "total_price": 127,
        "currencyCode": "SAR",
        "event_id": 662fa119
    }
}

Example Request:

curl --location 'https://api.naqrat.sa/api/addtocart' \
--header 'Accept: application/json' \
--data-raw '{
    "merchant": 1539686597,
    "created_at":"2023-12-21 12:09:49",
    "cookiesocial":{
        "scid":"test pxil",
        "fbp":"facebook pxil",
        "fbc":"facebook pxil",
        "ttclid":"facebook pxil",
        "ttp":"facebook pxil",
        "ga":"facebook pxil",
        "twclid":"facebook pxil"
    },
    "data":{
        "customer":{
            "phone":201123036886,
            "email_hashed":"as@gmail.com (hash sha256)",
            "phone_hashed":"201123036886 (hash sha256)",
            "name":"Ahmed Saed",
         },
        "products":[
          {
              "id": 12789,
              "category": "فستان",
              "price": "127",
              "quantity": 4
          }
        ],
        "total_price": 127,
        "currencyCode": "SAR",
        "event_id": 662fa119
    }
}'

Response


Upon successful execution, the API will return a status 200 with the following response:

{
    "data": {
        "status": "",
        "message": "",
        "products_count": 0,
        "created_at": ""
    }
}

Last updated