Integration
Use this endpoint to create purchases from your store and receive the final result through a webhook.
https://bs.hydracidx.com/api/purchase/Send every purchase request to this route. It is the only purchase entry point for the API.
Authorization: Token YOUR_STATIC_URL_TOKENThe purchase body contains four required fields and one optional language field.
Your own unique reference for the order in your system.
409 and duplicate_reference_id.The public product identifier shown in the API Products section.
The amount of units you want to buy for the selected product.
HTTPS endpoint in your system that receives the final purchase result.
400 before the purchase starts or the reference is reserved.purchase_id (or reference_id) and make each identical delivery idempotent. Selects the language only for the optional indications field in a successful or partial webhook.
indications is not included for every product; it is omitted when no additional instructions are available.lang does not translate statuses, details, product data, prices, quantities, keys, or any other webhook field.en English, de German, es Spanish, pt Portuguese, zh Chinese, ru Russian, fr French, ar Arabic, hi Hindi, it Italian, ko Korean, id Indonesian, tr Turkish, vi Vietnamese, and pl Polish. A new, pending, or resumed purchase returns HTTP 202. An identical replay of a terminal result returns HTTP 200. Both responses include the purchase and reference IDs, current status, and processing_queue_status.
queued: purchase processing was queued normally.processed: an identical repeated request returned the already completed result without processing it again.manual_retry_required: the purchase was saved but processing did not start. Do not submit a second purchase; HydraCID X support receives a protected recovery alert. Use the dedicated test product ID below to validate your webhook integration safely.
d0d15b8b-01bb-4d88-97a2-ab6716d86404curl --request POST \
--url "https://hydracidx.com/api/purchase/" \
--header "Authorization: Token YOUR_STATIC_URL_TOKEN" \
--header "Content-Type: application/json" \
--data '{"reference_id":"WEBHOOK_TEST_001","product_id":"d0d15b8b-01bb-4d88-97a2-ab6716d86404","qty":1,"lang":"es","webhook_url":"https://store.example.com/api/hydracidx/webhook"}'This is the payload we will send to your server through your configured webhook URL.
{
"status": "success",
"purchase_id": 152,
"reference_id": "ORDER_100045",
"product_id": "8d4cde52-7df0-4704-852f-0ef08b4b8ed7",
"product_name": "Windows 11 Pro Retail",
"qty_requested": 3,
"qty_processed": 3,
"unit_reseller_price": "4.50",
"total_reseller_price": "13.50",
"keys": [
"XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
],
"indications": "<b>Instalación:</b> Sigue las instrucciones proporcionadas para este producto.",
"detail": "",
"acts_remaining": 24,
"warranty_days": 30
}Recommended security
HydraCID X signs outgoing webhooks so your server can confirm that the request is authentic and that the JSON body was not changed in transit.
| Header | Value |
|---|---|
X-Hydra-Timestamp | Unix timestamp in seconds generated for that delivery attempt. |
X-Hydra-Signature-256 | sha256=<lowercase hexadecimal digest> |
<timestamp>.<raw_body>, with the exact timestamp header, one ASCII period, and the exact body bytes.sha256=<hex digest>.purchase_id or reference_id.signed_value = X-Hydra-Timestamp + "." + raw_request_bodysignature = "sha256=" + HMAC_SHA256(api_token, signed_value).hex()import hashlib
import hmac
import os
import time
from flask import abort, request
secret = os.environ['HYDRACIDX_API_TOKEN'].encode('utf-8')
raw_body = request.get_data(cache=True)
timestamp = request.headers.get('X-Hydra-Timestamp', '')
provided = request.headers.get('X-Hydra-Signature-256', '')
try:
if abs(int(time.time()) - int(timestamp)) > 300:
abort(401)
except ValueError:
abort(401)
signed_payload = timestamp.encode('ascii') + b'.' + raw_body
expected = 'sha256=' + hmac.new(secret, signed_payload, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, provided):
abort(401)
payload = request.get_json()
# Process purchase_id idempotently, then return HTTP 2xx.pending: purchase created and still processing.success: purchase completed successfully.failed: purchase rejected or no stock was available.partial: only part of the requested quantity could be delivered.acts_remaining is only returned for online MAK or LTSC products.warranty_days is returned only if warranty applies.download_url is returned if product needs a downloadable resource.indications is an optional HTML string with additional instructions for the delivered product. The field is omitted when no additional instructions are available. When present, it uses the language requested through lang, with English as the fallback.