Search code examples
phpintuit-partner-platform

Implement Payment Process With Quickbook(Intuit Payment)


I want to implement Quickbook payment process for e-commerce site. i search lot but cant find proper solution.


Solution

  • If you need a test/development merchant account, instructions are provided here to get one. Otherwise, use your actual Intuit username/password for the rest of the steps.

    Follow the instructions on our QuickBooks wiki to register in DESKTOP mode.

    After registration, you should have an App Login, App ID, and a Connection Ticket. You'll get the App Login and App ID from the actual registration process, and then the Connection Ticket after you go through the short connection process.

    Download the QuickBooks PHP DevKit from GitHub: https://github.com/consolibyte/quickbooks-php

    Look at this example file: docs/example_merchant_services.php (click here for direct link to code on GitHub)

    Fill in your App Login / Connection Ticket.

    Read through the rest of that docs/example_merchant_service.php file for examples of how to charge credit cards, authorize credit cards, etc.

    There are a few other examples in the docs/ directory (example_merchant_service_wallet.php, etc.) which also show how to store credit cards with Intuit in a PCI-compliant manner, etc.

    Your resulting code should end up looking something like:

    <?php
    
    // Include the QuickBooks files
    require_once 'QuickBooks.php';
    
    $dsn = null;
    $path_to_private_key_and_certificate = null;
    $application_login = 'qbms.consolibyte.com';
    $connection_ticket = 'TGT-157-p3PyZPoH3DtieLSh4ykp6Q';
    
    // Create an instance of the MerchantService object 
    $MS = new QuickBooks_MerchantService(
        $dsn, 
        $path_to_private_key_and_certificate, 
        $application_login,
        $connection_ticket);
    
    // Now, let's create a credit card object, and authorize an amount agains the card
    $name = 'Keith Palmer';
    $number = '5105105105105100';
    $expyear = date('Y');
    $expmonth = date('m');
    $address = '56 Cowles Road';
    $postalcode = '06279';
    $cvv = null;
    
    // Create the CreditCard object
    $Card = new QuickBooks_MerchantService_CreditCard($name, $number, $expyear, $expmonth, $address, $postalcode, $cvv);
    
    // We're going to authorize $295.00
    $amount = 295.0;
    
    if ($Transaction = $MS->authorize($Card, $amount))
    {
        print('Card authorized!' . "\n");
        print_r($Transaction);  
    }