رويــــــالوحة المطور

RUYA / توثيق المطورين

طلبات الدفع

أمثلة هذه الصفحة تستخدم Sandbox ولا تنقل أموالاً. واجهة Live منفصلة وتتطلب اعتماد الحساب وطريقة الاستلام واشتراكاً سارياً.

دليل التكامل

المبالغ أعداد صحيحة بالقروش: 19900 تعني 199 جنيهاً. يتطلب POST صلاحية payments:write واشتراكاً سارياً. أعد مفتاح Idempotency-Key نفسه بعد انقطاع الاتصال؛ تغيير الطلب بالمفتاح نفسه يعيد 409. يحتوي الرد id وreference ورابط الدفع /checkout/{reference}. تُرفض الحقول الزائدة ومنها merchantId وstatus.

المسارات المنفّذة

POST /api/v1/payment-intents

المصادقة / الصلاحيات: payments:write · HTTP 201

Parameters / المعاملات
[
  {
    "name": "Idempotency-Key",
    "in": "header",
    "required": true,
    "schema": {
      "type": "string",
      "maxLength": 100
    }
  }
]
Example request / مثال الطلب
{
  "amount": 19900,
  "currency": "EGP",
  "description": "Order 101",
  "expiresInMinutes": 60
}
cURL
curl -X POST 'https://ruya.site/api/v1/payment-intents'
  -H 'Authorization: Bearer YOUR_SERVER_SIDE_TEST_KEY'
  -H 'Idempotency-Key: order-101'
  -H 'Content-Type: application/json'
  --data '{"amount":19900,"currency":"EGP","description":"Order 101","expiresInMinutes":60}'
Node.js backend
const response = await fetch("https://ruya.site/api/v1/payment-intents", {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + process.env.RUYA_TEST_KEY, 'Idempotency-Key': 'order-101', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "amount": 19900,
  "currency": "EGP",
  "description": "Order 101",
  "expiresInMinutes": 60
})
});
if (!response.ok) throw new Error('RUYA HTTP ' + response.status);
const result = await response.json();
مخططات الطلب والرد الناجح
Generated contract / العقد المولّد
{
  "request": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "amount": {
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 100000000
      },
      "currency": {
        "default": "EGP",
        "type": "string",
        "enum": [
          "EGP"
        ]
      },
      "description": {
        "type": "string",
        "minLength": 1,
        "maxLength": 240
      },
      "expiresInMinutes": {
        "default": 60,
        "type": "integer",
        "minimum": 1,
        "maximum": 10080
      }
    },
    "required": [
      "amount",
      "description"
    ],
    "additionalProperties": false
  },
  "response": {
    "$ref": "#/schemas/Payment"
  }
}

استبدل معاملات المسار بمعرف سجلك. اتبع قسم الأخطاء للردود الفاشلة. لا تحتوي الأمثلة على مفاتيح حقيقية أو نتائج دفع فعلية.

جرّب في Sandbox

POST /api/v1/payment-links

المصادقة / الصلاحيات: payments:write · HTTP 201

Parameters / المعاملات
[
  {
    "name": "Idempotency-Key",
    "in": "header",
    "required": true,
    "schema": {
      "type": "string",
      "maxLength": 100
    }
  }
]
Example request / مثال الطلب
{
  "amount": 19900,
  "currency": "EGP",
  "description": "Order 101"
}
cURL
curl -X POST 'https://ruya.site/api/v1/payment-links'
  -H 'Authorization: Bearer YOUR_SERVER_SIDE_TEST_KEY'
  -H 'Idempotency-Key: order-101'
  -H 'Content-Type: application/json'
  --data '{"amount":19900,"currency":"EGP","description":"Order 101"}'
Node.js backend
const response = await fetch("https://ruya.site/api/v1/payment-links", {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + process.env.RUYA_TEST_KEY, 'Idempotency-Key': 'order-101', 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "amount": 19900,
  "currency": "EGP",
  "description": "Order 101"
})
});
if (!response.ok) throw new Error('RUYA HTTP ' + response.status);
const result = await response.json();
مخططات الطلب والرد الناجح
Generated contract / العقد المولّد
{
  "request": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "amount": {
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 100000000
      },
      "currency": {
        "default": "EGP",
        "type": "string",
        "enum": [
          "EGP"
        ]
      },
      "description": {
        "type": "string",
        "minLength": 1,
        "maxLength": 240
      },
      "expiresInMinutes": {
        "default": 60,
        "type": "integer",
        "minimum": 1,
        "maximum": 10080
      }
    },
    "required": [
      "amount",
      "description"
    ],
    "additionalProperties": false
  },
  "response": {
    "$ref": "#/schemas/Payment"
  }
}

استبدل معاملات المسار بمعرف سجلك. اتبع قسم الأخطاء للردود الفاشلة. لا تحتوي الأمثلة على مفاتيح حقيقية أو نتائج دفع فعلية.

جرّب في Sandbox

آخر تحديث: ٥ ديسمبر ٢٠٢٦. مرجع المسارات مولّد من المتحكمات ومخططات التحقق الحالية.