Pay By Credit Card
Please enter your required invoice details:
Please enter your required invoice details:
[insert_php]
#******************************************************************************
#* Name : PxPay_Sample_Curl.php
#* Description : Direct Payment Solutions Payment Express PxPay PHP cURL Sample
#* Copyright : Direct Payment Solutions 2009(c)
#* Date : 2009-10-21
#* References : http://www.paymentexpress.com/technical_resources/ecommerce_hosted/pxpay.html
#*@version : 1.0
#* Author : Thomas Treadwell
#******************************************************************************
# This file is a sample demonstrating integration with the PxPay interface using PHP with the cURL extension installed.
#Inlcude PxPay objects
include (“/home/ccnzsite/public_html/PxPay.php”);
$PxPay_Url = “https://sec.windcave.com/pxaccess/pxpay.aspx”;
$PxPay_Userid = “ChorusCallNZ2”; #Important! Update with your UserId
$PxPay_Key = “0eb7751ca9fc0485edcb37132e1f49ab4b75ca7ae3b80e73a04b2922c2a31e4b”; #Important! Update with your Key
#
# MAIN
#
$pxpay = new PxPay_Curl( $PxPay_Url, $PxPay_Userid, $PxPay_Key );
if (isset($_REQUEST[“result”]))
{
# this is a redirection from the payments page.
print_result($pxpay);
}
elseif (isset($_POST[“submit”])) #isset($_REQUEST[“Submit”])
{
# this is a post back — redirect to payments page.
redirect_form($pxpay);
}
else
{
# this is a fresh request — display the purchase form.
print_form();
}
#******************************************************************************
# This function receives information back from the payments page,
# and displays it to the user.
#******************************************************************************
function print_result($pxpay)
{
$enc_hex = $_REQUEST[“result”];
#getResponse method in PxPay object returns PxPayResponse object
#which encapsulates all the response data
$rsp = $pxpay->getResponse($enc_hex);
# the following are the fields available in the PxPayResponse object
$Success = $rsp->getSuccess(); # =1 when request succeeds
$AmountSettlement = $rsp->getAmountSettlement();
$AuthCode = $rsp->getAuthCode(); # from bank
$CardName = $rsp->getCardName(); # e.g. “Visa”
$CardNumber = $rsp->getCardNumber(); # Truncated card number
$DateExpiry = $rsp->getDateExpiry(); # in mmyy format
$DpsBillingId = $rsp->getDpsBillingId();
$BillingId = $rsp->getBillingId();
$CardHolderName = $rsp->getCardHolderName();
$DpsTxnRef = $rsp->getDpsTxnRef();
$TxnType = $rsp->getTxnType();
$TxnData1 = $rsp->getTxnData1();
$TxnData2 = $rsp->getTxnData2();
$TxnData3 = $rsp->getTxnData3();
$SurchargeOrg = $rsp->getTxnData2()*0.03;
$SurchargeRounded = number_format((float)$SurchargeOrg, 2, ‘.’, ”);
$CurrencySettlement= $rsp->getCurrencySettlement();
$ClientInfo = $rsp->getClientInfo(); # The IP address of the user who submitted the transaction
$TxnId = $rsp->getTxnId();
$CurrencyInput = $rsp->getCurrencyInput();
$EmailAddress = $rsp->getEmailAddress();
$MerchantReference = $rsp->getMerchantReference();
$ResponseText = $rsp->getResponseText();
$TxnMac = $rsp->getTxnMac(); # An indication as to the uniqueness of a card used in relation to others
if ($rsp->getSuccess() == “1”)
{
$result = “The transaction was successful.”;
# Sending invoices/updating order status within database etc.
if (!isProcessed($TxnId))
{
# Send emails, generate invoices, update order status etc.
}
}
else
{
$result = “The transaction was declined.”;
}
print <<
Chorus Call New Zealand
|
|
|---|---|
|
|
|
| Print The Receipt | |
|
|
|
| $result | |
| Company Name: | $TxnData1 |
| Accoutn Number: | $TxnData3 |
| Invoice Number(s): | $MerchantReference |
| Total (Inc. GST): | $TxnData2 |
| Surcharge (3%): | $SurchargeRounded |
| Total Charge: | $AmountSettlement |
| Please call us if you need any assistance on 0800 453 630 or Email nzsupport@choruscall.com |
|