Reputation: 113
I am trying to integrate authorize.net ARB in php with John Conde's code from below link http://www.johnconde.net/blog/tutorial-integrate-the-authorize-net-arb-api-with-php/
Its working fine and gives me a successful response i.e. subscription id and 'ok' as a response. But now from this returned subscription id I want to get the current status of subscription and the subscription is ongoing with the interval of 1 month.
I want to check the status of the subscription_id each month and if there are insufficient fund and payment is not done for particular month then i want to restrict the user from accessing my site. But form tutorial i have refereed, am not getting any code or link to get Status or check status of particular subscription_id.
Please help me out. Am stuck at this stage. Thanks in advance. Your help will be appreciated.
Upvotes: 1
Views: 372
Reputation: 219894
You can get the subscription status using the ARBGetSubscriptionStatusRequest
API call. The code you are using is obsolete so you should use the code provided in this tutorial to get this.
The call would look like this:
require('../../AuthnetXML.class.php');
$xml = new AuthnetXML(<your login>, <your transaction key>);
$xml->ARBGetSubscriptionStatusRequest(array(
'refId' => '<your refId>',
'subscriptionId' => '<your subscriptionId>'
));
echo $xml->status; // Active/inactive
Of course, you would provide the subscription ID for the subscription you want the status of. All this API call can tell you is if the subscription is active or not (it won't be active if their payment for that month failed). It cannot tell you how much funds is left on a credit card though. There is no way to get that information through any API.
Upvotes: 1