Skip to content

Commit e7c99d0

Browse files
committed
Updated Recurring Billing Files
proxy = https://yluan:Qingdao2015@internet.visa.com:443
1 parent 960d72a commit e7c99d0

5 files changed

Lines changed: 219 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
require 'vendor/autoload.php';
3+
use net\authorize\api\contract\v1 as AnetAPI;
4+
use net\authorize\api\controller as AnetController;
5+
define("AUTHORIZENET_LOG_FILE", "phplog");
6+
7+
// Common Set Up for API Credentials
8+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
9+
$merchantAuthentication->setName( "556KThWQ6vf2");
10+
$merchantAuthentication->setTransactionKey("9ac2932kQ7kN2Wzq");
11+
12+
$refId = 'ref' . time();
13+
14+
$request = new AnetAPI\ARBCancelSubscriptionRequest();
15+
$request->setMerchantAuthentication($merchantAuthentication);
16+
$request->setRefId($refId);
17+
$request->setSubscriptionId("100748");
18+
19+
$controller = new AnetController\ARBCancelSubscriptionController($request);
20+
21+
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
22+
23+
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
24+
{
25+
echo "SUCCESS" . $response->getMessages()->getMessage()[0]->getCode() . " " .$response->getMessages()->getMessage()[0]->getText() . "\n";
26+
}
27+
else
28+
{
29+
echo "ERROR : Invalid response\n";
30+
echo "Response : " . $response->getMessages()->getMessage()[0]->getCode() . " " .$response->getMessages()->getMessage()[0]->getText() . "\n";
31+
32+
}
33+
?>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
require 'vendor/autoload.php';
3+
use net\authorize\api\contract\v1 as AnetAPI;
4+
use net\authorize\api\controller as AnetController;
5+
define("AUTHORIZENET_LOG_FILE", "phplog");
6+
date_default_timezone_set('America/Los_Angeles');
7+
// Common Set Up for API Credentials
8+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
9+
$merchantAuthentication->setName( "556KThWQ6vf2");
10+
$merchantAuthentication->setTransactionKey("9ac2932kQ7kN2Wzq");
11+
12+
$refId = 'ref' . time();
13+
14+
// Subscription Type Info
15+
$subscription = new AnetAPI\ARBSubscriptionType();
16+
$subscription->setName("Sample Subscription");
17+
18+
$interval = new AnetAPI\PaymentScheduleType\IntervalAType();
19+
$interval->setLength("1");
20+
$interval->setUnit("months");
21+
22+
$paymentSchedule = new AnetAPI\PaymentScheduleType();
23+
$paymentSchedule->setInterval($interval);
24+
$paymentSchedule->setStartDate(new DateTime('2020-08-30'));
25+
$paymentSchedule->setTotalOccurrences("12");
26+
$paymentSchedule->setTrialOccurrences("1");
27+
28+
$subscription->setPaymentSchedule($paymentSchedule);
29+
$subscription->setAmount("10.29");
30+
$subscription->setTrialAmount("0.00");
31+
32+
$creditCard = new AnetAPI\CreditCardType();
33+
$creditCard->setCardNumber("4111111111111111");
34+
$creditCard->setExpirationDate("2020-12");
35+
36+
$payment = new AnetAPI\PaymentType();
37+
$payment->setCreditCard($creditCard);
38+
39+
$subscription->setPayment($payment);
40+
41+
$billTo = new AnetAPI\NameAndAddressType();
42+
$billTo->setFirstName("John");
43+
$billTo->setLastName("Smith");
44+
45+
$subscription->setBillTo($billTo);
46+
47+
$request = new AnetAPI\ARBCreateSubscriptionRequest();
48+
$request->setmerchantAuthentication($merchantAuthentication);
49+
$request->setRefId($refId);
50+
$request->setSubscription($subscription);
51+
$controller = new AnetController\ARBCreateSubscriptionController($request);
52+
53+
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
54+
55+
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
56+
{
57+
echo "SUCCESS: Subscription ID : " . $response->getSubscriptionId() . "\n";
58+
}
59+
else
60+
{
61+
echo "ERROR : Invalid response\n";
62+
echo "Response : " . $response->getMessages()->getMessage()[0]->getCode() . " " .$response->getMessages()->getMessage()[0]->getText() . "\n";
63+
}
64+
?>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
require 'vendor/autoload.php';
3+
use net\authorize\api\contract\v1 as AnetAPI;
4+
use net\authorize\api\controller as AnetController;
5+
define("AUTHORIZENET_LOG_FILE", "phplog");
6+
7+
// Common Set Up for API Credentials
8+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
9+
$merchantAuthentication->setName( "556KThWQ6vf2");
10+
$merchantAuthentication->setTransactionKey("9ac2932kQ7kN2Wzq");
11+
12+
$refId = 'ref' . time();
13+
14+
$sorting = new AnetAPI\ARBGetSubscriptionListSortingType();
15+
$sorting->setOrderBy("id");
16+
$sorting->setOrderDescending("false");
17+
18+
$paging = new AnetAPI\PagingType();
19+
$paging->setLimit("1000");
20+
$paging->setOffset("1");
21+
22+
$request = new AnetAPI\ARBGetSubscriptionListRequest();
23+
$request->setMerchantAuthentication($merchantAuthentication);
24+
$request->setRefId($refId);
25+
$request->setSearchType("subscriptionInactive");
26+
$request->setSorting($sorting);
27+
$request->setPaging($paging);
28+
29+
30+
$controller = new AnetController\ARBGetSubscriptionListController($request);
31+
32+
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
33+
34+
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
35+
{
36+
echo "SUCCESS: Subscription Details:" . $response->getSubscriptionDetails() . "\n";
37+
echo "Total Number In Results:" . $response->getTotalNumInResultSet() . "\n";
38+
}
39+
else
40+
{
41+
echo "ERROR : Invalid response\n";
42+
echo "Response : " . $response->getMessages()->getMessage()[0]->getCode() . " " .$response->getMessages()->getMessage()[0]->getText() . "\n";
43+
44+
}
45+
?>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
require 'vendor/autoload.php';
3+
use net\authorize\api\contract\v1 as AnetAPI;
4+
use net\authorize\api\controller as AnetController;
5+
define("AUTHORIZENET_LOG_FILE", "phplog");
6+
7+
// Common Set Up for API Credentials
8+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
9+
$merchantAuthentication->setName( "556KThWQ6vf2");
10+
$merchantAuthentication->setTransactionKey("9ac2932kQ7kN2Wzq");
11+
12+
$refId = 'ref' . time();
13+
14+
$request = new AnetAPI\ARBGetSubscriptionStatusRequest();
15+
$request->setMerchantAuthentication($merchantAuthentication);
16+
$request->setRefId($refId);
17+
$request->setSubscriptionId("100748");
18+
19+
$controller = new AnetController\ARBGetSubscriptionStatusController($request);
20+
21+
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
22+
23+
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
24+
{
25+
echo "SUCCESS: Subscription Status : " . $response->getStatus() . "\n";
26+
}
27+
else
28+
{
29+
echo "ERROR : Invalid response\n";
30+
echo "Response : " . $response->getMessages()->getMessage()[0]->getCode() . " " .$response->getMessages()->getMessage()[0]->getText() . "\n";
31+
32+
}
33+
?>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
require 'vendor/autoload.php';
3+
use net\authorize\api\contract\v1 as AnetAPI;
4+
use net\authorize\api\controller as AnetController;
5+
define("AUTHORIZENET_LOG_FILE", "phplog");
6+
7+
// Common Set Up for API Credentials
8+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
9+
$merchantAuthentication->setName( "556KThWQ6vf2");
10+
$merchantAuthentication->setTransactionKey("9ac2932kQ7kN2Wzq");
11+
12+
$refId = 'ref' . time();
13+
14+
$subscription = new AnetAPI\ARBSubscriptionType();
15+
16+
$creditCard = new AnetAPI\CreditCardType();
17+
$creditCard->setCardNumber("4111111111111111");
18+
$creditCard->setExpirationDate("2020-12");
19+
20+
$payment = new AnetAPI\PaymentType();
21+
$payment->setCreditCard($creditCard);
22+
23+
$subscription->setPayment($payment);
24+
25+
$request = new AnetAPI\ARBUpdateSubscriptionRequest();
26+
$request->setmerchantAuthentication($merchantAuthentication);
27+
$request->setRefId($refId);
28+
$request->setSubscriptionId("100748");
29+
$request->setSubscription($subscription);
30+
31+
$controller = new AnetController\ARBUpdateSubscriptionController($request);
32+
33+
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
34+
35+
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
36+
{
37+
echo "SUCCESS" . $response->getMessages()->getMessage()[0]->getCode() . " " .$response->getMessages()->getMessage()[0]->getText() . "\n";
38+
}
39+
else
40+
{
41+
echo "ERROR : Invalid response\n";
42+
echo "Response : " . $response->getMessages()->getMessage()[0]->getCode() . " " .$response->getMessages()->getMessage()[0]->getText() . "\n";
43+
}
44+
?>

0 commit comments

Comments
 (0)