<script src="https://secure.na.tnspayments.com/checkout/version/33/checkout.js"
data-error="errorCallback"
data-cancel="cancelCallback">
</script>
<script type="text/javascript">
$(document).ready(function () {
$("#reference").val('@ViewBag.reference');
});
function errorCallback(error) {
console.log(JSON.stringify(error));
}
function cancelCallback() {
console.log('Payment cancelled');
}
Checkout.configure({
merchant: 'TEST1',
order: {
amount: "10",
currency: 'MXN',
description: "Description",
id: "Reference"
},
interaction: {
merchant: {
name: 'Operadora',
address: {
line1: 'Address 1',
line2: 'Address 2'
}
}
}
});
</script>
<div class="container">
<div class="row" style="background-color:#05AED9">
<div style="text-align:center;">
<h2><label style="font-size: 28px !
important;color:white;">@Resources.Resources.LabelPaymentData</label></h2>
</div>
</div>
<div class="row" style="background-color:lightgray;padding-left:5%; padding-right:5%;">
<br />
<div class="form-group">
<label>@Resources.Resources.LabelAmount</label>
<input id="ammount" style="width:100px;" type="text" name="order.amount"
value="0.00" class="form-control">
</div>
<div class="form-group">
<label>@Resources.Resources.LabelDescription</label>
<textarea id="description" style="height: 50px !Important;width: 500px;"
name="transaction.reference" class="form-control"></textarea>
</div>
<div class="form-group">
<label>@Resources.Resources.LabelReference</label>
<input id="reference" style="width:300px;" type="text"
name="order.reference" class="form-control" disabled="disabled">
</div>
<div class="form-group">
<label>@Resources.Resources.LabelEmail</label>
<input style="width:300px;" type="text" name="customer.email" class="form-
control">
</div>
<input class="btn btn-info" type="button" value="@Resources.Resources.NavPayment"
onclick="Checkout.showPaymentPage();" />
<br />
</div>
</div>
当点击按钮调用Checkout.showPaymentPage()并且此函数需要Checkout.configure()..这个答案是如何将输入值“ammount”设置为Checkout.Configure ???金额:“10”喜欢这个数额:$(“#ammount”)。val()..请告知我没有任何想法这样做或如何以其他方式做到这一点..为你的帮助实现
答案 0 :(得分:0)
<script src="https://secure.na.tnspayments.com/checkout/version/33/checkout.js"
data-error="errorCallback"
data-cancel="cancelCallback">
</script>
<script type="text/javascript">
$(document).ready(function () {
$("#reference").val('@ViewBag.reference');
$("#btn-payment").click(function () {
Checkout.configure({
merchant: 'TEST1',
order: {
amount: $("#ammount").val(),
currency: 'MXN',
description: "Description",
id: "Reference"
},
interaction: {
merchant: {
name: 'Operadora',
address: {
line1: 'Address 1',
line2: 'Address 2'
}
}
}
});
Checkout.showPaymentPage();
});
});
function errorCallback(error) {
console.log(JSON.stringify(error));
}
function cancelCallback() {
console.log('Payment cancelled');
}
</script>
<div class="container">
<div class="row" style="background-color:#05AED9">
<div style="text-align:center;">
<h2><label style="font-size: 28px !important;color:white;">@Resources.Resources.LabelPaymentData</label></h2>
</div>
</div>
<div class="row" style="background-color:lightgray;padding-left:5%; padding-right:5%;">
<br />
<div class="form-group">
<label>@Resources.Resources.LabelAmount</label>
<input id="ammount" style="width:100px;" type="text" name="order.amount" class="form-control">
</div>
<div class="form-group">
<label>@Resources.Resources.LabelDescription</label>
<textarea id="description" style="height: 50px !Important;width: 500px;" name="transaction.reference" class="form-control"></textarea>
</div>
<div class="form-group">
<label>@Resources.Resources.LabelReference</label>
<input id="reference" style="width:300px;" type="text" name="order.reference" class="form-control" disabled="disabled">
</div>
<div class="form-group">
<label>@Resources.Resources.LabelEmail</label>
<input style="width:300px;" type="text" name="customer.email" class="form-control">
</div>
<input id="btn-payment" class="btn btn-info" type="button" value="@Resources.Resources.NavPayment" />
<br />
</div>
</div>
这是解决方案:)感谢您的帮助