Spaces:
Running
Running
Ctrl+K
<?php // بيانات PayTabs $server_key = 'PUT_YOUR_SERVER_KEY_HERE'; $profile_id = 'PUT_YOUR_PROFILE_ID_HERE'; $customer_name = $_POST['customer_name']; $email = $_POST['email']; $phone = $_POST['phone']; $amount = $_POST['amount']; $currency = $_POST['currency']; $reason = $_POST['reason']; // بيانات الطلب $data = array( "profile_id" => $profile_id, "tran_type" => "sale", "tran_class" => "ecom", "cart_id" => uniqid("cart_"), "cart_description" => $reason, "cart_currency" => $currency, "cart_amount" => $amount, "callback" => "https://yourdomain.com/callback.php", "return" => "https://yourdomain.com/thank_you.php", "customer_details" => array( "name" => $customer_name, "email" => $email, "phone" => $phone, "street1" => "شارع", "city" => "مدينة", "state" => "منطقة", "country" => "SA", "zip" => "12345", "ip" => $_SERVER['REMOTE_ADDR'] ) ); // تنفيذ الطلب $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://secure.paytabs.com/payment/request"); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "authorization: $server_key", "content-type: application/json" )); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); if (isset($result['redirect_url'])) { header("Location: " . $result['redirect_url']); exit; } else { echo "فشل إنشاء عملية الدفع: "; print_r($result); } ?> - Follow Up Deployment
128f2d2 verified