我正在尝试将支付网关集成到web应用程序中。我试图调用一个php文件,该文件将重定向到另一个页面。我需要传递一些值给它,然后它应该重定向到支付网关页面。
<form name="payBillForm" id="payBillFormId" ng-submit="paymentGateway()">
<div class="input-group" ng-class="{'has-error': amountEnteredInvalid}" >
<span class="input-group-addon"> <i class="fa fa-rupee"></i>
</span>
<input type="text" class="form-control"
ng-change="testAmountValidity()"
ng-disabled="isPaymentComplete" ng-model="amountPayingNow" >
<button class="btn btn-info" type="submit">Pay</button>
</div>
</form>
控制器:
let formName = document.getElementById('payBillFormId');
let paymentFormData = new FormData(formName);
paymentFormData.append("amount", $scope.amountPayingNow);
paymentFormData.append("email", $scope.payEmailId);
paymentFormData.append("mobile_no", $scope.payContactNo);
paymentFormData.append("invoice", 234);
paymentFormData.append("invoice_amount", $scope.amountPayingNow);
$http({
method: "POST",
url: '../PaymentGateway/index.php',
data: paymentFormData,
ContentType: false
}).then(function successCallback(response) {
console.log(response, "Payrespo");
});
在控制台的响应中,我得到:
"<br />âµ<b>Notice</b>: Undefined index: invoice_amt in <b>C:\xampp\htdocs\myworkspace\AMS\apartment-management-system\PaymentGateway\index.php</b> on line <b>15</b><br />
<?php
require_once('fonepaisa.php');
$invoice_amt = $_REQUEST['invoice_amt'];
$amount = $_REQUEST['amount'];
$email = $_REQUEST['email'];
$mobile_no = $_REQUEST['mobile_no'];
//$invoice = $_REQUEST['invoice'];
fonepaisa_forward(array(
'id'=>'FPTEST',
'merchant_id'=>'FPTEST',
'merchant_display'=>'fonePaisa Test Merchant',
'invoice_amt' => "$invoice_amt",
'amount' => "$amount",
'email'=> "$email",
'mobile_no'=> "$mobile_no",
'callback_url'=>'http://localhost/myworkspace/AMS/apartment-management-system/PaymentGateway/confirm.php',
'callback_failure_url'=>'http://localhost/myworkspace/AMS/apartment-management-system/PaymentGateway/cancel.php',
'invoice'=>'FPORDER'.rand(1,100000000),
'api_key'=>'08Z1782051U62BY9OUGW4XM67GF2004',
'private_key'=>'file://C:\xampp\htdocs\myworkspace\AMS\apartment-management-system\PaymentGateway\priv.pem',
'public_key'=>'',
'is_live_env'=>'N' //The value should be changed to 'Y' when one wants to move to production
));
exit
?>