将定期付款表单与我的网关集成(wordpress)

时间:2017-01-12 01:37:31

标签: javascript php html wordpress payment-gateway

这是我的代码。

我一直在努力弄清楚如何链接到我的支付网关,并将所有内容标记化。以及收集所有这些信息..?任何帮助者都非常感激。

我的主要问题是连接到我的网关。

基本上只是给出了这个指南来解决所有问题:http://redfinpos.com/wp-content/uploads/RedFin-Developer-Manual-V.2.07.0415-a.pdf        JUST UPDATED CODE包含ajax

<script
  src="https://code.jquery.com/jquery-3.1.1.js"
  integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA="
  crossorigin="anonymous"></script>

<script type="text/javascript">
  function startPayment(){
    var paymentData = {
      username : $('#Username').val(),
      password : $('#Password').val(),
      vendor   : $('#Vendor').val(),
      customerID: $('#CustomerID').val(),
      contractID: $('#ContractID').val(),
      billAmt   : $('#BillAmt').val(),
      taxAmt    : $('#TaxAmt').val(),
      totalAmt  : $('#TotalAmt').val(),
      startDate : $('#StartDate').val(),
      billingPeriod:$('#BillingPeriod').val(),
      billingInterval:$('#BillingInterval').val(),
      ccAccountNum:$('#AaAccountNum').val(),
      ccExpDate : $('#CcExpDate').val(),
      ccNameOnCard:$('#CcNameOnCard').val(),
      ccStreet    :$('#CcStreet').val(),
      ccZip       :$('#CcZip').val()

    }

    $.ajax({
      type : "POST",
      url : 'http://www.secure.redfinnet.com/admin/ws/recurring.asmx/AddRecurringCreditCard',
      data: startPayment,
      dataType: "jsonp",
      success: function(obj){console.log(obj)}

    })


   // alert(JSON.stringify(paymentData))
  }
</script>

<form>                        
  <table cellspacing="0" cellpadding="4" frame="box" bordercolor="#dcdcdc" rules="none" style="border-collapse: collapse;">
  <tbody><tr>
	<td class="frmHeader" background="#dcdcdc" style="border-right: 2px solid white;">Recurring Payments</td>
	<td class="frmHeader" background="#dcdcdc">Recurring Payments</td>
</tr>

                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">Username:</td>
                            <td><input class="frmInput" type="text" size="50" id="Username"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">Password:</td>
                            <td><input class="frmInput" type="text" size="50" id="Password"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">Vendor:</td>
                            <td><input class="frmInput" type="text" size="50" id="Vendor"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">CustomerID:</td>
                            <td><input class="frmInput" type="text" size="50" id="CustomerID"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">ContractID:</td>
                            <td><input class="frmInput" type="text" size="50" id="ContractID"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">BillAmt:</td>
                            <td><input class="frmInput" type="text" size="50" id="BillAmt"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">TaxAmt:</td>
                            <td><input class="frmInput" type="text" size="50" id="TaxAmt"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">TotalAmt:</td>
                            <td><input class="frmInput" type="text" size="50" id="TotalAmt"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">StartDate:</td>
                            <td><input class="frmInput" type="text" size="50" id="StartDate"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">BillingPeriod:</td>
                            <td><input class="frmInput" type="text" size="50" id="BillingPeriod"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">BillingInterval:</td>
                            <td><input class="frmInput" type="text" size="50" id="BillingInterval"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">CcAccountNum:</td>
                            <td><input class="frmInput" type="text" size="50" id="CcAccountNum"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">CcExpDate:</td>
                            <td><input class="frmInput" type="text" size="50" id="CcExpDate"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">CcNameOnCard:</td>
                            <td><input class="frmInput" type="text" size="50" id="CcNameOnCard"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">CcStreet:</td>
                            <td><input class="frmInput" type="text" size="50" id="CcStreet"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">CcZip:</td>
                            <td><input class="frmInput" type="text" size="50" id="CcZip"></td>
                          </tr>
                        
                        <tr>
                          <td></td>
                          <td align="center"> <input type="submit" onClick="startPayment()" value="Submit" class="button"></td>
                        </tr>
                        </tbody></table>
                      

                    </form>

1 个答案:

答案 0 :(得分:1)

我不确定它是不是类型,但你在AJAX调用中有:

data: startPayment,

这是假设

data: paymentData,

我还会在你的AJAX调用上添加一个错误处理程序,所以最后的调用看起来像这样:

$.ajax({
  type : "POST",
  url : 'http://www.secure.redfinnet.com/admin/ws/recurring.asmx/AddRecurringCreditCard',
  data: paymentData,
  dataType: "jsonp",
  success: function(obj){console.log(obj);},
  error: function(jqXHR, textStatus, errorThrown) {
    console.log(errorThrown);
    console.log(jqXHR);
  }
});