관리-도구
편집 파일: pay.php
<?php require('../admin/process/config.php'); require('config.php'); require('razorpay-php/Razorpay.php'); $pid = $_GET['pid']; $sql ="SELECT * FROM quote WHERE id='$pid'"; $result = $conn->query($sql); $row = $result->fetch_assoc(); if($row) { $amount = $row['amount']; $Project= $row['project']; $quotation= $row['quotation']; $product= $row['product']; } //$amount = 100; $name = $_GET['name']; $email = $_GET['email']; $phone = $_GET['phone']; use Razorpay\Api\Api; $api = new Api($keyId, $keySecret); $orderData = [ 'receipt' => 3456, 'amount' => $amount * 100, // 2000 rupees in paise 'currency' => 'INR', 'payment_capture' => 1 // auto capture ]; $razorpayOrder = $api->order->create($orderData); $razorpayOrderId = $razorpayOrder['id']; $_SESSION['razorpay_order_id'] = $razorpayOrderId; $displayAmount = $amount = $orderData['amount']; if ($displayCurrency !== 'INR') { $url = "https://api.fixer.io/latest?symbols=$displayCurrency&base=INR"; $exchange = json_decode(file_get_contents($url), true); $displayAmount = $exchange['rates'][$displayCurrency] * $amount / 100; } $checkout = 'manual'; if (isset($_GET['checkout']) and in_array($_GET['checkout'], ['automatic', 'manual'], true)) { $checkout = $_GET['checkout']; } $data = [ "key" => $keyId, "amount" => $amount, "name" => $name, "description" => "User", "image" => "../assets/img/logo.png", "prefill" => [ "name" => $name, "email" => $email, "contact" => $phone, ], "notes" => [ "address" => "Hello World", "merchant_order_id" => "12312321", ], "theme" => [ "color" => "#F37254" ], "order_id" => $razorpayOrderId, ]; if ($displayCurrency !== 'INR') { $data['display_currency'] = $displayCurrency; $data['display_amount'] = $displayAmount; } $json = json_encode($data); require("checkout/{$checkout}.php");