إضافات جاهزة
اربط متجرك الحالي دون كتابة كود.
- WooCommerce
- WHMCS
- OpenCart 3
- OpenCart 4
- PrestaShop
- Magento 2
- Easy Digital Downloads
- FOSSBilling
- PHP SDK
واجهة REST، وإشعارات موقّعة، ومفاتيح تجربة. وشرح بالعربية والإنجليزية.
مثال لكل طلب ورد.
توفّر عليك وقت البرمجة.
يظهر المفتاح مرة واحدة، وتلغيه متى شئت.
من نظامك مباشرة.
واجهة برمجية REST لموقعك، وإضافات جاهزة للمنصات الشائعة، وروابط دفع وفواتير تشاركها برابط، ورمز QR لمحلّك.
POST واحد بالمبلغ ورقم طلبك.checkout_url: صفحة جاهزة بمحفظة بايونت وUSDT والبطاقات، حسب ما تفعّله.invoice.paidWebhook موقّع في الرأس Payunit-Signature. تحقّق منه، ثم سلّم الطلب.وضع تجريبي قبل التشغيل. جرّب كل شيء بمفاتيح pay_test_ قبل التشغيل الفعلي بمفاتيح pay_live_.
curl -X POST https://payunit.co/api/v1/invoices \
-H "Authorization: Bearer pay_live_••••.••••" \
-H "Content-Type: application/json" \
-d '{
"amount": "25.00",
"currency": "USD",
"external_ref": "ORDER-1001",
"description": "Order #1001",
"expires_in": 3600,
"success_url": "https://yourstore.com/thanks",
"cancel_url": "https://yourstore.com/cart",
"metadata": { "customer_id": "4821" }
}'
// 201 Created
{
"id": "inv_8F2kQ…",
"status": "pending",
"amount": "25.00",
"currency": "USD",
"fee": "…",
"net": "…",
"external_ref": "ORDER-1001",
"checkout_url": "https://payunit.co/invoice/inv_8F2kQ…"
}
POST /webhooks/payunit
Payunit-Event-Id: evt_3Hq9…
Payunit-Timestamp: 1761300000
Payunit-Signature: v1=5f1c9a…
{
"id": "evt_3Hq9…",
"event": "invoice.paid",
"created_at": "2025-10-24T10:00:00+00:00",
"data": {
"invoice_id": "inv_8F2kQ…",
"status": "paid",
"amount": "25.00",
"currency": "USD",
"external_ref": "ORDER-1001",
"metadata": { "customer_id": "4821" }
}
}
الرسوم fee والصافي net يُحسبان حسب طريقة الدفع، ويظهران قبل كل دفعة. أحداث أخرى: payment.refunded · refund.review · invoice.reversed · invoice.captured · invoice.voided
اربط متجرك الحالي دون كتابة كود.
أنشئ فاتورة باسم عميلك وشاركها برابط، وأرجع المبلغ له عند الحاجة.
رمز ثابت لنقطة البيع، أو فاتورة بمبلغ محدد. وتقارير يومية وأسبوعية وشهرية.
طلبات حقيقية من واجهة بايونت. غيّر المفتاح والمبلغ وجرّب.
Base URLhttps://payunit.co/api/v1
أرسل المبلغ ورقم طلبك، وخذ رابط صفحة الدفع لعميلك.
POST /invoicescurl
curl -X POST https://payunit.co/api/v1/invoices \
-H "Authorization: Bearer pay_live_3f9a….SECRET" \
-H "Content-Type: application/json" \
-d '{
"amount": "120.00",
"currency": "USD",
"external_ref": "order-1024",
"success_url": "https://shop.example/thanks"
}'
201 Createdالرد
{
"id": "inv_8Kq2Xz4LmT7pRw1c",
"status": "pending",
"amount": "120.00",
"checkout_url": "https://payunit.co/invoice/inv_8Kq2…"
}
اعرف هل دُفعت الفاتورة، وكم وصلك بعد الرسوم.
GET /invoices/{id}curl
curl https://payunit.co/api/v1/invoices/inv_8Kq2Xz4LmT7pRw1c \
-H "Authorization: Bearer pay_live_3f9a….SECRET"
200 OKالرد
{
"status": "paid",
"amount": "120.00",
"fee": "1.50",
"net": "118.50",
"paid_at": "2026-09-30T10:24:11Z"
}
أرجع المبلغ كله أو جزءًا منه لعميلك. مفتاح التكرار يمنع الإرجاع مرتين.
POST /payments/{id}/refundscurl
curl -X POST https://payunit.co/api/v1/payments/48213095517260/refunds \
-H "Authorization: Bearer pay_live_3f9a….SECRET" \
-H "Idempotency-Key: refund-1024-1" \
-d '{ "amount": "40.00", "reason": "Returned item" }'
201 Createdالرد
{
"status": "completed",
"amount": "40.00"
}
بمفتاح pay_test_ تعمل الطلبات نفسها على بيانات تجريبية منفصلة تمامًا. حاكِ دفع الفاتورة التجريبية أو فشله، وتصلك إشعارات موقّعة مثل الحقيقية دون تحريك أي أموال.
POST /invoices/{id}/simulatecurl
# Test key: same address, same requests, no money moves
curl -X POST https://payunit.co/api/v1/invoices/inv_test_8Kq2Xz4LmT7p/simulate \
-H "Authorization: Bearer pay_test_7c1d….SECRET" \
-d '{ "result": "paid" }'
200 OKالرد
{
"id": "inv_test_8Kq2Xz4LmT7p",
"status": "paid",
"environment": "test"
}
تأكد أن الإشعار من بايونت قبل أن تحدّث الطلب في نظامك.
webhook.phpphp
// Verify the signature before trusting the event
$body = file_get_contents('php://input');
$timestamp = $_SERVER['HTTP_PAYUNIT_TIMESTAMP'];
$signature = $_SERVER['HTTP_PAYUNIT_SIGNATURE'];
$expected = 'v1=' . hash_hmac('sha256', $timestamp . '.' . $body, $secret);
if (!hash_equals($expected, $signature)) {
http_response_code(400); exit;
}
$event = json_decode($body, true); // $event['event'] === 'invoice.paid'
حساب شخصي أو حساب أعمال، ورسم كل عملية أمامك قبل أن تؤكد.