I'm having trouble, and I think it is the way I'm deploying the code. I'm thinking it can't find the SDK or something. Here is the code snippet, which is based on the sample PHP code for doing a payment transaction:
<?php
require './sdk-php/autoload.php';
require_once './credentials.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
define("AUTHORIZENET_LOG_FILE", "phplog");
function createAnAcceptPaymentTransaction($amount)
{
/* Create a merchantAuthenticationType object with authentication details
retrieved from the constants file */
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
$merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
// Set the transaction's refId
$refId = 'ref' . time();
$dataDesc = $_POST['dataDescriptor'];
$dataVal = $_POST['dataValue'];
$Amount = $_POST['Amount']
// Create the payment object for a payment nonce
$opaqueData = new AnetAPI\OpaqueDataType();
$opaqueData->setDataDescriptor($dataDesc);
$opaqueData->setDataValue($dataVal);
I get the following error referring to the line above where it creates the $opaqueData object:
Parse error: syntax error, unexpected '$opaqueData' (T_VARIABLE) in .../test_auth_process.php on line 24.
What I have is my code in the root of my website. I've copied the SDK-PHP folder to that same folder, and I reference the Autoload, as instructed. I did rename the top level folder from sdk-php-2.0.0 to just sdk-php, as I'm thinking there might be updates at some point. I've tried it looking just for Require 'sdk-php/autoload.php' and './sdk-php/autoload.php', with the same error.
Can anybody spot what I'm doing wrong?
Thanks in advance.
02-06-2019 07:43 AM
Can anybody tell me what support files are needed when using PHP sample code? Is there a complete sample application that can be copied, so I can see what support files are needed, and where they need to be put?
Thank you.
02-07-2019 12:32 PM
02-07-2019 03:50 PM
02-07-2019 03:55 PM