Affilibee
Toggle sidebar

Order Submission API

Welcome to the Order Submission API documentation. This API allows you to submit orders for processing. Below, you'll find details on how to authenticate, the expected payload structure, and an example request to help you get started. The value of any price should be in the smallest unit (e.g., cents for USD). If you sell in multiple currencies, please convert the currencies and ensure that the prices match the currency registered for your merchant account before submitting the order.

Authentication

This API uses Bearer Token authentication. To access the endpoints, include the token in the Authorization header of your requests:

Authorization: Bearer <your_token>

Endpoint

POST /api/orders/create

Request Body

The API expects a JSON payload with the following structure:

Root Fields

  • affiliate_slug (string, required): The unique identifier for the affiliate.
  • order_no (string, required): The unique order number.
  • total_shipping_value (integer, required): The total value of shipping costs, represented in the smallest currency unit.
  • currency_code (string, required): The 3-character currency code (e.g., USD, EUR).

Order Rows

Each order contains an array of order_rows with the following fields:

  • product_sku (string, optional): The SKU of the product.
  • product_name (string, required): The name of the product.
  • segment_slug (string, optional): The identifier for the product segment. Falls back to default segment if none is provided.
  • price_value (integer, required): The price of the product, represented in the smallest currency unit.
  • tax_value (integer, optional): The tax applied to the product, represented in the smallest currency unit.
  • quantity (integer, required): The quantity of the product.

Customer

The customer object can include:

  • name (string, optional): The full name of the customer.
  • email (string, optional): The email address of the customer.

Example Requests

curl -X POST https://affilibee.com/api/orders/create \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
  "affiliate_slug": "affiliate123",
  "order_no": "ORDER-001",
  "total_shipping_value": 1500,
  "currency_code": "USD",
  "order_rows": [
    {
      "product_sku": "SKU123",
      "product_name": "Product Name A",
      "segment_slug": "segment-001",
      "price_value": 10000,
      "tax_value": 500,
      "quantity": 2
    }
  ],
  "customer": {
    "name": "John Doe",
    "email": "john.doe@example.com"
  }
}'
const token = "YOUR_ACCESS_TOKEN";
const url = "https://affilibee.com/api/orders/create";

const payload = {
  affiliate_slug: "affiliate123",
  order_no: "ORDER-001",
  total_shipping_value: 1500,
  currency_code: "USD",
  order_rows: [
    {
      product_sku: "SKU123",
      product_name: "Product Name A",
      segment_slug: "segment-001",
      price_value: 10000,
      tax_value: 500,
      quantity: 2
    }
  ],
  customer: {
    name: "John Doe",
    email: "john.doe@example.com"
  }
};

fetch(url, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${token}`,
    "Content-Type": "application/json",
    "Accept": "application/json"
  },
  body: JSON.stringify(payload)
})
  .then(response => response.json())
  .then(data => console.log("Success:", data))
  .catch(error => console.error("Error:", error));
<?php

require 'vendor/autoload.php';

use GuzzleHttp\Client;

$token = 'YOUR_ACCESS_TOKEN';

$client = new Client([
    'base_uri' => 'https://affilibee.com',
    'headers' => [
        'Authorization' => "Bearer $token",
        'Content-Type'  => 'application/json',
        'Accept'        => 'application/json',
    ],
]);

$payload = [
    'affiliate_slug' => 'affiliate123',
    'order_no' => 'ORDER-001',
    'total_shipping_value' => 1500,
    'currency_code' => 'USD',
    'order_rows' => [
        [
            'product_sku' => 'SKU123',
            'product_name' => 'Product Name A',
            'segment_slug' => 'segment-001',
            'price_value' => 10000,
            'tax_value' => 500,
            'quantity' => 2,
        ]
    ],
    'customer' => [
        'name' => 'John Doe',
        'email' => 'john.doe@example.com',
    ],
];

$response = $client->post('/api/orders/create', [
    'body' => json_encode($payload),
]);

echo $response->getBody();
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        using var client = new HttpClient();
        var url = "https://affilibee.com/api/orders/create";
        var token = "YOUR_ACCESS_TOKEN";

        var payload = new
        {
            affiliate_slug = "affiliate123",
            order_no = "ORDER-001",
            total_shipping_value = 1500,
            currency_code = "USD",
            order_rows = new[]
            {
                new {
                    product_sku = "SKU123",
                    product_name = "Product Name A",
                    segment_slug = "segment-001",
                    price_value = 10000,
                    tax_value = 500,
                    quantity = 2
                }
            },
            customer = new {
                name = "John Doe",
                email = "john.doe@example.com"
            }
        };

        var json = System.Text.Json.JsonSerializer.Serialize(payload);
        var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

        client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", $"Bearer {token}");
        client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

        var response = await client.PostAsync(url, content);
        var responseString = await response.Content.ReadAsStringAsync();

        Console.WriteLine(responseString);
    }
}

Response — 201 Created

{
    "success": true,
    "message": "Order submitted successfully.",
    "data": {
        "uuid": "unique-order-uuid",
        "order_no": "your-order-number"
    }
}

Response — 422 Unprocessable Content

{
    "success": false,
    "message": "Validation failed.",
    "data": {
        "errors": {
            "order_no": [
                "The order no has already been taken."
            ],
            "affiliate_slug": [
                "The affiliate_slug field is required."
            ]
        }
    }
}

Got questions? We're here for you.

We help e-commerce brands grow through simple and effective affiliate programs.

© 2025 Affilibee Handelsbolag (969802-2481)

Integrations

Affilibee API
How can we assist you today?

Fill in the form below and we'll get back to you as soon as possible.

Name
Email
Message