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!
Solved! Go to Solution.
06-28-2017 12:50 AM
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);
06-28-2017 11:37 AM
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);
06-28-2017 11:37 AM
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! :)
06-28-2017 11:16 PM
Hi! I'm facing the same issue , i literally copy and paste the sample changin the credencials only and i can not get acccess to the method getSubscriptionId(),
$response = new AnetController\CreateTransactionController($request);
if i create an instance of ARBCreateSubscriptionResponse it has the method . but the result of this line has not ,
02-02-2024 08:54 PM