Get started
Quick start
Get a key, check it works, and send your first order. Use the test environment while you build.
1. Get your secret key
- Log in to the test dashboard and open Developers. (Only the account owner can see this page.)
- Under Secret keys, click Create key and give it a name, such as “Website”.
- Copy the key straight away. It starts with
sk_test_and is shown only once.
Keep secret keys on your server, for example in an environment variable called SELLIGATE_SECRET_KEY. Never put them in a website, mobile app or public repository.
2. Check the key works
Call GET /me. You should see your business name and "environment": "test".
curl https://staging-api.selligate.com/api/v1/me \
-H "Authorization: Bearer $SELLIGATE_SECRET_KEY"const res = await fetch("https://staging-api.selligate.com/api/v1/me", {
headers: { Authorization: `Bearer ${process.env.SELLIGATE_SECRET_KEY}` },
});
console.log(await res.json());<?php
$ch = curl_init("https://staging-api.selligate.com/api/v1/me");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("SELLIGATE_SECRET_KEY")],
]);
print_r(json_decode(curl_exec($ch), true));import os
import requests
res = requests.get(
"https://staging-api.selligate.com/api/v1/me",
headers={"Authorization": f"Bearer {os.environ['SELLIGATE_SECRET_KEY']}"},
)
print(res.json())3. Find your product codes
Every item in an order is identified by its product_code. GET /products lists your products, their codes and how many units agents hold in each state.
curl https://staging-api.selligate.com/api/v1/products \
-H "Authorization: Bearer $SELLIGATE_SECRET_KEY"4. Send an order
Send the customer’s details and the items. Use your own order number as external_id: if the request is ever repeated, you get the same order back rather than a duplicate.
curl https://staging-api.selligate.com/api/v1/orders \
-H "Authorization: Bearer $SELLIGATE_SECRET_KEY" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"external_id": "SHOP-1001",
"customer": {
"name": "Amaka Obi",
"phone": "08031234567",
"address": "12 Admiralty Way, Lekki Phase 1",
"state": "Lagos"
},
"items": [{ "product_code": "SG-SERUM-30", "quantity": 2 }]
}'const res = await fetch("https://staging-api.selligate.com/api/v1/orders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SELLIGATE_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
external_id: "SHOP-1001",
customer: {
name: "Amaka Obi",
phone: "08031234567",
address: "12 Admiralty Way, Lekki Phase 1",
state: "Lagos",
},
items: [{ product_code: "SG-SERUM-30", quantity: 2 }],
}),
});
const { data: order } = await res.json();
console.log(order.id, order.status, order.agent);<?php
$ch = curl_init("https://staging-api.selligate.com/api/v1/orders");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SELLIGATE_SECRET_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
'external_id' => 'SHOP-1001',
'customer' => [
'name' => 'Amaka Obi',
'phone' => '08031234567',
'address' => '12 Admiralty Way, Lekki Phase 1',
'state' => 'Lagos',
],
'items' => [['product_code' => 'SG-SERUM-30', 'quantity' => 2]],
]),
]);
$order = json_decode(curl_exec($ch), true)['data'];import os
import requests
res = requests.post(
"https://staging-api.selligate.com/api/v1/orders",
headers={"Authorization": f"Bearer {os.environ['SELLIGATE_SECRET_KEY']}"},
json={
"external_id": "SHOP-1001",
"customer": {
"name": "Amaka Obi",
"phone": "08031234567",
"address": "12 Admiralty Way, Lekki Phase 1",
"state": "Lagos",
},
"items": [{"product_code": "SG-SERUM-30", "quantity": 2}],
},
)
order = res.json()["data"]The response is the new order, already assigned to an agent:
{
"success": true,
"message": "Order created and assigned to an agent.",
"data": {
"id": 482913,
"order_no": "ORD583014",
"external_id": "SHOP-1001",
"status": "assigned",
"amount_to_collect": 30000,
"agent": { "name": "Lekki Hub" },
...
}
}Save the id alongside your own order. If no agent in that state has every item, you get 422 NO_COVERAGE instead; see Errors.
5. Get told when it’s delivered
- Build an endpoint on your server to receive webhooks, for example
https://yourshop.com/selligate/webhook. - On the Developers page, under Webhooks, submit it as your Webhook URL and save.
- Copy the signing secret (starts with
whsec_) into your server’s settings. - Click Send test webhook and check your endpoint answers with a
2xx.
From then on, Selligate posts to that URL each time an order changes status. Read how webhooks work and how to check they really came from us.
Next steps
- Order lifecycle: what each status means.
- Orders API: list, fetch and cancel orders.
- Go-live checklist: switching to your live key.