API Reference
Everything you need to integrate Zyrix. Every endpoint, with copy-paste examples in five languages
https://api.zyrix.coAuthentication
/api/auth/request-otpPublicRequest a one-time password for merchant authentication.
{
"email": "merchant@example.com"
}{
"request_id": "req_8f2a1c",
"expires_in": 300
}curl -X POST https://api.zyrix.co/api/auth/request-otp \
-H "Content-Type: application/json" \
-d '{
"email": "merchant@example.com"
}'/api/auth/verify-otpPublicVerify the OTP and receive an access token.
{
"request_id": "req_8f2a1c",
"otp": "482913"
}{
"token": "eyJhbGci...",
"merchant_id": "mer_1a2b3c"
}curl -X POST https://api.zyrix.co/api/auth/verify-otp \
-H "Content-Type: application/json" \
-d '{
"request_id": "req_8f2a1c",
"otp": "482913"
}'Payments
/api/payments/create🔒 Auth requiredCreate a payment. Zyrix routes it to the optimal provider via AI.
{
"amount": 10000,
"currency": "SAR",
"routing": "smart",
"payment_method": {
"type": "card",
"card": {
"number": "4111111111111111",
"exp_month": 12,
"exp_year": 2027,
"cvc": "123"
}
},
"customer": {
"email": "ahmed@example.com",
"name": "Ahmed Al-Farsi",
"phone": "+966501234567"
},
"metadata": {
"order_id": "ORD-12345"
}
}{
"id": "pay_1a2b3c4d5e6f",
"status": "succeeded",
"amount": 10000,
"currency": "SAR",
"provider": "hyperpay",
"routing_decision": {
"strategy": "smart",
"reason": "Highest approval rate for SA Visa cards",
"alternatives_considered": [
"stripe",
"paytabs"
],
"latency_ms": 145
},
"risk_score": 12,
"created_at": "2026-03-25T10:30:00Z"
}curl -X POST https://api.zyrix.co/api/payments/create \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"amount": 10000,
"currency": "SAR",
"routing": "smart",
"payment_method": {
"type": "card",
"card": {
"number": "4111111111111111",
"exp_month": 12,
"exp_year": 2027,
"cvc": "123"
}
},
"customer": {
"email": "ahmed@example.com",
"name": "Ahmed Al-Farsi",
"phone": "+966501234567"
},
"metadata": {
"order_id": "ORD-12345"
}
}'/api/payments/:id🔒 Auth requiredRetrieve a single payment by its ID.
{
"id": "pay_1a2b3c4d5e6f",
"status": "succeeded",
"amount": 10000,
"currency": "SAR",
"provider": "hyperpay",
"created_at": "2026-03-25T10:30:00Z"
}curl -X GET https://api.zyrix.co/api/payments/:id \
-H "Authorization: Bearer sk_live_xxxxx"/api/payments/list🔒 Auth requiredList payments with pagination and optional filters.
{
"data": [
{
"id": "pay_1a2b3c4d5e6f",
"status": "succeeded",
"amount": 10000,
"currency": "SAR"
}
],
"has_more": false,
"total": 1
}curl -X GET https://api.zyrix.co/api/payments/list \
-H "Authorization: Bearer sk_live_xxxxx"/api/payments/:id/capture🔒 Auth requiredCapture a previously authorized payment.
{
"amount": 10000
}{
"id": "pay_1a2b3c4d5e6f",
"status": "captured",
"amount": 10000
}curl -X POST https://api.zyrix.co/api/payments/:id/capture \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"amount": 10000
}'/api/payments/:id/void🔒 Auth requiredVoid an authorized payment before capture.
{
"id": "pay_1a2b3c4d5e6f",
"status": "voided"
}curl -X POST https://api.zyrix.co/api/payments/:id/void \
-H "Authorization: Bearer sk_live_xxxxx"/api/payments/:id/refund🔒 Auth requiredRefund a captured payment, fully or partially.
{
"amount": 5000,
"reason": "requested_by_customer"
}{
"id": "pay_1a2b3c4d5e6f",
"status": "refunded",
"refund_id": "ref_9z8y7x",
"amount": 5000
}curl -X POST https://api.zyrix.co/api/payments/:id/refund \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"reason": "requested_by_customer"
}'Payment Links
/api/payment-links🔒 Auth requiredCreate a shareable payment link.
{
"amount": 25000,
"currency": "SAR",
"description": "Invoice #1024",
"expires_at": "2026-04-01T00:00:00Z"
}{
"id": "lnk_3c4d5e",
"url": "https://pay.zyrix.co/l/3c4d5e",
"status": "active",
"amount": 25000,
"currency": "SAR"
}curl -X POST https://api.zyrix.co/api/payment-links \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"amount": 25000,
"currency": "SAR",
"description": "Invoice #1024",
"expires_at": "2026-04-01T00:00:00Z"
}'/api/payment-links🔒 Auth requiredList all payment links.
{
"data": [
{
"id": "lnk_3c4d5e",
"url": "https://pay.zyrix.co/l/3c4d5e",
"status": "active"
}
],
"has_more": false
}curl -X GET https://api.zyrix.co/api/payment-links \
-H "Authorization: Bearer sk_live_xxxxx"/api/payment-links/:id🔒 Auth requiredRetrieve a single payment link.
{
"id": "lnk_3c4d5e",
"url": "https://pay.zyrix.co/l/3c4d5e",
"status": "active",
"amount": 25000,
"currency": "SAR",
"created_at": "2026-03-25T10:30:00Z"
}curl -X GET https://api.zyrix.co/api/payment-links/:id \
-H "Authorization: Bearer sk_live_xxxxx"/api/payment-links/:id/cancel🔒 Auth requiredCancel an active payment link.
{
"id": "lnk_3c4d5e",
"status": "cancelled"
}curl -X PUT https://api.zyrix.co/api/payment-links/:id/cancel \
-H "Authorization: Bearer sk_live_xxxxx"Subscriptions
/api/subscriptions🔒 Auth requiredCreate a recurring subscription for a customer.
{
"customer_id": "cus_1a2b3c",
"plan": "pro_monthly",
"amount": 9900,
"currency": "SAR",
"interval": "month"
}{
"id": "sub_7h8i9j",
"status": "active",
"next_billing": "2026-04-25"
}curl -X POST https://api.zyrix.co/api/subscriptions \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"customer_id": "cus_1a2b3c",
"plan": "pro_monthly",
"amount": 9900,
"currency": "SAR",
"interval": "month"
}'/api/subscriptions🔒 Auth requiredList all subscriptions.
{
"data": [
{
"id": "sub_7h8i9j",
"status": "active",
"next_billing": "2026-04-25"
}
],
"has_more": false
}curl -X GET https://api.zyrix.co/api/subscriptions \
-H "Authorization: Bearer sk_live_xxxxx"/api/subscriptions/:id/pause🔒 Auth requiredPause an active subscription.
{
"id": "sub_7h8i9j",
"status": "paused"
}curl -X PUT https://api.zyrix.co/api/subscriptions/:id/pause \
-H "Authorization: Bearer sk_live_xxxxx"/api/subscriptions/:id/resume🔒 Auth requiredResume a paused subscription.
{
"id": "sub_7h8i9j",
"status": "active"
}curl -X PUT https://api.zyrix.co/api/subscriptions/:id/resume \
-H "Authorization: Bearer sk_live_xxxxx"/api/subscriptions/:id/cancel🔒 Auth requiredCancel a subscription permanently.
{
"id": "sub_7h8i9j",
"status": "cancelled"
}curl -X PUT https://api.zyrix.co/api/subscriptions/:id/cancel \
-H "Authorization: Bearer sk_live_xxxxx"Invoices
/api/invoices🔒 Auth requiredCreate an invoice with automatic tax calculation.
{
"customer_id": "cus_1a2b3c",
"items": [
{
"name": "Consulting",
"amount": 50000,
"quantity": 1
}
],
"currency": "SAR",
"due_date": "2026-04-10",
"tax_rate": 15
}{
"id": "inv_2k3l4m",
"number": "INV-1024",
"status": "draft",
"total": 57500,
"pdf_url": "https://pay.zyrix.co/i/2k3l4m.pdf"
}curl -X POST https://api.zyrix.co/api/invoices \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"customer_id": "cus_1a2b3c",
"items": [
{
"name": "Consulting",
"amount": 50000,
"quantity": 1
}
],
"currency": "SAR",
"due_date": "2026-04-10",
"tax_rate": 15
}'/api/invoices🔒 Auth requiredList all invoices.
{
"data": [
{
"id": "inv_2k3l4m",
"number": "INV-1024",
"status": "draft",
"total": 57500
}
],
"has_more": false
}curl -X GET https://api.zyrix.co/api/invoices \
-H "Authorization: Bearer sk_live_xxxxx"/api/invoices/:id🔒 Auth requiredRetrieve a single invoice.
{
"id": "inv_2k3l4m",
"number": "INV-1024",
"status": "draft",
"total": 57500,
"pdf_url": "https://pay.zyrix.co/i/2k3l4m.pdf",
"created_at": "2026-03-25T10:30:00Z"
}curl -X GET https://api.zyrix.co/api/invoices/:id \
-H "Authorization: Bearer sk_live_xxxxx"/api/invoices/:id/send🔒 Auth requiredSend an invoice by email or WhatsApp.
{
"channel": "whatsapp"
}{
"id": "inv_2k3l4m",
"status": "sent",
"sent_to": "+966501234567"
}curl -X PUT https://api.zyrix.co/api/invoices/:id/send \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"channel": "whatsapp"
}'/api/invoices/:id/mark-paid🔒 Auth requiredMark an invoice as paid.
{
"id": "inv_2k3l4m",
"status": "paid",
"paid_at": "2026-03-26T08:00:00Z"
}curl -X PUT https://api.zyrix.co/api/invoices/:id/mark-paid \
-H "Authorization: Bearer sk_live_xxxxx"Routing
/api/routing/rules🔒 Auth requiredList all routing rules.
{
"data": [
{
"id": "rul_5n6o7p",
"name": "SA cards to HyperPay",
"strategy": "smart",
"priority": 1
}
]
}curl -X GET https://api.zyrix.co/api/routing/rules \
-H "Authorization: Bearer sk_live_xxxxx"/api/routing/rules🔒 Auth requiredCreate a routing rule.
{
"name": "SA cards to HyperPay",
"strategy": "smart",
"conditions": [
{
"field": "country",
"operator": "equals",
"value": "SA"
}
],
"provider": "hyperpay"
}{
"id": "rul_5n6o7p",
"name": "SA cards to HyperPay",
"strategy": "smart",
"status": "active"
}curl -X POST https://api.zyrix.co/api/routing/rules \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "SA cards to HyperPay",
"strategy": "smart",
"conditions": [
{
"field": "country",
"operator": "equals",
"value": "SA"
}
],
"provider": "hyperpay"
}'/api/routing/rules/:id🔒 Auth requiredUpdate a routing rule.
{
"name": "SA cards to Moyasar",
"priority": 2
}{
"id": "rul_5n6o7p",
"name": "SA cards to Moyasar",
"strategy": "smart",
"priority": 2
}curl -X PUT https://api.zyrix.co/api/routing/rules/:id \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "SA cards to Moyasar",
"priority": 2
}'Customers
/api/customers🔒 Auth requiredCreate a customer.
{
"email": "ahmed@example.com",
"name": "Ahmed Al-Farsi",
"phone": "+966501234567",
"metadata": {
"tier": "vip"
}
}{
"id": "cus_1a2b3c",
"email": "ahmed@example.com",
"name": "Ahmed Al-Farsi",
"created_at": "2026-03-25T10:30:00Z"
}curl -X POST https://api.zyrix.co/api/customers \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"email": "ahmed@example.com",
"name": "Ahmed Al-Farsi",
"phone": "+966501234567",
"metadata": {
"tier": "vip"
}
}'/api/customers/:id🔒 Auth requiredRetrieve a single customer.
{
"id": "cus_1a2b3c",
"email": "ahmed@example.com",
"name": "Ahmed Al-Farsi",
"phone": "+966501234567",
"created_at": "2026-03-25T10:30:00Z"
}curl -X GET https://api.zyrix.co/api/customers/:id \
-H "Authorization: Bearer sk_live_xxxxx"/api/customers/:id🔒 Auth requiredUpdate a customer.
{
"name": "Ahmed F. Al-Farsi",
"phone": "+966509876543"
}{
"id": "cus_1a2b3c",
"email": "ahmed@example.com",
"name": "Ahmed F. Al-Farsi",
"phone": "+966509876543"
}curl -X PUT https://api.zyrix.co/api/customers/:id \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Ahmed F. Al-Farsi",
"phone": "+966509876543"
}'Balance & Settlements
/api/balance🔒 Auth requiredRetrieve your current balance.
{
"available": [
{
"amount": 1250000,
"currency": "SAR"
}
],
"pending": [
{
"amount": 340000,
"currency": "SAR"
}
]
}curl -X GET https://api.zyrix.co/api/balance \
-H "Authorization: Bearer sk_live_xxxxx"/api/settlements🔒 Auth requiredList settlements.
{
"data": [
{
"id": "set_8q9r0s",
"amount": 1250000,
"currency": "SAR",
"status": "paid",
"arrival_date": "2026-03-27"
}
],
"has_more": false
}curl -X GET https://api.zyrix.co/api/settlements \
-H "Authorization: Bearer sk_live_xxxxx"/api/settlements/:id🔒 Auth requiredRetrieve a single settlement.
{
"id": "set_8q9r0s",
"amount": 1250000,
"currency": "SAR",
"status": "paid",
"arrival_date": "2026-03-27",
"transactions": 412
}curl -X GET https://api.zyrix.co/api/settlements/:id \
-H "Authorization: Bearer sk_live_xxxxx"Analytics
/api/analytics🔒 Auth requiredRetrieve an analytics overview.
{
"volume": 3410000,
"transactions": 1284,
"approval_rate": 97.8,
"period": "30d"
}curl -X GET https://api.zyrix.co/api/analytics \
-H "Authorization: Bearer sk_live_xxxxx"/api/analytics/revenue🔒 Auth requiredRetrieve revenue analytics over time.
{
"total": 3410000,
"currency": "SAR",
"by_day": [
{
"date": "2026-03-24",
"amount": 112000
},
{
"date": "2026-03-25",
"amount": 138000
}
]
}curl -X GET https://api.zyrix.co/api/analytics/revenue \
-H "Authorization: Bearer sk_live_xxxxx"/api/analytics/providers🔒 Auth requiredCompare performance across providers.
{
"data": [
{
"provider": "hyperpay",
"volume": 1840000,
"approval_rate": 98.1,
"latency": 145
},
{
"provider": "moyasar",
"volume": 980000,
"approval_rate": 97.2,
"latency": 160
}
]
}curl -X GET https://api.zyrix.co/api/analytics/providers \
-H "Authorization: Bearer sk_live_xxxxx"Webhooks
/api/webhooks/configure🔒 Auth requiredConfigure a webhook endpoint and events.
{
"url": "https://mystore.com/webhook",
"events": [
"payment.succeeded",
"payment.failed",
"subscription.renewed"
]
}{
"id": "whk_4t5u6v",
"url": "https://mystore.com/webhook",
"status": "active",
"secret": "whsec_xxx"
}curl -X POST https://api.zyrix.co/api/webhooks/configure \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"url": "https://mystore.com/webhook",
"events": [
"payment.succeeded",
"payment.failed",
"subscription.renewed"
]
}'/api/webhooks/events🔒 Auth requiredList recent webhook delivery events.
{
"data": [
{
"id": "evt_7w8x9y",
"event": "payment.succeeded",
"delivered": true,
"created_at": "2026-03-25T10:31:00Z"
}
]
}curl -X GET https://api.zyrix.co/api/webhooks/events \
-H "Authorization: Bearer sk_live_xxxxx"/api/webhooks/test🔒 Auth requiredSend a test webhook to your endpoint.
{
"event": "subscription.renewed"
}{
"delivered": true,
"status_code": 200,
"latency_ms": 230
}curl -X POST https://api.zyrix.co/api/webhooks/test \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"event": "subscription.renewed"
}'API Keys
/api/api-keys🔒 Auth requiredList your API keys.
{
"data": [
{
"id": "key_0z1a2b",
"prefix": "sk_live_",
"mode": "live",
"created_at": "2026-03-01T00:00:00Z",
"last_used": "2026-03-25T10:30:00Z"
}
]
}curl -X GET https://api.zyrix.co/api/api-keys \
-H "Authorization: Bearer sk_live_xxxxx"/api/api-keys🔒 Auth requiredCreate a new API key.
{
"name": "Production server",
"mode": "live"
}{
"id": "key_0z1a2b",
"key": "sk_live_4f8a2c9d1e6b",
"prefix": "sk_live_",
"mode": "live"
}curl -X POST https://api.zyrix.co/api/api-keys \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Production server",
"mode": "live"
}'/api/api-keys/:id/revoke🔒 Auth requiredRevoke an API key.
{
"id": "key_0z1a2b",
"status": "revoked"
}curl -X PUT https://api.zyrix.co/api/api-keys/:id/revoke \
-H "Authorization: Bearer sk_live_xxxxx"