العودة للمرجع
POST/payments/initiate
Payments

بدء عملية دفع

ينشئ عملية دفع عبر المنسق؛ يتم اشتقاق business_id من المصادقة ولا يُرسل في الطلب.

مستوى الوصولauthenticatedالحدpay_apiمنع التكرارheader:Idempotency-KeyالمصادقةBearerAuth
المصدرLuxApi/Modules/PayAPI/Controllers/PaymentController.php::initiateLuxPayProjects @ 146e98baa44e

المعاملات

X-Request-IDheader
stringاختياري

Client correlation identifier. LuxPay may generate one when omitted.

Example: req_01J...
Idempotency-Keyheader
stringإلزامي

Unique key for safely retrying this mutation. Reuse only for the same logical request.

Example: pay_01JABC...

جسم الطلب

InitiatePaymentRequestإلزامي
amount
number
Example: 1250.5
currency
string
Example: YER
payment_method
string
Example: wallet
payment_channel
string
Example: pos
provider
string | null
metadata
object | null

JSON example

{
  "amount": 1250.5,
  "currency": "YER",
  "payment_method": "wallet",
  "payment_channel": "pos",
  "provider": "string",
  "metadata": {}
}

أمثلة الكود

العنوان المعروض Sandbox Placeholder حتى يتم تزويد النطاق الرسمي. لا تلصق رمز Production في متصفح عام.
curl --request POST \
  --url 'https://sandbox-api.luxpay.example/v1/payments/initiate' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <token>' \
  --header 'Idempotency-Key: pay_01JABC...' \
  --header 'Content-Type: application/json' \
  --data '{
  "amount": 1250.5,
  "currency": "YER",
  "payment_method": "wallet",
  "payment_channel": "pos",
  "provider": "string",
  "metadata": {}
}'

الاستجابات

200Duplicate replay of a previously successful request.
success
boolean
Example: true
data
PaymentResult
{
  "success": true,
  "data": {
    "success": false,
    "transaction_id": "string",
    "status": "string",
    "provider": "string",
    "provider_ref": "string",
    "amount": 1,
    "currency": "string",
    "fee_amount": 1,
    "net_amount": 1,
    "message": "string",
    "error_code": "string",
    "is_duplicate": false,
    "metadata": {}
  }
}
201Successful response.
success
boolean
Example: true
data
PaymentResult
{
  "success": true,
  "data": {
    "success": false,
    "transaction_id": "string",
    "status": "string",
    "provider": "string",
    "provider_ref": "string",
    "amount": 1,
    "currency": "string",
    "fee_amount": 1,
    "net_amount": 1,
    "message": "string",
    "error_code": "string",
    "is_duplicate": false,
    "metadata": {}
  }
}
400
401
403
404
409
422
429
500
OpenAPI JSONOpenAPI YAMLPostman collection