> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# إنشاء فاتورة شحن الرصيد عبر API: الدفع بالتحويل البنكي

> أنشئ فاتورة شحن رصيد من Didit عبر API وادفعها بالتحويل البنكي خلال 45 يوماً: من $1,000 إلى $20,000 من الرصيد، مع بيانات البنك وملف PDF.

تُصدر واجهة برمجة تطبيقات فواتير شحن الرصيد في Didit فاتورة بالدولار الأمريكي تُضاف قيمتها إلى رصيدك عندما يدفعها فريق المالية عبر التحويل المصرفي من أي بنك، خلال 45 يومًا.
وهي الفاتورة نفسها التي ينشئها الشخص من نافذة شحن الرصيد في وحدة التحكم.

موجّه إنشاء فاتورة شحن الرصيد
        نسخ الموجّه إلى الحافظة



      
      

\<pre>

\`Goal: Create a Didit top-up invoice that the organization's finance team pays by bank transfer, so the balance is topped up without a card.

Endpoint: POST https://verification.didit.me/v3/billing/top-up-invoices/
Auth header: x-api-key: <DIDIT_API_KEY>
Idempotency-Key header: REQUIRED, 1 to 255 characters. One new key per invoice you intend to create; store it and reuse it ONLY to retry that same request.
Content-Type: application/json

Request body:
\- amount_in_dollars (number, REQUIRED): the credit to add, in USD, from 1,000 to 20,000, at most two decimals. Tax is added to the invoice when it applies.
\- po_number (string, optional, up to 140 characters): printed on the invoice.

curl:
curl -X POST 'https://verification.didit.me/v3/billing/top-up-invoices/' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: 0b8e6f4a-3c2d-4e1f-9a7b-5d6c8e2f1a30' \
-d '{"amount_in_dollars": 5000, "po_number": "PO-88213"}'

Response 201: the invoice { id, lane: "bank_transfer", status, credit_amount, total, tax, currency, amount_received, amount_credited, amount_open, invoice_number, hosted_invoice_url, invoice_pdf, po_number, due_at, confirmed_at, closed_at, created_at, bank_details: { currency, amount_due, account_holder_name, bank_name, account_number, routing_number, swift_code, reference } or null }

Before telling anyone to pay, read status and amount_open: a retry with the same key returns the same invoice in its CURRENT state, even paid, cancelled or expired. Give payment instructions ONLY while status is open or part_paid and amount_open is above 0.
To pay: transfer amount_open (not credit_amount: total includes tax) to bank_details, with invoice_number as the reference. routing_number is for ACH and US wires, swift_code for international wires. If bank_details is null, use hosted_invoice_url. The billing contacts also receive the invoice by email.
Credit: only what arrives is added, when it arrives. A part payment adds credit in proportion to the share of total it pays; the rest stays open with the same reference until due_at (45 days after issue). After due_at the status is expired; a transfer that still arrives with the reference is added for what it pays.
Follow it with GET /v3/billing/top-up-invoices/{top_up_id}/ and stop once status is paid, expired, cancelled or failed. Use due_at as returned (45 days after issue for new invoices). Settle on status and the amounts, never on confirmed_at (also set by a part payment) or closed_at (null for a paid invoice).

Errors (objects with code and detail, except field errors, which name the field):
\- 400 field error on amount_in_dollars (below 1,000, above 20,000, more than two decimals); idempotency_key_required (missing, blank or longer than 255 characters); a body that is not valid JSON (detail only); billing_details_required (missing lists the fields a person saves once in the console's billing details)
\- 404 billing_not_available
\- 409 top_up_invoice_open (open_invoice is the invoice still open or part paid: pay what it owes or wait for it to expire; it can be cancelled in the console only while nothing has arrived), idempotency_key_conflict (same key with another amount or from another API key), top_up_not_completed (an earlier request with this key could not issue its invoice: nothing was issued, create it again with a NEW key), top_up_not_allowed (annual Enterprise contract), billing_customer_missing
\- 502 payment_provider_error (the state could not be confirmed): retry with the SAME key. It returns the invoice if it was issued, or 409 top_up_not_completed if not; only then use a NEW key.`

\</pre>



      
      

الصق في

