我制作了一个简单的结帐页面,当我选择付款方式(PayPal)并点击提交订单时我想将此信息发送给PayPal Direct,请检查此代码:
<script>
function pmet(gateway,style) {
$("#list-group-1 > a").removeClass("active");
$("#"+style).addClass("active");
if (gateway == "PayPal") {
var account = 'PayPal account: <b>admin@me4onkof.info</b>';
} else if(gateway == "Bitcoin") {
var account = 'Bitcoin address: <b>1PRPdegR2hZmb5GNb4z6C2xq9APbnBWpUa</b>';
} else if(gateway == "Skrill") {
var account = 'Skrill account: <b>Skrill@skrill.com</b>';
} else if(gateway == "AdvCash") {
var account = 'AdvCash account: <b>AdvCash@AdvCash.info</b>';
} else if(gateway == "Perfect Money") {
var account = 'Perfect Money account: <b>U9436432</b>';
} else if(gateway == "OKPay") {
var account = 'OKPay account: <b>OK740032174</b>';
} else if(gateway == "Payeer") {
var account = 'Payeer account: <b>P22031700</b>';
} else if(gateway == "Western Union") {
var account = 'Western Union details: <b>NAme , Location: <b>Pakistan, Lahore</b>';
} else if(gateway == "Moneygram") {
var account = 'Moneygram details: <b>Name , Location: <b>Pakistan, Lahore</b>';
} else { }
if(gateway == "PayPal") {
var text = 'Click on <b>"Submit order"</b> to continue payment by PayPal Checkout';
} else {
var text = 'You need to make payment manually and submit order.</b><br/>Will receive your license code and link to download the software up to 1 hour.<br/><br/>Payment details:<br/>'+account+'<br/>Amount: $35<br/>Description: Order BitExchanger v2.0 Script<br><br><div class="form-group"><label>Transaction number/batch</label><input type="text" class="form-control" name="txn_id"></div>';
}
$("#pay_via").val(gateway);
$("#payment_i").html(text);
}
<div class="container mt">
<div class="row">
<div class="col-lg-12">
<form action="" method="POST">
<div class="row">
<div class="col-md-4">
<h4>Select Payment Method</h4>
<div class="list-group" id="list-group-1">
<a href="javascript:void(0);" id="PayPal" onclick="pmet('PayPal','PayPal');" class="list-group-item"><img src="http://www.exchangesoftware.info/buy/assets/icons/PayPal.png" width="30px" height="30px"> PayPal</a>
<a href="javascript:void(0);" id="Bitcoin" onclick="pmet('Bitcoin','Bitcoin');" class="list-group-item"><img src="assets/icons/Bitcoin.png" width="30px" height="30px"> Bitcoin</a>
<a href="javascript:void(0);" id="Skrill" onclick="pmet('Skrill','Skrill');" class="list-group-item"><img src="assets/icons/Skrill.png" width="30px" height="30px"> Skrill</a>
<a href="javascript:void(0);" id="AdvCash" onclick="pmet('AdvCash','AdvCash');" class="list-group-item"><img src="assets/icons/AdvCash.png" width="30px" height="30px"> AdvCash</a>
<a href="javascript:void(0);" id="PerfectMoney" onclick="pmet('Perfect Money','PerfectMoney');" class="list-group-item"><img src="assets/icons/PerfectMoney.png" width="30px" height="30px"> Perfect Money</a>
<a href="javascript:void(0);" id="OKPay" onclick="pmet('OKPay','OKPay');" class="list-group-item"><img src="assets/icons/OKPay.png" width="30px" height="30px"> OKPay</a>
<a href="javascript:void(0);" id="Payeer" onclick="pmet('Payeer','Payeer');" class="list-group-item"><img src="assets/icons/Payeer.png" width="30px" height="30px"> Payeer</a>
<a href="javascript:void(0);" id="WesternUnion" onclick="pmet('Western Union','WesternUnion');" class="list-group-item"><img src="assets/icons/Westernunion.png" width="30px" height="30px"> Western Union</a>
<a href="javascript:void(0);" id="Moneygram" onclick="pmet('Moneygram','Moneygram');" class="list-group-item"><img src="assets/icons/Moneygram.png" width="30px" height="30px"> Moneygram</a>
</div>
</div>
<div class="col-md-4">
<h4>License Information</h4>
<div class="form-group">
<label>Your name</label>
<input type="text" class="form-control" name="name">
</div>
<div class="form-group">
<label>Your email</label>
<input type="text" class="form-control" name="email">
<small>Important: Sometimes hotmail.com and outlook.com skip our emails</small>
</div>
<div class="form-group">
<label>Domains (Eg: exchanger.com,www.exchanger.com)</label>
<input type="text" class="form-control" name="domains">
</div>
<input type="hidden" name="pay_via" id="pay_via">
</div>
<div class="col-md-4">
<h4>Payment Instruction</h4>
<div class="alert alert-info" id="payment_i">
Please select payment method.
</div>
<br>
<button type="submit" class="btn btn-primary btn-block" name="make_order">Submit order</button>
</div>
</div>
</form>
</div>
</div><! --/row -->