forked from AuthorizeNet/sample-code-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-subscription-status.php
More file actions
33 lines (26 loc) · 1.19 KB
/
get-subscription-status.php
File metadata and controls
33 lines (26 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require 'vendor/autoload.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
define("AUTHORIZENET_LOG_FILE", "phplog");
// Common Set Up for API Credentials
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName( "556KThWQ6vf2");
$merchantAuthentication->setTransactionKey("9ac2932kQ7kN2Wzq");
$refId = 'ref' . time();
$request = new AnetAPI\ARBGetSubscriptionStatusRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId($refId);
$request->setSubscriptionId("100748");
$controller = new AnetController\ARBGetSubscriptionStatusController($request);
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
{
echo "SUCCESS: Subscription Status : " . $response->getStatus() . "\n";
}
else
{
echo "ERROR : Invalid response\n";
echo "Response : " . $response->getMessages()->getMessage()[0]->getCode() . " " .$response->getMessages()->getMessage()[0]->getText() . "\n";
}
?>