PHP code example of opendns / merchant-esolutions-php

1. Go to this page and download the library: Download opendns/merchant-esolutions-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

opendns / merchant-esolutions-php example snippets


use OpenDNS\MES\Trident\Sale;

$response = Sale::factory(Sale::ENV_TEST)
    ->setAuthenticationInfo('xxxxxxxxxxx', 'yyyyyyy')
    ->setAmount(13.37)
    ->setCardNumber('3499-999999-99991')
    ->setCardExpiration(12, 2018)
    ->setCvv2(1234)
    ->execute();

echo $response['transaction_id'];

use OpenDNS\MES\Reporting\Report;

$response = Report::factory(Report::ENV_PROD)
    ->setAuthenticationInfo('xxxxxxxxxxx', 'yyyyyyy')
    ->setNodeId('zzzzzzzzzz')
    ->setReportId(Report::REPORT_SETTLEMENT_SUMMARY)
    ->setBeginDate(new \DateTime('-1 week', new \DateTimeZone('UTC')))
    ->setEndDate(new \DateTime('now', new \DateTimeZone('UTC')))
    ->setIncludeTridentTransactionId(true)
    ->execute();

$stream = $response->getResponseBodyStream();
while ($row = fgetcsv($stream)) {
    echo implode(',', $row);
}