Reply
Highlighted
Member
Posts: 2
Registered: ‎06-28-2017
Accepted Solution

Call to undefined method net\authorize\api\contract\v1\CreateTransactionResponse::getSubscriptionId

Hello,

I am new to authorize and ran into a problem, namely using your sample-code (https://github.com/AuthorizeNet/sample-code-php/blob/master/RecurringBilling/create-subscription.php), I can't seem to retrieve (and to print it to the landing page) the subscription ID (I receive a fatal error with the content pasted in the subject of this topic). The error message, which relates to an unknown method refers to this part of the code:

echo "SUCCESS: Subscription ID : " . $response->getSubscriptionId() . "\n";

Please help me out. I also tried updating the package dependencies using composer, but to no avail. This is what I get after an attempted subscription (printed from the $response variable):

 

net\authorize\api\contract\v1\CreateTransactionResponse Object
(
[transactionResponse:net\authorize\api\contract\v1\CreateTransactionResponse:private] =>
[profileResponse:net\authorize\api\contract\v1\CreateTransactionResponse:private] =>
[refId:net\authorize\api\contract\v1\ANetApiResponseType:private] => ref1498478222
[messages:net\authorize\api\contract\v1\ANetApiResponseType:private] => net\authorize\api\contract\v1\MessagesType Object
(
[resultCode:net\authorize\api\contract\v1\MessagesType:private] => Ok
[message:net\authorize\api\contract\v1\MessagesType:private] => Array
(
[0] => net\authorize\api\contract\v1\MessagesType\MessageAType Object
(
[code:net\authorize\api\contract\v1\MessagesType\MessageAType:private] => I00001
[text:net\authorize\api\contract\v1\MessagesType\MessageAType:private] => Successful.
)

)

)

[sessionToken:net\authorize\api\contract\v1\ANetApiResponseType:private] =>
)

Interesting though is that these subscriptions do get created (I can see them in my sandbox account), and the system charges these payments as expected.

 

Thanks!


Accepted Solutions
Highlighted
Solution
Accepted by topic author 1nt3r4ct
‎06-28-2017 11:11 PM
All Star
Posts: 699
Registered: ‎11-03-2016

Re: Call to undefined method net\authorize\api\contract\v1\CreateTransactionResponse::getSubscriptio

Hi @1nt3r4ct,

 

That's a weird one. Let's start with the basics. Does the sample code as retrieved from GitHub run from the command line? (like so:)

 

php RecurringBilling/create-subscription.php

 

 

If yes, then the followup is: In whatever's failing, what modifications have you made to the sample code? Can you post the code you're using here?

 

Your $response should be of the type ARBCreateSubscriptionResponse, and it's not, so to me it looks like you're setting

 

$response = new AnetController\CreateTransactionController($request);

 

 

somewhere instead of

 

 

$response = new AnetController\ARBCreateSubscriptionController($request);

 

 

View solution in original post


All Replies
Highlighted
Solution
Accepted by topic author 1nt3r4ct
‎06-28-2017 11:11 PM
All Star
Posts: 699
Registered: ‎11-03-2016

Re: Call to undefined method net\authorize\api\contract\v1\CreateTransactionResponse::getSubscriptio

Hi @1nt3r4ct,

 

That's a weird one. Let's start with the basics. Does the sample code as retrieved from GitHub run from the command line? (like so:)

 

php RecurringBilling/create-subscription.php

 

 

If yes, then the followup is: In whatever's failing, what modifications have you made to the sample code? Can you post the code you're using here?

 

Your $response should be of the type ARBCreateSubscriptionResponse, and it's not, so to me it looks like you're setting

 

$response = new AnetController\CreateTransactionController($request);

 

 

somewhere instead of

 

 

$response = new AnetController\ARBCreateSubscriptionController($request);

 

 

Highlighted
Member
Posts: 2
Registered: ‎06-28-2017

Re: Call to undefined method net\authorize\api\contract\v1\CreateTransactionResponse::getSubscriptio

Hey,

 

thanks! That solved my issue. I will do more testing but I get a valid reference ID. I must've copy-pasted that part from the transaction snippet supplied.

 

Thanks again! :)