Skip to content

Body2Fit Order Confirmation

The Body2Fit Order Confirmation API can be used by your application to send information about a confirmed product order to Body2Fit. This data allows Body2Fit to track the impact of it size recommendations on your customers' purchasing decisions.

By integrating this API and submitting order confirmation data, you contribute to the continuous improvement of the Body2Fit size recommendation system, ultimately enhancing the shopping experience for your customers.

API

The following diagram illustrates how the Body2Fit API fits into a typical e-commerce workflow:

order confirmation sequence diagram

This diagram represents a typical integration of the Body2Fit API into an e-commerce workflow. It's important to note that this exact flow may vary depending on the specific implementation of different e-commerce sites. However, the key points remain consistent:

  1. The clientSessionId is generated by your e-commerce site before the order confirmation, and used throughout the process.
  2. The Body2Fit Widget is initiated using this clientSessionId along with the product SKU. (See the integration guide for the Widget).
  3. When an order is confirmed, the same clientSessionId and SKU are included in the order confirmation request to the Body2Fit Order Confirmation API.

While the specifics of how a site integrates Body2Fit may be different, the essential flow of information - from initial product viewing to final purchase confirmation - should remain consistent to ensure the best functionality of the Body2Fit service.

Base URL

All API requests should be sent to: https://fitfinder.body2fit.bodygram.com/v2

POST /order-confirmation

Create an order confirmation in the Body2Fit system. Call this endpoint on your order confirmation page after an order is successfully placed.

Request Format

Content-Type: application/json

Request Parameters

The request body should be a JSON object containing the following properties:

Property Required Type Description Example
clientKey ☑️ string Unique client key provided by Bodygram. "abc123def456”
clientSessionId ☑️ string Client session ID you provided on the product page. Must match the clientSessionId used there. "session_12345"
orderId ☑️ string Unique order ID created by your shop. "order_9876"
items ☑️ array An array of item objects. See “Item Object” below for details. [{...}, {...}]
createdAt ☑️ number Timestamp of the order creation in milliseconds since epoch (UTC). 1726642845768
currency ☑️ string Three-letter ISO currency code used for the order. See: https://en.wikipedia.org/wiki/ISO_4217 "USD"
countryCode ☑️ string The ISO 3166-1 Alpha-2 code of the country your store is in. "JP"
languageCode ☑️ string The ISO 639-1 code of the language in which widget instructions should be provided. "en"

Item Object

Each item in the items array should be an object with the following properties:

Property Required Type Description Example
sku ☑️ string Product Stock Keeping Unit (SKU). “E123000”
brand ☑️ string Brand name of the product. "BRAND123"
size ☑️ string Size of the product as selected by the customer. "M"
price ☑️ number Unit price of the product in the specified currency. 19.99
quantity ☑️ number Number of items of this SKU & size purchased. 2

Example Request Body

{
  "clientKey": "abc123def456",
  "clientSessionId": "session_12345",
  "orderId": "order_9876",
  "items": [
    {
      "sku": "E123000",
      "brand": "BRAND123",
      "size": "M",
      "price": 29.99,
      "quantity": 2
    },
    {
      "sku": "E123003",
      "brand": "BRAND123",
      "size": "L",
      "price": 49.99,
      "quantity": 1
    }
  ],
  "createdAt": 1726642845768,
  "currency": "USD",
  "countryCode": "JP",
  "languageCode": "en"
}

Successful Response

When an order confirmation is successfully processed by Body2Fit, you will receive a response with a HTTP status code of 200 OK. The response body will be a JSON object containing the status of the processed order confirmation.

{
  "status": "success",
 }

Failed Response

When an order confirmation is unsuccessfully processed by Body2Fit, you will a receive a response with a HTTP status code of 4xx or 5xx. The response body will be a JSON object containing the status and an error object.

{
    "status": "error",
    "error": {
        "message": "A brief description of the error",  
    }
}

The API is designed to return without error in most situations. Error responses are provided solely for debugging purposes and should not be used to trigger user-facing actions or displays.

Key points when handling errors:

  1. Errors should be invisible to your end-users.
  2. Do not display errors or change UI based on them.
  3. If you log errors, they should be used for your internal debugging only.
  4. Your application should continue normal operation after an error.

If there are persistent errors when calling the /order-confirmation endpoint, please: Review logs, check your integration, then contact support@bodygram.com if needed.