## كيف يعمل1) تابع رصيدك باستخدام [الحصول على رصيد الائتمان](https://docs.didit.me/ar/management-api/billing/balance.md).
2) أنشئ فاتورة للرصيد الذي تحتاجه، من $1,000 إلى $20,000، مع `Idempotency-Key` جديد.
3) حوّل المبلغ `amount_open` إلى الحساب المذكور في `bank_details`، واستخدم `invoice_number` مرجعاً للتحويل.
4) تابع الفاتورة باستخدام [الحصول على فاتورة شحن الرصيد](https://docs.didit.me/ar/management-api/billing/get-top-up-invoice.md) حتى تصبح قيمة `status` هي `paid`، أو تُغلق بالحالة `expired` أو `cancelled`.## ما تدفعه وما تحصل عليه- `amount_in_dollars` هو الرصيد الذي تضيفه. تُضاف الضريبة إلى الفاتورة عند انطباقها، لذلك قد يكون `total`، أي المبلغ الذي تحوّله، أعلى من `credit_amount`.
- لا يُضاف إلى رصيدك إلا المبلغ الذي وصل، وذلك عند وصوله.
- تضيف الدفعة الجزئية رصيداً بنسبة الجزء من `total` الذي تسدده، ويبقى المتبقي مفتوحاً بالمرجع نفسه حتى `due_at`.
- `due_at` هو تاريخ الاستحقاق المذكور في الفاتورة، أي بعد 45 يوماً من تاريخ إصدارها. استخدم القيمة المُرجعة؛ أما الفاتورة الصادرة بشروط سابقة فتحتفظ بتاريخها الخاص.
- إذا لم يصل `total` كاملاً بحلول `due_at`، تصبح الفاتورة `expired`. أما التحويل الذي يصل لاحقاً مع مرجعه، فيُضاف بقدر ما يسدده.
- يُستخدم `routing_number` للتحويلات عبر ACH والتحويلات البنكية الأمريكية، ويُستخدم `swift_code` للتحويلات الدولية. عندما تكون قيمة `bank_details` هي null، تعرض `hosted_invoice_url` التفاصيل نفسها.
- تُرسل الفاتورة أيضاً بالبريد الإلكتروني إلى جهات اتصال الفوترة لديك.## قبل أول فاتورة- يحفظ شخصٌ ما الاسم القانوني لشركتك وعنوانها مرة واحدة في تفاصيل الفوترة في وحدة التحكم. وإلى أن يحدث ذلك، يُرجع الطلب `400 billing_details_required` مع الحقول المذكورة في `missing`.
- تتوفر فواتير شحن الرصيد في الخطط Free وGrowth وScale. أما عقود Enterprise السنوية فتُرجع `409 top_up_not_allowed`.## idempotency وإعادة المحاولة- استخدم `Idempotency-Key` واحدًا لكل فاتورة تنوي إنشاءها، واحفظه، ولا تعِد استخدامه إلا لإعادة محاولة هذا الطلب نفسه.
- إذا كان المفتاح مفقودًا أو فارغًا أو يتجاوز 255 حرفًا، يُرجع الطلب `400 idempotency_key_required`.
- إذا أُرسل المفتاح نفسه والمبلغ نفسه من بيانات الاعتماد نفسها، يُرجع الطلب الفاتورة في حالتها الحالية، حتى لو كانت مدفوعة أو ملغاة أو منتهية الصلاحية. لا تعرض تعليمات الدفع إلا عندما تكون `status` هي `open` أو `part_paid` وتكون `amount_open` أكبر من صفر.
- إذا أُرسل المفتاح نفسه بمبلغ مختلف، أو من بيانات اعتماد أخرى، يُرجع الطلب `409 idempotency_key_conflict`.
- يعني الرد `502 payment_provider_error` أنه تعذّر تأكيد حالة الفاتورة. أعِد المحاولة بالمفتاح نفسه: سيُرجع الطلب الفاتورة إن كانت قد صدرت، أو `409 top_up_not_completed` إن لم يصدر شيء. ولا تنشئ فاتورة جديدة بمفتاح جديد إلا عندئذ فقط.## فاتورة واحدة في كل مرةطالما كانت الفاتورة في حالة `open` أو `part_paid`، فإن إنشاء فاتورة أخرى يُرجع `409 top_up_invoice_open` مع `open_invoice`.
ادفع المبلغ المتبقي عليها، أو انتظر حتى تنتهي صلاحيتها.
يمكن لشخص إلغاء فاتورة من لوحة التحكم فقط طالما لم يصل أي مبلغ.## الأخطاء| HTTP | `code` | المعنى |
| - | - | - |
| 400 | خطأ في الحقل `amount_in_dollars` | المبلغ أقل من $1,000 أو أكبر من $20,000، أو يحتوي على أكثر من منزلتين عشريتين. |
| 400 | `idempotency_key_required` | الرأس `Idempotency-Key` مفقود أو فارغ أو يتجاوز طوله 255 حرفاً. |
| 400 | لا يوجد (`detail` فقط) | جسم الطلب ليس JSON صالحاً. |
| 400 | `billing_details_required` | تحتاج الفاتورة إلى الاسم القانوني لشركتك وعنوانها؛ يسرد `missing` ما لا يزال ناقصاً. |
| 404 | `billing_not_available` | الفوترة غير متاحة لمؤسستك حتى الآن. |
| 409 | `top_up_invoice_open` | توجد فاتورة أخرى مفتوحة أو مدفوعة جزئياً؛ يحدد `open_invoice` هذه الفاتورة. |
| 409 | `idempotency_key_conflict` | استُخدم المفتاح مع مبلغ آخر أو باستخدام مفتاح API آخر. |
| 409 | `top_up_not_completed` | تعذّر على طلب سابق بهذا المفتاح إصدار فاتورته. لم تُصدر أي فاتورة: أنشئ فاتورة جديدة بمفتاح جديد. |
| 409 | `top_up_not_allowed` | لا يمكن شحن الرصيد في عقود Enterprise السنوية. |
| 409 | `billing_customer_missing` | ليس لمؤسستك حساب فوترة بعد؛ يُعِدّ شخصٌ ما الفوترة في وحدة التحكم. |
| 502 | `payment_provider_error` | تعذّر تأكيد حالة الفاتورة. أعد المحاولة بالمفتاح نفسه. |لشحن الرصيد ببطاقة بدلاً من ذلك، راجع [شحن الرصيد](https://docs.didit.me/ar/management-api/billing/top-up.md).


## OpenAPI

````yaml ar/openapi-25.json POST /v3/billing/top-up-invoices/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: واجهة برمجة تطبيقات التحقق من الهوية. صادِق باستخدام الترويسة x-api-key.
servers:
  - url: https://verification.didit.me
security: []
tags:
  - name: Bank Data
    description: >-
      Bank Link، والاتصالات والحسابات والأرصدة والمعاملات والمؤسسات والتغطية.
      القراءات لمرة واحدة من البنوك الحقيقية متاحة لتطبيقات الإنتاج. الوصول
      المستمر إلى البنوك الحقيقية غير متاح بعد لتطبيقات الإنتاج، وهو متاح
      لتطبيقات البيئة التجريبية مع Didit Test Bank، ويُفتح دولةً بعد دولة. لا
      تُحتسب أي رسوم في البيئة التجريبية. يحتاج الاستدعاء الذي يتم بمفتاح API
      إلى مفتاح يمكنه الوصول إلى بيانات البنك: المفتاح ذو الوصول الكامل يمكنه
      ذلك، أما المفتاح ذو النطاق المحدد فيحتاج إلى `bank-data` في نطاقاته (read
      للقراءات، وwrite للعمليات التي تغيّر شيئاً). يُرفض المفتاح ذو النطاق
      المحدد الذي لا يملك هذا النطاق، ويعيد الاستدعاء استجابة `403
      bank_data_access_denied`. فحص الحساب استثناء: يحتاج إلى صلاحية الكتابة على
      الجلسات، أو إلى الوصول الكامل، وليس نطاق بيانات البنك. كما أن البيانات
      الخام للبنك (الحسابات والأرصدة والمعاملات وقناة التغييرات) ترفض أيضاً
      الطلب الذي لا يحمل مفتاح API.


      كل رفض تحت `/v3/bank/` باستثناء رفض فحص الحساب له نفس جسم JSON (`code`
      و`message` و`request_id` و`field` و`next_action` و`retry_after`). يعيد
      المسار الذي ليس عملية، أو المعرّف الذي ليس UUID، أو المورد الفرعي غير
      المعروف، استجابة `404 not_found` لكل الطرق، ويعيد أي خطأ غير متوقع استجابة
      `500 internal_error` مع `request_id`. وعندما لا تكون بيانات البنك متاحة،
      تعيد كل عملية الخطأ القياسي `404` للمنصة، تماماً كما يعيد المسار غير
      المعروف.
paths:
  /v3/billing/top-up-invoices/:
    post:
      tags:
        - Billing
      summary: إنشاء فاتورة شحن رصيد
      description: >-
        إصدار فاتورة بالدولار الأمريكي تُضاف قيمتها إلى رصيد المؤسسة عند دفعها
        بتحويل بنكي من أي بنك خلال **45 يومًا**، وهي الفاتورة نفسها التي ينشئها
        الشخص من نافذة شحن الرصيد في وحدة التحكم. صُممت لفرق المالية التي تُؤتمت
        عمليات شحن الرصيد: راقب `GET /v3/billing/balance/`، وأنشئ فاتورة،
        وادفعها، ثم تابعها عبر `GET /v3/billing/top-up-invoices/{top_up_id}/`.


        - **المبلغ.** `amount_in_dollars` هو الرصيد المضاف، ويتراوح بين
        **\$1,000 و\$20,000**، بحد أقصى منزلتين عشريتين. تُضاف الضريبة إلى
        الفاتورة عند انطباقها، لذلك قد يكون `total` (المبلغ الذي تحوّله) أعلى من
        `credit_amount`.

        - **الدفع.** طالما كانت `status` بقيمة `open` أو `part_paid`
        و`amount_open` أكبر من صفر، حوّل `amount_open` مع استخدام
        `invoice_number` مرجعًا للتحويل، إلى الحساب الوارد في `bank_details`
        (`routing_number` للتحويلات عبر ACH والتحويلات الأمريكية، و`swift_code`
        للتحويلات الدولية). كما تتلقى جهات الفوترة في المؤسسة الفاتورة بالبريد
        الإلكتروني، وتعرض `hosted_invoice_url` و`invoice_pdf` التفاصيل نفسها.
        عندما تكون `bank_details` فارغة (null)، استخدم `hosted_invoice_url`.

        - **الرصيد.** لا يُضاف إلا ما يصل، وفي وقت وصوله. التحويل لكامل `total`
        يضيف `credit_amount`؛ أما الدفعة الجزئية فتضيف رصيدًا بنسبة الجزء من
        `total` الذي تسدده، ويبقى الباقي مفتوحًا بالمرجع نفسه حتى `due_at`، وهو
        التاريخ المذكور على الفاتورة. إذا لم يصل كامل `total` بحلول ذلك التاريخ،
        تصبح الحالة `expired`، والتحويل الذي يصل لاحقًا مع المرجع يُضاف بقدر ما
        يسدده.

        - **فاتورة واحدة في كل مرة.** طالما كانت الفاتورة مفتوحة أو مدفوعة
        جزئيًا، فإن إنشاء فاتورة أخرى يعيد `409` `top_up_invoice_open` مع
        `open_invoice`: ادفع ما تبقى عليها، أو انتظر انتهاء صلاحيتها. ولا يمكن
        للشخص إلغاء الفاتورة من وحدة التحكم إلا قبل وصول أي مبلغ.

        - **تفاصيل الفوترة.** تُصدر الفاتورة باسم الشركة القانوني وعنوانها، وهما
        ما يحفظه الشخص مرة واحدة في تفاصيل الفوترة في وحدة التحكم. وإلى أن يتم
        ذلك، يعيد الطلب `400` `billing_details_required` مع الحقول `missing`.

        - **الخطط.** متاحة حيثما يتوفر شحن الرصيد: خطط Free وGrowth وScale. عقود
        Enterprise السنوية تعيد `409` `top_up_not_allowed`.


        **idempotency.** الرأس `Idempotency-Key` إلزامي: المفتاح المفقود أو
        الفارغ أو الذي يتجاوز 255 حرفًا يعيد `400` `idempotency_key_required`.
        استخدم مفتاحًا واحدًا لكل فاتورة تنوي إنشاءها، واحفظه، ولا تعد استخدامه
        إلا لإعادة محاولة الطلب نفسه: المفتاح نفسه مع المبلغ نفسه من بيانات
        الاعتماد نفسها يعيد تلك الفاتورة (`201`) بحالتها الحالية أيًّا كانت، حتى
        لو دُفعت أو أُلغيت أو انتهت صلاحيتها، لذا لا تعرض تعليمات الدفع إلا
        طالما كانت `status` بقيمة `open` أو `part_paid` و`amount_open` أكبر من
        صفر. المفتاح نفسه مع مبلغ آخر، أو من بيانات اعتماد أخرى، يعيد `409`
        `idempotency_key_conflict`.


        **إذا فشل الطلب.** يعني `502` `payment_provider_error` أنه تعذّر تأكيد
        حالة الفاتورة. أعد المحاولة بالمفتاح نفسه: تعيد المحاولة الفاتورة إذا
        كانت قد أُصدرت، أو تعيد `409` `top_up_not_completed` إذا لم يُصدر شيء.
        ولا تُنشئ فاتورة جديدة بمفتاح جديد إلا بعد `top_up_not_completed`،
        فالمفتاح الجديد بعد `502` وحده قد يجد الفاتورة الأولى ما زالت مفتوحة
        (`409` `top_up_invoice_open`).
      operationId: billing_top_up_invoices_create
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            مفتاح واحد لكل فاتورة تنوي إنشاءها، من 1 إلى 255 حرفًا، ولا يُعاد
            استخدامه إلا لإعادة محاولة ذلك الطلب. المفتاح نفسه مع المبلغ نفسه من
            بيانات الاعتماد نفسها يعيد الفاتورة نفسها ولا يُصدر فاتورتين أبدًا.
            المفتاح المفقود أو الفارغ أو الذي يتجاوز 255 حرفًا يعيد `400`
            `idempotency_key_required`.
          schema:
            type: string
            minLength: 1
            maxLength: 255
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - amount_in_dollars
              properties:
                amount_in_dollars:
                  type: number
                  minimum: 1000
                  maximum: 20000
                  description: >-
                    المبلغ المراد إضافته إلى الرصيد، بالدولار الأمريكي، **من
                    1,000 إلى 20,000**، بما لا يزيد على رقمين عشريين. تُضاف
                    الضريبة إلى الفاتورة عند انطباقها.
                  multipleOf: 0.01
                po_number:
                  type: string
                  maxLength: 140
                  description: رقم أمر الشراء الخاص بك، المطبوع على الفاتورة.
            examples:
              Invoice for $5,000 of credit:
                value:
                  amount_in_dollars: 5000
                  po_number: PO-88213
      responses:
        '201':
          description: >-
            الفاتورة: الجديدة، أو الفاتورة التي أنشأها هذا المفتاح من قبل،
            بحالتها الحالية.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingTopUpInvoice'
              examples:
                Issued:
                  value:
                    id: 9a4f2c1e-7b3d-4e8a-a1c5-6f0d2b9e8c47
                    lane: bank_transfer
                    status: open
                    credit_amount: '5000.00'
                    total: '5000.00'
                    tax: '0.00'
                    currency: usd
                    amount_received: '0.00'
                    amount_credited: '0.00'
                    amount_open: '5000.00'
                    presented: null
                    method:
                      type: customer_balance
                      name: Bank transfer
                    invoice_number: 7F3A2C1B-0012
                    hosted_invoice_url: https://invoice.example.com/i/7F3A2C1B-0012
                    invoice_pdf: https://invoice.example.com/i/7F3A2C1B-0012/pdf
                    po_number: PO-88213
                    due_at: '2027-01-14T10:00:00Z'
                    confirmed_at: null
                    closed_at: null
                    failure_reason: null
                    created_at: '2026-11-30T10:00:00Z'
                    bank_details:
                      currency: USD
                      amount_due: '5000.00'
                      account_holder_name: Didit
                      bank_name: Example Bank, N.A.
                      account_number: '000123456789'
                      routing_number: '000000000'
                      swift_code: EXAMUS33XXX
                      reference: 7F3A2C1B-0012
        '400':
          description: >-
            خطأ في حقل، مثل `amount_in_dollars` أقل من \$1,000 أو أكبر من
            \$20,000 أو بأكثر من منزلتين عشريتين، أو كائن يحتوي على `code`:
            `idempotency_key_required` (إذا كان `Idempotency-Key` مفقوداً أو
            فارغاً أو أطول من 255 حرفاً) أو `billing_details_required` (لم يتم
            حفظ الاسم القانوني والعنوان بعد؛ يسرد `missing` الحقول الناقصة).
            يعيد النص الذي لا يكون JSON صالحاً كائناً يحتوي على `detail` فقط.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/TopUpInvoiceFieldErrors'
                  - $ref: '#/components/schemas/TopUpInvoiceError'
                  - $ref: '#/components/schemas/TopUpInvoiceDetailError'
              examples:
                Amount below the minimum:
                  value:
                    amount_in_dollars:
                      - A bank transfer top-up must be at least $1,000
                Billing details missing:
                  value:
                    code: billing_details_required
                    detail: >-
                      Add your billing details (legal name and address) before
                      creating an invoice.
                    missing:
                      - legal_name
                      - address.line1
                Body not valid JSON:
                  value:
                    detail: >-
                      JSON parse error - Expecting value: line 1 column 1 (char
                      0)
        '401':
          description: >-
            انتهت صلاحية مفتاح API أو رمز الوصول الخاص بالتطبيق، أو أُلغي:
            استبدل بيانات الاعتماد.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopUpInvoiceDetailError'
              examples:
                Expired key:
                  value:
                    detail: This API key has expired.
        '403':
          description: >-
            لم يُرسل أي بيانات اعتماد، أو أن بيانات الاعتماد لا تستطيع استخدام
            فواتير شحن الرصيد لهذه المؤسسة.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopUpInvoiceDetailError'
              examples:
                No credential:
                  value:
                    detail: Authentication credentials were not provided.
        '404':
          description: '`billing_not_available`: الفوترة غير متاحة لهذه المؤسسة حتى الآن.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopUpInvoiceError'
              examples:
                Billing not available:
                  value:
                    code: billing_not_available
                    detail: Plans and billing settings are not available yet.
        '409':
          description: >-
            `top_up_invoice_open` (توجد فاتورة أخرى مفتوحة أو مسدّدة جزئياً،
            و`open_invoice` يحددها)، و`idempotency_key_conflict` (استُخدم
            المفتاح مع مبلغ آخر أو بواسطة مفتاح API آخر)،
            و`top_up_not_completed` (تعذّر على طلب سابق بهذا المفتاح إصدار
            فاتورته، ولم يصدر شيء؛ أنشئ فاتورة جديدة بمفتاح جديد)، أو
            `top_up_not_allowed` (عقد Enterprise سنوي)، أو
            `billing_customer_missing` (ليس لدى المؤسسة حساب فوترة بعد؛ يُنشئ
            أحد الأشخاص حساب الفوترة من لوحة التحكم).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopUpInvoiceError'
              examples:
                Invoice already open:
                  value:
                    code: top_up_invoice_open
                    detail: >-
                      An invoice is already open. Pay it or cancel it before
                      creating another.
                    open_invoice:
                      id: 9a4f2c1e-7b3d-4e8a-a1c5-6f0d2b9e8c47
                      lane: bank_transfer
                      status: open
                      credit_amount: '5000.00'
                      total: '5000.00'
                      tax: '0.00'
                      currency: usd
                      amount_received: '0.00'
                      amount_credited: '0.00'
                      amount_open: '5000.00'
                      presented: null
                      method:
                        type: customer_balance
                        name: Bank transfer
                      invoice_number: 7F3A2C1B-0012
                      hosted_invoice_url: https://invoice.example.com/i/7F3A2C1B-0012
                      invoice_pdf: https://invoice.example.com/i/7F3A2C1B-0012/pdf
                      po_number: PO-88213
                      due_at: '2027-01-14T10:00:00Z'
                      confirmed_at: null
                      closed_at: null
                      failure_reason: null
                      created_at: '2026-11-30T10:00:00Z'
                Open invoice closed meanwhile:
                  value:
                    code: top_up_invoice_open
                    detail: >-
                      An invoice is already open. Pay it or cancel it before
                      creating another.
                    open_invoice: null
                Key used for another invoice:
                  value:
                    code: idempotency_key_conflict
                    detail: This idempotency key was used for another top-up.
                Invoice not issued:
                  value:
                    code: top_up_not_completed
                    detail: >-
                      An earlier request with this Idempotency-Key failed before
                      the invoice was issued. Nothing is owed: create a new
                      invoice with a new key.
        '429':
          description: >-
            تجاوز حد المعدل؛ تراجع وأعد المحاولة بعد الفترة المذكورة في
            `Retry-After`.
          content:
            application/json:
              examples:
                Throttled:
                  value:
                    detail: >-
                      Write request rate limit exceeded. You can make up to 300
                      requests per minute.
                    reference: RL-00000000000040008000000000000001
                    limit: 300
                    remaining: 0
                    reset: 1794358860
                    window_seconds: 60
              schema:
                $ref: '#/components/schemas/RateLimitBudgetError'
          headers:
            Retry-After:
              $ref: '#/components/headers/BudgetRetryAfter'
            X-RateLimit-Scope:
              $ref: '#/components/headers/BudgetXRateLimitScope'
            X-RateLimit-Limit:
              $ref: '#/components/headers/BudgetXRateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/BudgetXRateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/BudgetXRateLimitReset'
        '502':
          description: >-
            `payment_provider_error`: تعذّر التحقق من حالة الفاتورة لدى مزود
            الدفع. أعد المحاولة بالمفتاح نفسه `Idempotency-Key`: فستعيد الفاتورة
            إن كانت قد صدرت، أو `409` مع `top_up_not_completed` إن لم يصدر شيء؛
            وفقط عندها أنشئ فاتورة جديدة بمفتاح جديد.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopUpInvoiceError'
              examples:
                Not issued:
                  value:
                    code: payment_provider_error
                    detail: The payment provider is not available. Try again later.
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X POST
            'https://verification.didit.me/v3/billing/top-up-invoices/' \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -H 'Idempotency-Key: 0b8e6f4a-3c2d-4e1f-9a7b-5d6c8e2f1a30' \
              -d '{
                "amount_in_dollars": 5000,
                "po_number": "PO-88213"
              }'
components:
  schemas:
    BillingTopUpInvoice:
      type: object
      description: >-
        فاتورة شحن رصيد يتم دفعها بتحويل بنكي: الفاتورة نفسها التي تصدرها نافذة
        شحن الرصيد في وحدة التحكم. اقرأ `status` والمبالغ لمعرفة وضعها؛ أما
        الطوابع الزمنية فتسجل الأحداث فقط.
      required:
        - id
        - lane
        - status
        - credit_amount
        - total
        - tax
        - currency
        - amount_received
        - amount_credited
        - amount_open
        - created_at
      properties:
        id:
          type: string
          format: uuid
          description: >-
            معرّف الفاتورة: اقرأه مجددًا باستخدام `GET
            /v3/billing/top-up-invoices/{top_up_id}/`.
        lane:
          type: string
          enum:
            - bank_transfer
          description: دائماً `bank_transfer`.
        status:
          type: string
          enum:
            - open
            - part_paid
            - paid
            - expired
            - cancelled
            - failed
          description: >-
            `open`: في انتظار التحويل. `part_paid`: وصل جزء من `total` وأُضيفت
            حصته من الرصيد؛ أرسل `amount_open` مع المرجع نفسه قبل `due_at`.
            `paid`: وصل `total` وأُضيف `credit_amount`. `expired`: انقضى
            `due_at` قبل وصول كامل `total`؛ يبقى ما وصل مضافاً، وأي تحويل يصل
            لاحقاً مع المرجع يُضاف بقدر ما يسدده. `cancelled`: ألغاها شخص من
            لوحة التحكم قبل وصول أي مبلغ (لا يمكن إلغاء الفاتورة بعد وصول
            الأموال). `failed`: تعذّر إصدار الفاتورة، ولم يصدر أي شيء.
        credit_amount:
          type: string
          description: >-
            ما يُضاف إلى الرصيد عند سداد `total` بالكامل، بالدولار الأمريكي، قبل
            الضريبة.
          example: '5000.00'
        total:
          type: string
          description: >-
            ما تطلبه الفاتورة، بالدولار الأمريكي، شاملًا الضريبة. وقد يكون أعلى
            من `credit_amount`.
          example: '5000.00'
        tax:
          type: string
          description: >-
            الضريبة على الفاتورة، بالدولار الأمريكي. تكون `0.00` عندما لا تنطبق
            أي ضريبة.
          example: '5000.00'
        currency:
          type: string
          enum:
            - usd
          description: دائماً `usd`.
        amount_received:
          type: string
          description: ما وصل حتى الآن، بالدولار الأمريكي.
          example: '5000.00'
        amount_credited:
          type: string
          description: >-
            ما أُضيف إلى الرصيد حتى الآن، بالدولار الأمريكي. يُضيف الدفع الجزئي
            رصيدًا بنسبة ما يسدّده من `total`: فسداد 550.00 من فاتورة قيمتها
            1,100.00 مقابل رصيد قدره 1,000.00 يضيف 500.00.
          example: '5000.00'
        amount_open:
          type: string
          description: >-
            ما يتبقى إرساله، بالدولار الأمريكي، طالما كانت `status` إما `open`
            أو `part_paid`: حوّل هذا المبلغ بالضبط، مع `invoice_number` مرجعًا.
            تجاهله بعد إغلاق الفاتورة.
          example: '5000.00'
        presented:
          type: object
          nullable: true
          description: دائماً null لفاتورة شحن الرصيد.
          properties:
            amount:
              type: string
            currency:
              type: string
        method:
          type: object
          nullable: true
          description: طريقة الدفع، كما يسمّيها سجل الفوترة.
          properties:
            type:
              type: string
              example: customer_balance
            name:
              type: string
              example: Bank transfer
        invoice_number:
          type: string
          nullable: true
          description: >-
            رقم الفاتورة. أدرجه في التحويل مرجعًا، فالتحويل الذي لا يتضمنه لا
            يمكن مطابقته بالفاتورة.
        hosted_invoice_url:
          type: string
          format: uri
          nullable: true
          description: صفحة الفاتورة، وتتضمن بيانات الحساب المصرفي.
        invoice_pdf:
          type: string
          format: uri
          nullable: true
          description: الفاتورة بصيغة PDF.
        po_number:
          type: string
          nullable: true
          description: رقم أمر الشراء المطبوع على الفاتورة، إن أُرسل.
        due_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            تاريخ الاستحقاق المذكور في الفاتورة: استخدم هذه القيمة، ولا تحسبها
            بأي معادلة أبدًا. تستحق الفواتير الجديدة بعد 45 يومًا من تاريخ
            إصدارها، أما الفاتورة الصادرة بشروط سابقة فتحتفظ بالتاريخ الذي صدرت
            به. إذا لم يصل `total` كاملًا بحلول ذلك التاريخ، تصبح الحالة
            `expired`، أما الفاتورة المدفوعة فتبقى `paid`.
        confirmed_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            وقت تأكيد آخر تحويل، بما فيه الدفع الجزئي. وهذا لا يعني أن الفاتورة
            مسوّاة، فاقرأ `status` و`amount_open`.
        closed_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            وقت فشل الفاتورة أو انتهائها أو إلغائها. تكون القيمة فارغة (null)
            للفاتورة المفتوحة أو المدفوعة جزئيًا أو المدفوعة.
        failure_reason:
          type: string
          nullable: true
          description: سبب الفشل أو انتهاء الصلاحية، ومتى حدث ذلك.
        created_at:
          type: string
          format: date-time
          description: متى صدر.
        bank_details:
          type: object
          nullable: true
          description: >-
            وجهة إرسال الأموال، طالما تقبل الفاتورة التحويلات (`open` أو
            `part_paid`). تكون القيمة null بعد إغلاق الفاتورة، وكذلك عندما يتعذر
            قراءة بيانات الحساب البنكي في الوقت الحالي، وفي هذه الحالة استخدم
            `hosted_invoice_url` الذي يعرضها أيضاً. لا يُدرج هذا الحقل ضمن
            `open_invoice` في حالة الخطأ.
          required:
            - currency
            - amount_due
            - account_holder_name
            - bank_name
            - account_number
            - routing_number
            - swift_code
            - reference
          properties:
            currency:
              type: string
              description: دائماً `USD`.
            amount_due:
              type: string
              description: ما يجب إرساله، بالدولار الأمريكي، وهو نفس `amount_open`.
            account_holder_name:
              type: string
              description: الحساب الذي تُرسل إليه الأموال.
            bank_name:
              type: string
              description: البنك المستلِم.
            account_number:
              type: string
              description: رقم الحساب المستلِم.
            routing_number:
              type: string
              description: لتحويلات ACH والتحويلات البنكية الأمريكية (wire).
            swift_code:
              type: string
              description: للتحويلات الدولية.
            reference:
              type: string
              description: رقم الفاتورة. يجب أن يُذكر في التحويل.
    TopUpInvoiceFieldErrors:
      type: object
      description: 'خطأ في حقل: كل حقل طلب غير صالح مع رسائله، مثل مبلغ أقل من \$1,000.'
      additionalProperties:
        type: array
        items:
          type: string
      example:
        amount_in_dollars:
          - A bank transfer top-up must be at least $1,000
    TopUpInvoiceError:
      type: object
      description: نص الخطأ لطلب فاتورة شحن رصيد.
      required:
        - code
        - detail
      properties:
        code:
          type: string
          enum:
            - idempotency_key_required
            - billing_details_required
            - top_up_invoice_open
            - idempotency_key_conflict
            - top_up_not_allowed
            - top_up_not_completed
            - billing_customer_missing
            - billing_not_available
            - top_up_not_found
            - payment_provider_error
          description: رمز خطأ ثابت.
        detail:
          type: string
          description: شرح مقروء للإنسان.
        missing:
          type: array
          items:
            type: string
          description: >-
            في حالة `billing_details_required`: تفاصيل الفوترة التي لا يزال
            يتعين حفظها، مثل `legal_name` أو `address.line1`.
        open_invoice:
          description: >-
            في حالة `top_up_invoice_open`: الفاتورة المفتوحة أو المدفوعة جزئيًا،
            دون `bank_details` (اقرأها للحصول عليها). تكون القيمة فارغة (null)
            إذا أُغلقت قبل كتابة الإجابة، وعندها أنشئ الفاتورة من جديد.
          oneOf:
            - $ref: '#/components/schemas/BillingTopUpInvoice'
            - $ref: '#/components/schemas/TopUpInvoiceNoOpenInvoice'
    TopUpInvoiceDetailError:
      type: object
      description: >-
        رفض يحتوي على `detail` فقط: بيانات اعتماد منتهية الصلاحية أو ملغاة
        (401)، أو مفتاح مفقود أو إذن لا تملكه بيانات الاعتماد (403)، أو نص ليس
        JSON صالحاً (400).
      required:
        - detail
      additionalProperties: false
      properties:
        detail:
          type: string
          description: شرح مقروء للإنسان.
    RateLimitBudgetError:
      type: object
      description: >-
        تُرجع فقط عند رفض ميزانية وسيط تحديد المعدل. أخطاء 429 الأخرى، بما في
        ذلك تعارضات idempotency والحدود الخاصة بنقطة النهاية، لا تضمن هذه الحقول
        الوصفية.
      required:
        - detail
        - reference
        - limit
        - remaining
        - reset
        - window_seconds
      properties:
        detail:
          type: string
          description: رسالة رفض الميزانية الحالية المقروءة للإنسان.
        reference:
          type: string
          pattern: ^RL-[0-9a-f]{32}$
          description: >-
            مرجع الدعم المعتم: RL- متبوعة بـ 32 حرفًا سداسيًا عشريًا صغيرًا من
            UUID.
        limit:
          type: integer
          description: الميزانية للنطاق الذي تجاوز الحد؛ تساوي X-RateLimit-Limit.
        remaining:
          type: integer
          minimum: 0
          description: >-
            الميزانية المتبقية، محدودة بحيث لا تقل عن الصفر؛ تساوي
            X-RateLimit-Remaining.
        reset:
          type: integer
          format: int64
          description: >-
            وقت إعادة تعيين النافذة بالثواني منذ حقبة Unix، ويساوي
            X-RateLimit-Reset.
        window_seconds:
          type: integer
          description: >-
            مدة النافذة الثابتة بالثواني، وليست الفترة المتبقية للانتظار. يجب
            احترام Retry-After قبل إعادة المحاولة.
      example:
        detail: >-
          Write request rate limit exceeded. You can make up to 300 requests per
          minute.
        reference: RL-00000000000040008000000000000001
        limit: 300
        remaining: 0
        reset: 1794358860
        window_seconds: 60
    TopUpInvoiceNoOpenInvoice:
      description: 'لا توجد فاتورة: أُغلقت الفاتورة المفتوحة قبل كتابة الإجابة.'
      enum:
        - null
      nullable: true
  headers:
    BudgetRetryAfter:
      description: >-
        عدد الثواني للانتظار، مقرّباً إلى أعلى حتى بداية النافذة التالية. يظهر
        في حالات رفض ميزانية الوسيط.
      schema:
        type: integer
    BudgetXRateLimitScope:
      description: النطاق الذي تجاوز ميزانيته. يظهر في حالات رفض ميزانية الوسيط.
      schema:
        type: string
    BudgetXRateLimitLimit:
      description: >-
        الميزانية المخصصة للنطاق الذي تم تجاوزه؛ وتساوي حد جسم الطلب. تظهر في
        حالات الرفض الصادرة عن ميزانية البرمجية الوسيطة.
      schema:
        type: integer
    BudgetXRateLimitRemaining:
      description: >-
        الميزانية المتبقية، محدودة بحيث لا تقل عن الصفر؛ تساوي remaining في
        الجسم. تظهر في حالات رفض الميزانية من الوسيط.
      schema:
        type: integer
    BudgetXRateLimitReset:
      description: >-
        وقت إعادة التعيين بالثواني منذ حقبة Unix؛ يساوي قيمة reset في جسم
        الاستجابة. يظهر في حالات رفض ميزانية الوسيط.
      schema:
        type: integer
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        مفتاح API الخاص بتطبيقك، ويمكن الحصول عليه من Developers -> API keys في
        Business Console. يملك المفتاح الأساسي صلاحية وصول كاملة. يمكن تقييد
        المفتاح المسمّى: بلا صلاحية، أو قراءة، أو كتابة لكل مورد، ويمكن قصره على
        بعض سير العمل أو على الجلسات المعتمدة، وعلى قائمة من عناوين IP، وعلى
        تاريخ انتهاء. يعني الرمز 401 أن المفتاح غير صحيح أو ملغى أو منتهي
        الصلاحية. ويعني الرمز 403 أنه لم يُرسل أي مفتاح، أو أن المفتاح لا يملك
        صلاحية لهذا المورد أو الإجراء، أو أن الطلب صدر من عنوان خارج قائمة IP
        الخاصة به. ويعني الرمز 404 على مسار جلسة أن الجلسة خارج سير عمل المفتاح
        أو حالاته المسموح بها. يتلقى المفتاح الذي لا يملك وصولًا إلى الوسائط
        عناوين URL للصور والفيديو وملفات PDF بقيمة null، ويتلقى المفتاح الذي لا
        يملك صلاحية كتابة الجلسات روابط الجلسات والرموز بقيمة null. راجع
        https://docs.didit.me/console/api-keys.
    BearerAuth:
      type: http
      scheme: bearer
      description: رمز الوصول الخاص بالتطبيق، المستند إلى بيانات اعتماد العميل.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.