https://keyses.shop/api/v1
X-API-Key
USD
500
1
2
3
4
curl https://keyses.shop/api/v1/balance -H "X-API-Key: ks_your_key"| catalog | 30 | GET /products |
| orders | 20 | POST /orders |
| read | 120 |
GET/balance
{"success": true, "balance": 42.5, "currency": "USD"}GET/products
{"success": true, "products": [{
"id": 132, "name": "ChatGPT Plus 1M",
"price": 7.75, "retail_price": 7.99,
"price_tiers": [{"min_qty": 5, "price": 7.60}, {"min_qty": 10, "price": 7.20}],
"stock": 24, "requires_email": false, "api_test": false }]}POST/orders
product_id | int | |
quantity | int | |
email | string | |
Idempotency-Key | header |
curl -X POST https://keyses.shop/api/v1/orders -H "X-API-Key: ks_your_key" \
-H "Idempotency-Key: order-1001" -H "Content-Type: application/json" \
-d '{"product_id": 132, "quantity": 1}'
{"success": true, "order": {"id": 1001, "status": "delivered", "product_id": 132, "quantity": 1,
"amount": 7.75, "items": ["login:pass ..."], "idempotency_key": "order-1001", "created_at": 1760000000}}
GET/orders/{id}
GET/orders?limit=20
GET/orders/lookup?idempotency_key=order-1001
POST/webhook {"url": "https://your-site.com/hook"}
# header X-KeyseS-Signature = HMAC-SHA256(secret, X-KeyseS-Timestamp + "." + body)
import hmac, hashlib
def valid(secret, ts, body: bytes, sig):
calc = hmac.new(secret.encode(), ts.encode() + b"." + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(calc, sig)| 400 | |
| 401 | |
| 402 | |
| 403 | |
| 409 | |
| 429 |
{"success": false, "error": "balance"}import requests, uuid
B = "https://keyses.shop/api/v1"
H = {"X-API-Key": "ks_your_key"}
products = requests.get(B + "/products", headers=H).json()["products"]
p = next(x for x in products if x["api_test"]) # the $0.01 test product
r = requests.post(B + "/orders", json={"product_id": p["id"], "quantity": 1},
headers={**H, "Idempotency-Key": str(uuid.uuid4())}, timeout=60)
order = r.json()["order"]
print(order["status"], order["items"])
const B = "https://keyses.shop/api/v1";
const H = { "X-API-Key": "ks_your_key", "Content-Type": "application/json" };
const { products } = await fetch(B + "/products", { headers: H }).then(r => r.json());
const p = products.find(x => x.api_test);
const { order } = await fetch(B + "/orders", {
method: "POST",
headers: { ...H, "Idempotency-Key": crypto.randomUUID() },
body: JSON.stringify({ product_id: p.id, quantity: 1 })
}).then(r => r.json());
console.log(order.status, order.items);
from telegram.ext import ApplicationBuilder, CommandHandler
import requests, uuid
B, H = "https://keyses.shop/api/v1", {"X-API-Key": "ks_your_key"}
async def buy(update, context): # /buy 132
r = requests.post(B + "/orders", headers={**H, "Idempotency-Key": str(uuid.uuid4())},
json={"product_id": int(context.args[0]), "quantity": 1}).json()
if not r.get("success"):
return await update.message.reply_text("❌ " + r["error"])
o = r["order"]
await update.message.reply_text("✅ Order #%s\n\n%s" % (o["id"], "\n".join(o["items"]) or "⏳ processing"))
app = ApplicationBuilder().token("BOT_TOKEN").build()
app.add_handler(CommandHandler("buy", buy))
app.run_polling()