I've been looking all around and not really finding posts addressing an issue. There might be a simple thing I should know, but newbie here, so bear with me...
I am trying to get a hosted form working with the server integration method. Accept.js requires root access and a VPS, so it's a non-option. From what I've read, SIM is still supported, but there appear to be no working examples with the direct post method.
I have Composer installed and have run the update to get a few SDK examples (charge and refund credit card) working. But, in a perfect world, I would be able to put together a hosted payment form with the direct post method in PHP that allows a split tender (partial transaction). Is this even doable anymore?
I've gotten around the E00001 error code issue. But now I'm getting a bunch of gibberish every time I test the get-hosted-payment-php.
Here's a section of the page, about a third: An+tyYL1oHfNmk4lF0Dy1ltlwleCYxypC3DnZiy3tyw2mPMt5KUZb7Yuq8C2HiInBU9jbVSe0bykIj5rcFv2w9FwpyBcgNF/sMnq02PerLxo5WmvYOXfipPWUxvApS4UF/Snw72hu31dhrqiBcrjf83hxLxr34x7/4Wspr6A3QQKXnROUikzoKru0KFABSGbM7EuswMa2tReyB2aM2BAFKZJjaAyb2/5L40iNM4GLCwSmEEB740ly1QwTfpE3qP08HR
So, currently, I can't even get a hosted payment form to show up. All the dependencies should be good. All the files are linked. What else could I possibly need? And is this feasible? Just read that vendors must store payment gateway account data securely. Can I do that without root access on a shared server and, if so, where and how? This is the current code. Only thing I've done is add a require line to the Constants file. Any insight or direction much appreciated. I imagine this looks very amateur-ish, but in my defense, I have gone from knowing nothing to at least knowing how to set up a few transactions and that our options are limited on shared server, in the 20 or so hours I've put towards this so far. And the instructions available for php SIM without using Accept.js seem pretty much non-existent.
<?php
require 'vendor/autoload.php';
require 'Constants.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
define("AUTHORIZENET_LOG_FILE", "phplog");
function getHostedPaymentPage($customerprofileid = "123212")
{
// Common setup for API credentials
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
$refId = 'ref' . time();
// Create the payment data for a credit card
$creditCard = new AnetAPI\CreditCardType();
$creditCard->setCardNumber("4111111111111111");
$creditCard->setExpirationDate("1226");
$creditCard->setCardCode("123");
$paymentOne = new AnetAPI\PaymentType();
$paymentOne->setCreditCard($creditCard);
$order = new AnetAPI\OrderType();
$order->setDescription("New Item");
//create a transaction
$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setTransactionType( "authCaptureTransaction");
$transactionRequestType->setAmount("12.23");
// Use an existing payment profile ID for this Merchant name and Transaction key
$setting = new AnetAPI\SettingType();
$setting->setSettingName("hostedPaymentButtonOptions");
$setting->setSettingValue("{\"text\": \"Pay\"}");
$setting2 = new AnetAPI\SettingType();
$setting2->setSettingName("hostedPaymentOrderOptions");
$setting2->setSettingValue("{\"show\": false}");
//$alist = new AnetAPI\ArrayOfSettingType();
//$alist->addToSetting($setting);
$request = new AnetAPI\GetHostedPaymentPageRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setTransactionRequest($transactionRequestType);
$request->addToHostedPaymentSettings($setting);
$request->addToHostedPaymentSettings($setting2);
$controller = new AnetController\GetHostedPaymentPageController($request);
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
{
echo $response->getToken()."\n";
}
else
{
echo "ERROR : Failed to get hosted profile page\n";
$errorMessages = $response->getMessages()->getMessage();
echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n";
}
return $response;
}
if(!defined('DONT_RUN_SAMPLES'))
getHostedPaymentPage();
?>