Send Purchase Event
POST  purchase
https://api.naqrat.sa/api/purchasePurchase API
This API endpoint allows you to send a purchase event order through the specified merchant when a customer completes the order process 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 (json)
{
    "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":"[email protected] (hash sha256)",
            "phone_hashed":"201123036886 (hash sha256)",
            "name":"Ahmed Saed",
         },
        "products":[
          {
              "id": 12789,
              "category": "فستان",
              "price": "127",
              "quantity": 4
          },
          {
               "id": 12547,
               "category": "فستان",
               "price": "80",
               "quantity": 2
           },
        ],
        "revenue": 209,
        "currencyCode": "SAR",
        "event_id": 54687642
    }
}
Example Request:
curl --location 'https://api.naqrat.sa/api/purchase' \
--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":"[email protected] (hash sha256)",
            "phone_hashed":"201123036886 (hash sha256)",
            "name":"Ahmed Saed",
         },
        "products":[
          {
              "id": 12789,
              "category": "فستان",
              "price": "127",
              "quantity": 4
          },
          {
               "id": 12547,
               "category": "فستان",
               "price": "80",
               "quantity": 2
           },
        ],
        "revenue": 209,
        "currencyCode": "SAR",
        "event_id": 54687642
    }
}'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
