【问题标题】:Creating a basic pay now button for sagepay gateway为 sagepay 网关创建一个基本的立即付款按钮
【发布时间】:2012-08-24 11:40:19
【问题描述】:

我有一个客户注册了 sagepay 帐户。他目前的网站使用 wordpress 3.0,目前没有任何电子商务功能。

他需要一个按钮,让用户可以通过 sagepay 提交 300 英镑的押金(这个金额永远不会改变)。 (通常情况下,我会建议使用 paypal 进行此类操作,但显然由于他的业务的旅行性质,paypal 不会让我的客户拥有专业帐户)

我已经查看了 3 月份 (How Do I Make a SagePay BuyNow Button?) 的类似线程中描述的方法,但我不确定如何在 wordpress 的页面中实现这一点,对 php bar 基本知识不太了解模板编辑,所以我完全迷失在 $PAYMENT_CRYPT 部分。

如果有人能提供我需要采取的步骤来实现每次提交相同金额的基本按钮,然后在将所有卡详细信息/客户详细信息发送到 sagepay 网关后收集它们,我们将不胜感激!

【问题讨论】:

    标签: button opayo


    【解决方案1】:

    简而言之,没有。这些不是解决这个问题的简单方法。除非您链接到 SagePay 的付款表单并使用新的 IFRAME 功能。您可以在 WordPress 中包含允许在模板页面或模板文件上使用 PHP 代码的某些信息。

    1 - 在您的 PHP 服务器中对表单进行 IFRAME 并自行对表单进行编码,这样 CSS 就会像 WordPress 页面上的 CSS 一样

    2 - 为它创建一个支付模块

    3 - 为 WordPress 使用现有的支付电子商务服务器模块 - 已经有很多插件

    4 - 创建一个支付按钮超链接,点击后,它会转到您服务器上的 PHP 表单,金额为 300 英镑。

    5 - 使用 Nochex 或其他支付供应商、谷歌钱包等(这对客户来说不是一个简单的选择)

    使用 FORM,您可以:

    <? 
    
    # Define your vars
    
    $serverLive="https://live.sagepay.com/gateway/service/vspform-register.vsp"
    //$serverLive="https://test.sagepay.com/gateway/service/vspform-register.vsp"
    $YOUR_VENDOR_LOGIN_NAME="";
    $VendorTxCode="406227821909";
    $Amount="350.00";
    $Currency="GBP";
    $Description="1 ACME Widget";
    $SuccessURL="http://example.com/success.php";
    $FailureURL="http://example.com/fail.php";
    $BillingSurname="Smith";
    $BillingFirstnames="John";
    $BillingAddress1="123 Main Street";
    $BillingCity="Anywhere";
    $BillingPostCode="29555";
    $BillingCountry="USA";
    $DeliverySurname="Smith";
    $DeliveryFirstnames="John";
    $DeliverAddress1="123 Main Street";
    $DeliveryCity="Anywhere";
    $DeliveryPostCode="29555";
    $DeliveryCountry="GBP";
    
    # The address information can be done via jQuery on your page or get some defaults
    
    ?>
    <form action="<?=$serverLive?>" method="POST" id="SagePayForm" name="SagePayForm">
        <input type="hidden" name="VPSProtocol" value="2.23" />
        <input type="hidden" name="TxType" value="PAYMENT" />
        <input type="hidden" name="Vendor" value="<?= $YOUR_VENDOR_LOGIN_NAME ?>" />
        <input type="hidden" name="Crypt" value="<?= $PAYMENT_CRYPT ?>">    
        <input type="image" src="images/buynow-sagepay.png" />
    </form>
    <script type="text/javascript">
    function submitform()
    {
      document.SagePayForm.submit();
    }
    submitform();
    </script>
    

    即使使用此代码,您仍需要使用一些 SagePay 库,例如 XOR 和 Crypt 函数:

    // Crypt and XOR functions
    private function simpleXor($string, $password) {
        $data=array();
        for ($i=0; $i < utf8_strlen($password); $i++) {
            $data[$i]=ord(substr($password, $i, 1));
        }
        $output='';
        for ($i=0; $i < utf8_strlen($string); $i++) {
        $output .= chr(ord(substr($string, $i, 1)) ^ ($data[$i % utf8_strlen($password)]));
        }
        return $output;     
    }
    

    【讨论】:

    • 你的 $serverLive 应该有 ;在它之后,你没有说如何包含 // Crypt 和 XOR 函数
    猜你喜欢
    • 1970-01-01
    • 2014-02-27
    • 2015-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-20
    • 2020-05-08
    相关资源
    最近更新 更多