Creating a basic payment button now for the sagepay gateway

I have a client who signed up for a sagepay account. His current site works with wordpress 3.0 and does not currently have any ecommerce features.

Requires a button that allows users to send a £ 300 deposit through sagepay (this amount never changes). (Usually I suggest using paypal for something similar, but apparently due to the tourist nature of his business, paypal will not allow my client to have a pro account)

Ive reviewed the method described in a similar topic here in March ( How to make a SagePay BuyNow button? ), But I'm not very sure how to implement this within a page on WordPress, not very knowledgeable about the basic php bar template, so I'm completely lost part of $ PAYMENT_CRYPT.

If someone can provide the steps that I must take to implement the main button, which each time represents the same amount, and then collects all the data about the card / client branches after sending them to the sagepay gateway, that would be very appreciated!

+5
source share
1 answer

, . . SagePay IFRAME. WordPress, PHP- .

1 - IFRAME PHP- , CSS CSS WordPress

2 -

3 - eCommerce WordPress -

4 - , PHP 300 .

5 - Nochex , Google .. ( )

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;     
}
+2

All Articles