Skip to content

Commit 3d4be5c

Browse files
committed
added sample code for GetMerchantDetails
1 parent f32704d commit 3d4be5c

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

SampleCodeList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ UpdateSubscription,1,1
5252
CreateCustomerProfile,1,1
5353
CreateCustomerPaymentProfile,1,1
5454
ValidateCustomerPaymentProfile,1,0
55+
GetMerchantDetails,0,1
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
6+
define("AUTHORIZENET_LOG_FILE", "phplog");
7+
8+
function getMerchantDetails() {
9+
// Common Set Up for API Credentials
10+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
11+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
12+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
13+
14+
$refId = 'ref' . time();
15+
16+
$request = new AnetAPI\GetMerchantDetailsRequest();
17+
$request->setMerchantAuthentication($merchantAuthentication);
18+
19+
$controller = new AnetController\GetMerchantDetailsController($request);
20+
21+
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
22+
23+
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok"))
24+
{
25+
echo "Merchant Name: " . $response->getMerchantName() . "\n";
26+
echo "Gateway ID: " . $response->getGatewayId() . "\n";
27+
echo "Processors: ";
28+
foreach ($response->getProcessors() as $processor)
29+
{
30+
echo $processor->getName() . "; ";
31+
}
32+
}
33+
else
34+
{
35+
echo "No response returned \n";
36+
}
37+
38+
return $response;
39+
}
40+
41+
if(!defined('DONT_RUN_SAMPLES'))
42+
getMerchantDetails();
43+
?>

0 commit comments

Comments
 (0)