function psigate_capture($params) { global $remote_ip; $psi = new PsiGatePayment(); if ($params['testmode'] == "on") { $psi->setGatewayURL("https://dev.psigate.com:7989/Messenger/XMLMessenger"); } else { $psi->setGatewayURL("https://secure.psigate.com:7934/Messenger/XMLMessenger"); } $psi->setStoreID($params['storeid']); $psi->setPassPhrase($params['passphrase']); $psi->setOrderID($params['invoiceid']); $psi->setPaymentType("CC"); $psi->setCardAction("0"); $psi->setSubTotal($params['amount']); $psi->setCardNumber($params['cardnum']); $psi->setCardExpMonth(substr($params['cardexp'], 0, 2)); $psi->setCardExpYear(substr($params['cardexp'], 2, 2)); $psi->setUserID($params[]); $psi->setBname($params['clientdetails']['firstname'] . " " . $params['clientdetails']['lastname']); $psi->setBcompany($params['clientdetails']['companyname']); $psi->setBaddress1($params['clientdetails']['address1']); $psi->setBaddress2($params['clientdetails']['address2']); $psi->setBcity($params['clientdetails']['city']); $psi->setBprovince($params['clientdetails']['state']); $psi->setBpostalCode($params['clientdetails']['postcode']); $psi->setBcountry($params['clientdetails']['country']); $psi->setSname($params['clientdetails']['firstname'] . " " . $params['clientdetails']['lastname']); $psi->setScompany($params['clientdetails']['companyname']); $psi->setSaddress1($params['clientdetails']['address1']); $psi->setSaddress2($params['clientdetails']['address2']); $psi->setScity($params['clientdetails']['city']); $psi->setSprovince($params['clientdetails']['state']); $psi->setSpostalCode($params['clientdetails']['postcode']); $psi->setScountry($params['clientdetails']['country']); $psi->setPhone($params['clientdetails']['phonenumber']); $psi->setEmail($params['clientdetails']['email']); $psi->setComments(""); $psi->setCustomerIP($remote_ip); if ($params['cccvv']) { $psi->setCardIDCode("1"); $psi->setCardIDNumber($params['cccvv']); } $psi_xml_error = !($psi->doPayment() == PSIGATE_TRANSACTION_OK); $desc = "Action => Capture\nClient => " . $params['clientdetails']['firstname'] . " " . $params['clientdetails']['lastname'] . "\n"; $desc .= "Transaction Time => " . $psi->myResultTrxnTransTime . "\n"; $desc .= "Order ID => " . $psi->myResultTrxnOrderID . "\n"; $desc .= "Approved => " . $psi->myResultTrxnApproved . "\n"; $desc .= "Return Code => " . $psi->myResultTrxnReturnCode . "\n"; $desc .= "Error Message => " . $psi->myResultTrxnErrMsg . "\n"; $desc .= "Total => " . $psi->myResultTrxnFullTotal . "\n"; $desc .= "Payment Type => " . $psi->myResultTrxnPaymentType . "\n"; $desc .= "Card Number => " . $psi->myResultTrxnCardNumber . "\n"; $desc .= "Expiry Month => " . $psi->myResultTrxnCardExpMonth . "\n"; $desc .= "Expiry Year => " . $psi->myResultTrxnCardExpYear . "\n"; $desc .= "Reference Number => " . $psi->myResultTrxnTransRefNumber . "\n"; $desc .= "Card ID Result => " . $psi->myResultTrxnCardIDResult . "\n"; $desc .= "AVS Result => " . $psi->myResultTrxnAVSResult . "\n"; $desc .= "Card Auth Number => " . $psi->myResultTrxnCardAuthNumber . "\n"; $desc .= "Card Ref Number => " . $psi->myResultTrxnCardRefNumber . "\n"; $desc .= "Card Type => " . $psi->myResultTrxnCardType . "\n"; $desc .= "IP Result => " . $psi->myResultTrxnIPResult . "\n"; $desc .= "IP Country => " . $psi->myResultTrxnIPCountry . "\n"; $desc .= "IP Region => " . $psi->myResultTrxnIPRegion . "\n"; $desc .= "IP City => " . $psi->myResultTrxnIPCity . "\n"; $desc .= "Error => " . $psi->myError . "\n"; $desc .= "Error Message => " . $psi->myErrorMessage . "\n"; if ($psi->myResultTrxnApproved == "APPROVED") { return array("status" => "success", "transid" => $psi->myResultTrxnTransRefNumber, "rawdata" => $desc); } if ($psi->myResultTrxnApproved == "DECLINED") { return array("status" => "declined", "rawdata" => $desc); } return array("status" => "error", "rawdata" => $desc); }