I successfully update a subscription via this code using the anet_php_sdk:
require_once 'anet_php_sdk/AuthorizeNet.php'; define("AUTHORIZENET_API_LOGIN_ID", $authLogin);
define("AUTHORIZENET_TRANSACTION_KEY", $authKey);
//Set to true for using test account, set to false for using real account.
define("AUTHORIZENET_SANDBOX",true);
// Update the subscription $update_request =newAuthorizeNetARB;
$updated_subscription_info =newAuthorizeNet_Subscription;
$updated_subscription_info->billToFirstName = $firstname;
$updated_subscription_info->billToLastName = $lastname;
$updated_subscription_info->creditCardCardNumber = $ccnumber;
$updated_subscription_info->creditCardExpirationDate = $ccexpire;
$updated_subscription_info->creditCardCardCode = $cccvv;
$update_response = $update_request->updateSubscription($auth_sub_id, $updated_subscription_info);
$this->assertTrue($update_response->isOk());
$this->assertEquals($response->getResultCode(),"Ok");
Now I need to handle if the update went through okay or not, so something like this...
if($response->??????????){
//no error
}else{
//error
}
"Ok" doesn't seem to work, or maybe I'm checking the wrong response I have no idea.
05-05-2014 06:35 AM - edited 05-05-2014 06:42 AM
the isOk() didn't work?
require_once 'anet_php_sdk/AuthorizeNet.php'; define("AUTHORIZENET_API_LOGIN_ID", $authLogin);
define("AUTHORIZENET_TRANSACTION_KEY", $authKey);
//Set to true for using test account, set to false for using real account.
define("AUTHORIZENET_SANDBOX",true);
// Update the subscription $update_request =newAuthorizeNetARB;
$updated_subscription_info =newAuthorizeNet_Subscription;
$updated_subscription_info->billToFirstName = $firstname;
$updated_subscription_info->billToLastName = $lastname;
$updated_subscription_info->creditCardCardNumber = $ccnumber;
$updated_subscription_info->creditCardExpirationDate = $ccexpire;
$updated_subscription_info->creditCardCardCode = $cccvv;
$update_response = $update_request->updateSubscription($auth_sub_id, $updated_subscription_info);
$this->assertTrue($update_response->isOk());
$this->assertEquals($response->getResultCode(),"Ok");
05-05-2014 07:15 AM - edited 05-05-2014 07:16 AM
Yes, maybe I just didn't use it correctly? I'm not sure what the issue is. Any help with getting my IF statement would be greatly appreciated.
05-05-2014 07:19 AM