وثائق المطورين

الربط المدمج S2S

اشحن البطاقات مباشرة من خادمك مع دعم كامل لتحدي 3-D Secure.

تتيح واجهة SALE من خادم إلى خادم شحن البطاقات من نظامك الخلفي مع إعادة توجيه 3DS. تتطلب هذه الطريقة التزاماً أعلى بمتطلبات PCI لأن بيانات البطاقة تمرّ عبر أنظمتك.

POST https://app-api.nmapay.com/api/v1/payment-gateway/s2s/sale

معاملات الطلب

FieldTypeRequiredDescription
orderIdStringYesUnique identifier per transaction
amountNumberYesTransaction amount
currencyStringYesISO currency code, e.g. SAR
paymentMethodStringYesMust be card
authStringYesY for authorisation-only, otherwise N
cardObjectYescardNumber, cardHolder, cardExpiryMonth, cardExpiryYear, cardCvv
customerObjectYesname, email, phone
successUrlStringYesRedirect after successful 3DS
failureUrlStringYesRedirect after failed 3DS
hashStringYesRequest hash — see Authentication
curl --location 'https://app-api.nmapay.com/api/v1/payment-gateway/s2s/sale' \
--header 'X-API-KEY: <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "orderId": "12345",
  "amount": 100,
  "currency": "SAR",
  "paymentMethod": "card",
  "auth": "N",
  "recurringInit": "N",
  "customer": { "name": "John Doe", "email": "john@example.com", "phone": "+9665xxxxxxx" },
  "card": {
    "cardNumber": "5123450000000008",
    "cardHolder": "JOHN DOE",
    "cardExpiryMonth": "01",
    "cardExpiryYear": "2039",
    "cardCvv": "100"
  },
  "successUrl": "https://your-site.com/success",
  "failureUrl": "https://your-site.com/failure",
  "hash": "<GENERATED_HASH>"
}'

معالجة تحدي 3DS

عند وجود الحقل html في الاستجابة، فهذا يعني أن المصادقة الإضافية مطلوبة والعملية في حالة Pending. اعرض محتوى html كما هو دون تعديل: داخل iframe في الويب أو WebView في التطبيق.

لا تُعدّل محتوى الـ HTML. سيُعاد توجيه العميل تلقائياً إلى successUrl أو failureUrl بعد إتمام المصادقة.

عمليات ما بعد البيع

OperationEndpointPurpose
Capture/payment-gateway/s2s/captureCapture a previously authorised amount
Void/payment-gateway/s2s/voidCancel an authorisation before settlement
Refund/payment-gateway/s2s/refundReturn funds fully or partially
Recurring/payment-gateway/s2s/recurringCharge a stored, tokenised card
Status/payment-gateway/statusQuery the current transaction status