Hi All--I'm a newbie and looking for a little help in getting started. I have a set of sample scripts from Authorize.net that I am trying to make work on a shared Linux server. Three of these scripts work, two of them--the ones related to credit card information--do not. I am trying to understand what is different about our server that is causing the two scripts to not work. Tech support from my web hosting company thinks that there are one or more extension parameters in the php.ini file that need to be changed. Authorize.net has been completely non-responsive to a week's worth of emails, so I'm turning to ya'll for help.
You can see the scripts in action at https://secure.indexrx.com/index.php (everything is in test mode), and the phpinfo.php is in the same directory.
The scripts pass information to an API, which stores customer information on an Authorize.net server for later retrieval/processing. I am able to create a customer profile, to create a shipping address, and to delete a customer profile. I cannot create a payment profile, however (I get the exception "Object ID #8--or 10 or 7 or 6, etc. if I fiddle with the variables passed to the API).
Here is one of the scripts that is not working (the problem occurs on the "$response = $ws-> line," which is the call to the API):
<?php
include_once ("vars.php");
include_once ("api_authorize_net_soap_v1.php");
include_once ("util.php");
$customerShippingAddressId = NULL;
if (isset($_REQUEST['customerShippingAddressId'])) {
$customerShippingAddressId = $_REQUEST['customerShippingAddressId'];
}
echo "Create payment profile for customerProfileId <b>"
. htmlspecialchars($_POST["customerProfileId"])
. "</b>...<br><br>";
$ws = CreateWSClient();
$req = new CreateCustomerPaymentProfile();
$req->merchantAuthentication = PopulateMerchantAuthentication();
$req->customerProfileId = $_POST["customerProfileId"];
$req->paymentProfile = new CustomerPaymentProfileType();
$req->paymentProfile->billTo = new CustomerAddressType();
$req->paymentProfile->billTo->firstName = "John";
$req->paymentProfile->billTo->lastName = "Doe";
$req->paymentProfile->billTo->phoneNumber = "000-000-0000";
$req->paymentProfile->payment = new PaymentType();
$req->paymentProfile->payment->creditCard = new CreditCardType();
$req->paymentProfile->payment->creditCard->cardNumber = "4111111111111111";
$req->paymentProfile->payment->creditCard->expirationDate = "2020-08"; // required format for API is YYYY-MM
$req->validationMode = "testMode"; // "liveMode";
try {
$response = $ws->CreateCustomerPaymentProfile($req);
//echo "Raw request: " . htmlspecialchars($ws->__getLastRequest()) . "<br><br>";
//echo "Raw response: " . htmlspecialchars($ws->__getLastResponse()) . "<br><br>";
if ("Ok" == $response->CreateCustomerPaymentProfileResult->resultCode) {
echo "customerPaymentProfileId <b>"
. htmlspecialchars($response->CreateCustomerPaymentProfileResult->customerPaymentProfileId)
. "</b> was successfully created for customerProfileId <b>"
. htmlspecialchars($_POST["customerProfileId"])
. "</b>.<br><br>";
} else {
echo "The operation failed with the following errors:<br>";
PrintErrors($response->CreateCustomerPaymentProfileResult);
}
} catch (SoapFault $exception) {
echo $exception . "<br><br>";
}
echo "<br><a href=index.php?customerProfileId="
. urlencode($_POST["customerProfileId"])
. "&customerPaymentProfileId="
. urlencode($response->CreateCustomerPaymentProfileResult->customerPaymentProfileId)
. "&customerShippingAddressId="
. urlencode($customerShippingAddressId)
. ">Continue</a><br>";
?>
For reference, here is a script that does work:
<?php
include_once ("vars.php");
include_once ("api_authorize_net_soap_v1.php");
include_once ("util.php");
echo "create profile...<br><br>";
$ws = CreateWSClient();
$req = new CreateCustomerProfile();
$req->merchantAuthentication = PopulateMerchantAuthentication();
$req->profile = new CustomerProfileType();
$req->profile->merchantCustomerId = "12345"; // Your own identifier for the customer.
$req->profile->description = "some description";
$req->profile->email = $_POST["email"];
try {
$response = $ws->CreateCustomerProfile($req);
//echo "Raw request: " . htmlspecialchars($ws->__getLastRequest()) . "<br><br>";
//echo "Raw response: " . htmlspecialchars($ws->__getLastResponse()) . "<br><br>";
if ("Ok" == $response->CreateCustomerProfileResult->resultCode) {
echo "customerProfileId <b>"
. htmlspecialchars($response->CreateCustomerProfileResult->customerProfileId)
. "</b> was successfully created.<br><br>";
} else {
echo "The operation failed with the following errors:<br>";
PrintErrors($response->CreateCustomerProfileResult);
}
} catch (SoapFault $exception) {
echo $exception . "<br><br>";
}
echo "<br><a href=index.php?customerProfileId="
. urlencode($response->CreateCustomerProfileResult->customerProfileId)
. ">Continue</a><br>";
?>
I hope I haven't scared everyone off by providing too much information. If you have any ideas, please let me know.
If I've left anything out, please let me know that too.
Thanks for the help--a round of virtual beers for everyone who makes an attempt!