<?php require_once("config/config.php"); // Include necessary libraries or dependencies // Set up configuration for the payment gateway $secretKeyspfin= file_get_contents('key/spfinpublickey.txt'); //echo("secretKeyspfin".$secretKeyspfin."<br>"); $gatewayConfig = [ 'apiKey' => $apikey, 'apiSecret' => $secretKeyspfin, // other configuration options ]; print_r($gatewayConfig); $jsongatewayConfig = json_encode($gatewayConfig); var_dump($jsongatewayConfig); $paymentGateway = $jsongatewayConfig; print_r($paymentGateway); // Create an instance of the payment gateway /*$paymentGateway = new PaymentGateway($gatewayConfig); print_r($paymentGateway);*/ // Prepare payment data $paymentData = [ 'amount' => 100.00, // Payment amount 'currency' => 'USD', 'orderId' => '12345', // Unique order ID // other payment data ]; print_r($paymentData); // Initialize the payment $paymentResponse = $paymentGateway->initializePayment($paymentData); // Process the payment response if ($paymentResponse->isSuccess()) { $paymentId = $paymentResponse->getPaymentId(); $paymentRedirectUrl = $paymentResponse->getRedirectUrl(); // Redirect the user to the payment gateway echo($paymentRedirectUrl); //header("Location: $paymentRedirectUrl"); exit; } else { $errorMessage = $paymentResponse->getErrorMessage(); // Handle payment initialization failure } /* // Include necessary libraries or dependencies // Set up configuration for the payment gateway $gatewayConfig = [ 'apiKey' => $apikey, 'apiSecret' => $secretKeyspfin, // other configuration options ]; // Create an instance of the payment gateway $paymentGateway = new PaymentGateway($gatewayConfig); // Get the payment response from the payment gateway callback $paymentResponse = $paymentGateway->processCallback($_POST); // Process the payment response if ($paymentResponse->isSuccess()) { $paymentId = $paymentResponse->getPaymentId(); // Update your system with the payment status // e.g., mark the order as paid } else { $errorMessage = $paymentResponse->getErrorMessage(); // Handle payment processing failure }*/ ?>