![]() <?php /* Example code for using the SOAP extensions in PHP 5.x, with the SecurePayTech SOAP webservices Note: You will likely need to have the cURL extension installed in PHP in order to use access the webservice via https Note: Using WSDL mode with PHP 5.0.1 or previous will crash PHP. 5.0.2 or above is fine. */ $merchantID = "YOUR_VPS_MERCHANT_ID_HERE"; $merchantKey = "YOUR_PASSKEY_HERE"; /* Set up the SOAP Client, using the WSDL method */ $client = new SoapClient('https://tx.securepaytech.com:8443/web/SoapPurchase?wsdl',array( 'uri' => 'http://tx.securepaytech.com', 'use' => SOAP_ENCODED, 'style' => SOAP_RPC)); /* Use the following code to set up the SOAP Client in non-WSDL mode */ //$client = new SoapClient(null, array('location' => 'https://tx.securepaytech.com:8443/web/SoapPurchase', // 'uri' => 'http://tx.securepaytech.com', // 'use' => SOAP_ENCODED, // 'style' => SOAP_RPC)); $merchantID = "YOUR_VPS_MERCHANT_ID_HERE"; $merchantKey = "YOUR_PASSKEY_HERE"; $orderRef = "TestSoapOrder"; $amount = 120.00; $currency = "NZD"; $cardType = 1; //Visa $cardNumber = "4987-6543-2109-8769" $cardExpiry = "0607" $cardHolder = "Test CC Holder"; try { //Perform the SOAP method call $result = $client->purchase($merchantID,$merchantKey,$orderRef, $amount,$currency, $cardType,$cardNumber,$cardExpiry,$cardHolder); } catch (SoapFault $f) { echo $f->getMessage(); echo "<br />"; echo $f->faultcode; echo "<br />"; echo $f->faultstring; echo "<br />"; print_r($f->getTrace()); } echo "resultCode: " . $result->resultCode . "<br />"; echo "merchTxnRef: " . $result->merchTxnRef . "<br />"; echo "transactionNo: " . $result->transactionNo . "<br />"; echo "receiptNo: " . $result->receiptNo . "<br />"; echo "authorizationID: " . $result->authorizationID . "<br />"; echo "batchNo: " . $result->batchNo . "<br />"; echo "failReason: " . $result->failReason . "<br />"; echo "<br />"; ?> |