PHP code example of orkestra / transactor

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

    

orkestra / transactor example snippets

 php


use Orkestra\Transactor\Entity\Credentials;
use Orkestra\Transactor\Transactor\Generic\GenericTransactor;

$transactor = new GenericTransactor();

$creds = $transactor->createCredentials();
foreach ($creds->getCredentials() as $k => $v) {
    // Enumerate the default fields 
 php


use Orkestra\Transactor\Entity\Account;

// A credit card
$card = new Account\CardAccount();
$card->setAccountNumber('4111111111111111');

// A bank account (used for ACH processing)
$account = new Account\BankAccount();
$account->setAccountNumber('12345777');
$account->setRoutingNumber('5556713355');
 php


use Orkestra\Transactor\Entity\Transaction;

$transaction = new Transaction();
$transaction->setAccount($account);
$transaction->setCredentials($creds);
$transaction->setNetwork(new Transaction\NetworkType(Transaction\NetworkType::CASH));
$transaction->setType(new Transaction\TransactionType(Transaction\TransactionType::SALE));
 php


$result = $transactor->transact($transaction);