Reply
Highlighted
Member
Posts: 2
Registered: ‎05-05-2014

ARB Update Subscription

[ Edited ]

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.

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: ARB Update Subscription

[ Edited ]

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");
Highlighted
Member
Posts: 2
Registered: ‎05-05-2014

Re: ARB Update Subscription

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.