Question

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

Was it helpful?

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);  
}

OTHER TIPS

You can check the following site.

https://developer.intuit.com/docs/030_qbms

If you have any specific qts, then please raise a support ticket.

https://developer.intuit.com/Support/Incident

Thanks

For Developer: In the document suggested above you will find the step to generate key. Let me give you more input on this as I have faced some question during my development.

Step 3:

Generate a CSR on your server. You can do this with the following two commands from a *nix shell prompt, or using Cygwin on Windows. The [Common Name] for the CSR should be in the form of: your-https-hostname.com:your-application-login. You should not enter an e-mail address when prompted. You should not enter a password.

openssl genrsa -out host.key 1024
openssl req -new -nodes -key host.key -out host.csr

Suggestions:

If you got confused or don't know what exactly need to do with this commands then here is the solution if you are php developer.

First create a private key using following php code, You should use http://php.net/manual/en/function.shell-exec.php to execute above command. It is recommended to create private key out of the public_html or www folder of your site for security reason. To do so, you may write a new key.php file in you site root folder (public_html/key.php)

shell_exec('openssl genrsa -out ../host.key 1024');

After successfully executing this code you will find host.key in your server out side of public_html folder.

Download this file using FTP or cpanel and do following steps in your local systems terminal (for *nix users). You will ask to enter some information about your country and all that, just leave them blank by giving '.' - this is necessary otherwise you will not able to get signed certificate.

gunjan@gunjan:/var/www/html$ openssl req -new -nodes -key host.key -out host.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:.
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (e.g. server FQDN or YOUR name) []:<very_important_step_copy_CN_from_developer_account>
Email Address []:.

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:.
An optional company name []:.

After that you will get csr signed certificate string. Copy it and save to .txt file, this is going to be used to generate .pem file, which will be used in merchant connection.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top