PHP code example of muratsplat / genesis_php

1. Go to this page and download the library: Download muratsplat/genesis_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/ */

    

muratsplat / genesis_php example snippets



se the Genesis Namespace
use \Genesis;

// Load the pre-configured ini file...
Config::loadSettings('/path/to/config.ini');

// ...OR, optionally, you can set the credentials manually
Config::setEndpoint('<set_your_endpoint>');
Config::setUsername('<enter_your_username>');
Config::setPassword('<enter_your_password>');
Config::setToken('<enter_your_token>');

// Create a new Genesis instance with desired API request
$genesis = new \Genesis\Genesis('Financial\Cards\Authorize');

// Set request parameters
$genesis
    ->request()
        ->setTransactionId('43671')
        ->setUsage('40208 concert tickets')
        ->setRemoteIp('245.253.2.12')
        ->setAmount('50')
        ->setCurrency('USD')
        // Customer Details
        ->setCustomerEmail('[email protected]')
        ->setCustomerPhone('1987987987987')
        // Credit Card Details
        ->setCardHolder('Emil Example')
        ->setCardNumber('4200000000000000')
        ->setExpirationMonth('01')
        ->setExpirationYear('2020')
        ->setCvv('123')
        // Billing/Invoice Details
        ->setBillingFirstName('Travis')
        ->setBillingLastName('Pastrana')
        ->setBillingAddress1('Muster Str. 12')
        ->setBillingZipCode('10178')
        ->setBillingCity('Los Angeles')
        ->setBillingState('CA')
        ->setBillingCountry('US');

try {
    // Send the request
    $genesis->execute();

    // Successfully completed the transaction - display the gateway unique id
    echo $genesis->response()->getResponseObject()->unique_id;
}
// Log/handle API errors
// Example: Declined transaction, Invalid data, Invalid configuration
catch (\Genesis\Exceptions\ErrorAPI $api) {
    echo $genesis->response()->getResponseObject()->technical_message;
}
// Log/handle invalid parameters
// Example: Empty (
 composer.phar update


se the Genesis Namespace
use \Genesis;

try {
    $notification = new API\Notification($_POST);

    // Reconciliation is generally optional, but
    // its a recommended practice to ensure
    // that you have the latest information
    $notification->initReconciliation();

    // Application Logic
    // ...
    // for example, process the transaction status
    // $status = $notification->getReconciliationObject()->status;

    // Respond to Genesis
    $notification->renderResponse();
}
catch (\Exception $e) {
    error_log($e->getMessage());
}


\Genesis\Config::setEndpoint('e-comprocessing');

\Genesis\Config::setEndpoint('emerchantpay');
sh
git clone http://github.com/GenesisGateway/genesis_php genesis_php && cd genesis_php
vendor/autoload.php
sh
curl -sS https://getcomposer.org/installer | php
sh
php composer.phar install
sh
php vendor/bin/phpspec run