Giter VIP home page Giter VIP logo

nachalibphp's Introduction

Create NACHA files in PHP

Supports debit (collecting money from others) and credit (transferring money to others) transactions. If you need more functionality, I'm available for contract work at [email protected]

Usage:

include 'Nacha.php';
$nacha = new NachaFile();
$nacha->setBankRT('123456789')// Your bank's routing number
      ->setCompanyId('9876543210')// Usually your company Fed tax id with something the bank tells you to put on the front.
      ->setSettlementAccount('44444444444') // Your bank account you want the money to go into
      ->setFileID('9876543210')// Probably the same as your Company ID but your bank will tell you what this should be.
      ->setOriginatingBank('BANK ON IT')// Text name of your bank
      ->setFileModifier('A')// Usually just A - for the first file of the day.  Change to 'B' for second file of the day and so on.
      ->setCompanyName('MY COMPANY')//16 chars - your company name
      ->setBatchInfo('Monthly Subscriptions') // Text description for the batch
      ->setDescription('Subscription', '05/17/2012') // Description shown on customers statements and date of invoice
      ->setEntryDate(date('m/d/Y')); // The day you want the payments to be processed. This example shows today.

Then push in the customer payments. Each customer record should look like:

$payment = array("AccountNumber"=>'1234567', // The customer's CRM account number (not bank account number)
                 "TotalAmount"=>30.00, // Amount they are paying you if it's a debit - or that you're paying them if it's a credit.
                 "BankAccountNumber"=>'123456789', // Customer's bank account number
                 "RoutingNumber"=>'987654321', // Customer's bank routing number
                 "FormattedName"=>'Joe Smith', // Customer's name
                 "AccountType"=> 'CHECKING'); // Could be 'CHECKING' or 'SAVINGS' - customer's bank account type

// Add a debit - taking money from someone and puting it in your account
if(!$nacha->addDebit($payment)){
   // Error adding this debit.  Must be something wrong.  Check the $nacha->errorRecords.
}

// You can safely mix debits and credits in the same batch.
// Add a credit - sending your money to someone elses bank account
if(!$nacha->addCredit($payment)){
   // Error adding this credit.  Must be something wrong.  Check the $nacha->errorRecords.
}

// Generate the NACHA file contents
try{
    $nacha->generateFile();
    // Put the file contents on the file system
    if(!file_put_contents('./ACH_MyCompany_NACHA_file.txt', $nacha->fileContents)){
        throw new Exception('Unable to save NACHA file');
    }
}catch(Exception $e){
    // Something went wrong with the file generation
    print_r($e->getMessage());
}

Copyright 2012 [email protected]

nachalibphp's People

Contributors

snsparrish avatar geenasuresh avatar jiripavlicek avatar kevinkaske avatar bradrozier avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.