Resources

API Documentation

The Marketplace API is for approved sellers who run their own license system. It lets your system check a buyer's purchase code and be told at once when an order is paid or refunded. Buyers and traders do not need it.

Overview

Every marketplace order has a purchase code such as AIO-7KQ2-M9XD-P4TC. The buyer sees it on the order page and in the order e-mail. You can use it in two ways, alone or together:

  • Verify (pull): the buyer enters the code in your product or on your website; your system asks our API whether it is valid.
  • Webhooks (push): we send your server a signed message when an order is paid or refunded.

Base URL: https://all-n-one-trading-ecosystem.com/market_api.php. All answers are JSON.

Your API key

Create your key in Seller center → License system. It starts with aio_sk_ and is shown once; we keep only a hash of it. Creating a new key replaces the old one.

Send the key in a header with every request:

Authorization: Bearer aio_sk_your_key_here

X-Api-Key: aio_sk_... is accepted as well. Keep the key on your server; never put it inside an EA or an app that customers download.

Test your key

GET /market_api.php?action=ping

Answers your store name when the key is valid:

{
    "ok": true,
    "store": "Your Store",
    "seller_id": 12,
    "time": "2026-11-22T10:15:00Z"
}

Verify a purchase code

GET /market_api.php?action=verify&code=AIO-7KQ2-M9XD-P4TC

Spaces, missing dashes and lower case in the code are forgiven. Example with curl:

curl -H "Authorization: Bearer aio_sk_your_key_here" \
  "https://all-n-one-trading-ecosystem.com/market_api.php?action=verify&code=AIO-7KQ2-M9XD-P4TC"

Answer for an order of your store:

{
    "ok": true,
    "purchase_code": "AIO-7KQ2-M9XD-P4TC",
    "valid": true,
    "status": "active",
    "order_id": 1042,
    "product": { "id": 31, "name": "Your Product", "sku": "YOURSKU" },
    "plan": { "label": "1 month", "months": 1, "lifetime": false },
    "amount": 49,
    "currency": "USD",
    "purchased_at": "2026-11-20T09:30:00Z",
    "expires_at": "2026-12-20T09:30:00Z",
    "refunded_at": null,
    "buyer": { "name": "Buyer Name", "email": "buyer@example.com", "country": "United Kingdom" }
}
FieldMeaning
validtrue while the purchase is active: not refunded and not expired. Give access only when it is true.
statusactive, expired or refunded.
plan.lifetimetrue for a one-time purchase without an end; expires_at is then null.
expires_atEnd of the paid period (UTC). Renewals move it forward.
buyerThe buyer's name, e-mail and country, for your records. Use them only to deliver and support the purchase.

You only see orders of your own store: a code that belongs to another seller answers not_found.

Test code

The code AIO-TEST-TEST-TEST always answers a sample purchase of your first product, marked "test": true. Use it to build and test your integration without a real order.

Errors and limits

HTTPerrorMeaning
400bad_codeThe text is not a purchase code.
400unknown_actionUse action=verify or action=ping.
401missing_key / invalid_keyNo key was sent, or the key was replaced or is wrong.
404not_foundNo order of your store has this code.
429rate_limitedMore than 60 requests a minute with one key.

Every error has "ok": false and a readable message. Check a code when the buyer activates and then at a sensible interval (for example once a day), not on every start of your product.

Webhooks

Enter a webhook URL (https) in Seller center → License system. We then send a POST with a JSON body for these events:

eventWhen
order.paidA buyer's payment for your product is confirmed.
order.refundedAn order was refunded: remove the access.
testYou clicked "Send a test event" in the seller center.
{
    "event": "order.paid",
    "created_at": "2026-11-20T09:30:02Z",
    "data": { ...the same fields as the verify answer... }
}

Check the signature

Each request has two headers: X-AIO-Timestamp and X-AIO-Signature: sha256=.... The signature is the HMAC-SHA256 of timestamp + "." + raw body with your webhook secret. Reject a request whose signature does not match.

<?php
$secret = "your webhook secret";
$body   = file_get_contents("php://input");
$ts     = $_SERVER["HTTP_X_AIO_TIMESTAMP"] ?? "";
$sig    = $_SERVER["HTTP_X_AIO_SIGNATURE"] ?? "";
$expect = "sha256=" . hash_hmac("sha256", $ts . "." . $body, $secret);
if (!hash_equals($expect, $sig)) { http_response_code(401); exit; }
$event = json_decode($body, true);
// $event["event"], $event["data"]["purchase_code"], ...
http_response_code(200);

Answer with HTTP 2xx within a few seconds. If your server does not answer, we try again after 5 minutes, 30 minutes, 2 hours, 6 hours and 24 hours. The same event can arrive more than once, so make your handler safe to repeat.

Help

The seller guide shows where these settings are, and how selling works in general. Questions about your integration: open a ticket. Not a seller yet? Open your store.