πŸ”’ Privacy First: Customer phone numbers are protected using SHA-256 one-way encryption, so even we cannot read them. Other stores can only see whether a delivered order exists for that phone numberβ€”nothing else.

Overview

If your store doesn't run on Shopify or WooCommerce β€” for example, a custom-built website, an in-house order system, or any other platform β€” you can still integrate with FraudHawkAI using our custom order endpoint.

Unlike the Shopify and WooCommerce integrations, this endpoint does not mirror a third-party payload shape. A custom site has no standard order format for us to map from, so this endpoint defines its own simple JSON contract. You send your order data in this format, and FraudHawkAI handles the rest β€” risk analysis, customer matching, and order tracking β€” the same as it does for Shopify and WooCommerce orders.

How it works

  1. An order is created on your platform
  2. You format the order data to match the FraudHawkAI custom order schema
  3. You send it to the FraudHawkAI custom order endpoint with your API token
  4. FraudHawkAI matches or creates the customer record, saves the order, and analyzes it for risk
  5. If you send the same externalOrderId again (e.g. when order status changes), the existing order is updated instead of duplicated

Prerequisites

Before you begin, make sure you have:

  • A FraudHawkAI account β€” sign up here
  • Your API token β€” found in Dashboard β†’ API Key
  • The ability to send an HTTP POST request from your platform or backend (server-side, not client-side)

Endpoint

POST /api/webhooks/custom?token={your_api_token}

Query parameters

ParameterRequiredDescription
tokenYesYour FraudHawkAI API token. Requests without a valid token are rejected with 401 Unauthorized

Note: Unlike the Shopify and WooCommerce integrations, this endpoint does not take a platform query parameter. There's only one payload format for custom integrations β€” described below β€” so there's nothing to select between.


Request body

Send a JSON body matching the schema below.

{
  "externalOrderId": "ORD-1023",
  "orderNumber": "1023",
  "customer": {
    "name": "Ali Raza",
    "email": "ali@example.com",
    "phone": "03001234567"
  },
  "amount": 4500,
  "currency": "PKR",
  "paymentType": "cod",
  "status": "pending",
  "items": [
    { "name": "Product A", "sku": "SKU1", "quantity": 1, "price": 4500 }
  ],
  "shippingAddress": {
    "city": "Lahore",
    "address1": "House #123, Street 5",
    "phone": "03001234567"
  },
  "courier": "Leopards"
}

Field reference

FieldTypeRequiredDescription
externalOrderIdstringYesA unique identifier for this order in your system. Used to detect repeat requests for the same order β€” sending the same externalOrderId again updates the existing order instead of creating a duplicate
orderNumberstringNoA human-readable order number, shown in your FraudHawkAI dashboard. Defaults to externalOrderId if omitted
customerobjectYesThe customer object β€” see below
customer.namestringRecommendedCustomer's full name
customer.emailstringConditionalCustomer's email address. At least one of customer.email or customer.phone must be provided
customer.phonestringConditionalCustomer's phone number. At least one of customer.email or customer.phone must be provided. Stored as a hash β€” never in plain text
amountnumberYesThe total order value as a number (not a string). Example: 4500, not "4500.00"
currencystringNoThree-letter currency code. Defaults to PKR if omitted
paymentTypestringYesMust be exactly cod or prepaid. Any other value is rejected
statusstringNoOrder status. Defaults to pending if omitted or not one of the valid values listed below
itemsarrayNoList of products in the order. Optional, but recommended for more accurate risk analysis
items[].namestringYes, if items is sentProduct name
items[].skustringNoProduct SKU
items[].quantitynumberNoQuantity ordered. Defaults to 1 if omitted
items[].pricenumberNoPrice per unit. Defaults to 0 if omitted
shippingAddressobjectNoShipping address details. Structure is flexible (e.g. city, address1, phone)
courierstringNoName of the courier handling delivery (e.g. Leopards, TCS). Defaults to unknown if omitted

Important: customer.email and customer.phone are not individually mandatory, but at least one of the two is required β€” a request with neither is rejected. Providing customer.name alongside one of them is strongly recommended, since FraudHawkAI uses these fields to match and track customer order history across your store.

Valid status values

ValueMeaning
pendingOrder placed, not yet processed
processingOrder is being prepared
shippedOrder has been dispatched to the courier
deliveredOrder was successfully delivered
cancelledOrder was cancelled before dispatch
returnedOrder was delivered but later returned
rejectedOrder was refused at the doorstep (RTO)

Any value outside this list is ignored, and the order is saved with a status of pending.


How duplicate requests are handled

FraudHawkAI treats externalOrderId as the unique identifier for an order from your store. If you send a request with an externalOrderId that already exists:

  • The existing order is updated with the new data you sent (not duplicated)
  • If the status has changed since the last request, your customer's order counters (e.g. delivered count, returned count) are adjusted automatically
  • The response returns 200 OK with the message "Order updated"

If the externalOrderId is new, a new order is created and the response returns 201 Created with the message "Order saved".

This means it's safe β€” and expected β€” to call this endpoint again for the same order when its status changes, for example when it moves from pending to shipped, or from shipped to delivered.


Example request

curl -X POST "https://www.fraudhawkai.com/api/webhooks/custom?token=your_api_token" \
  -H "Content-Type: application/json" \
  -d '{
    "externalOrderId": "ORD-1023",
    "orderNumber": "1023",
    "customer": {
      "name": "Ali Raza",
      "email": "ali@example.com",
      "phone": "03001234567"
    },
    "amount": 4500,
    "currency": "PKR",
    "paymentType": "cod",
    "status": "pending",
    "items": [
      { "name": "Product A", "sku": "SKU1", "quantity": 1, "price": 4500 }
    ],
    "shippingAddress": {
      "city": "Lahore",
      "address1": "House #123, Street 5",
      "phone": "03001234567"
    },
    "courier": "Leopards"
  }'

Response format

Success β€” new order

{
  "success": true,
  "message": "Order saved",
  "orderId": "665f1c2e9b1f2a0012a3b456"
}

Status code: 201 Created

Success β€” existing order updated

{
  "success": true,
  "message": "Order updated",
  "orderId": "665f1c2e9b1f2a0012a3b456"
}

Status code: 200 OK

Error responses

StatusMessageCause
401Unauthorized. Please provide a token.The token query parameter is missing
401Invalid or expired tokenThe token doesn't match any account
400externalOrderId is requiredThe externalOrderId field is missing from the request body
400amount (number) is requiredThe amount field is missing or not a number
400paymentType must be 'cod' or 'prepaid'The paymentType field is missing or has an invalid value
400customer.email or customer.phone is requiredNeither customer.email nor customer.phone was provided
500Internal Server ErrorAn unexpected error occurred while processing the request

Testing your integration

  1. Send a test request using the curl example above with your own API token
  2. Confirm you receive a 201 response with "message": "Order saved"
  3. Log in to your FraudHawkAI dashboard to see the test order appear
  4. Send the same request again with the same externalOrderId and confirm you now get a 200 response with "message": "Order updated"
  5. Once confirmed, connect your live order flow to send real orders as they're created and updated