Extension Setup: QuickBooks Merchant Services Integrated Payments

Hello! Let me firstly thank you for your purchase. I will try to make these instructions as
simplistic as possible but it will definitely will be something I'm constantly improving. If you
have any questions please contact me.

Installing the Magento Extension

Manual Extraction

Extract/Decompress the downloaded extension archive to your local machine
Connect to your web server (usually through an FTP client)
Create a folder named "EsteSolutions" under app/code (create the folder 'code' also if it doesn't exist)
Create another folder named "QBPayments" under app/code/EsteSolutions
Transfer all the extension's files and folders to your web server under the folder /app/code/EsteSolutions/QBPayments
You will now need to ssh onto your webserver to run the following command
From your Magento root (contains the folder app, lib as a reference) run the following commands:

- Composer must be installed. To check  "composer --help" . If nothing displays or you face any errors, you must install Composer first. For directions follow Step 1 at https://www.simicart.com/blog/magento-2-composer/

- From your Magneto root (should have a composer.json file in it) run "composer require quickbooks/v3-php-sdk". If you get "Fatal error: Allowed memory size of xxx bytes exhausted", rerun with "COMPOSER_MEMORY_LIMIT=-1 composer require quickbooks/v3-php-sdk"
- "php bin/magento setup:upgrade"
- "php bin/magento setup:di:compile"
- "php bin/magento indexer:reindex"
- "php bin/magento cache:clean"

Create an Intuit Developer Account

Sign up for a new Intuit Developer account or sign in with any current Intuit product account such as QuickBooks, TurboTax, Mint, or ProConnect.  Navigate to https://developer.intuit.com, "Sign In" and "Sign Up" links are in the top right of the screen.

Generate your Client Id and Client Secret

This involved creating an "App" first, then the Client Id and Client Secret are generated for you. Follow the steps under the section "2. Create an app" on the page https://developer.intuit.com/app/developer/qbpayments/docs/get-started

Integrating with your Magento Store

Please note that you are being guided to setup the extension under production mode. All payment transactions processed are real and will be deducted from the credit card entered. For verifing just purchase a product for 1 cent and then on your merchant account you can refund the amount. Disclaimer, if you refunding a hundred purchases Intuit may get upset.

Inside your Magento admin navigate to the Intuit Merchant Services configuration (Stores > Configuration > Sales > Payment Methods > QuickBooks Payments). For connecting to your production account make sure "Test Mode" flag is set to "No". 

Enter the production Client Id and Client Secret keys generated in the previous section into the fields of the same name. Taken from the Production > Keys and OAuth > Keys section of the "App" you just created. 

To fill out the "Refresh Token" Admin field you must go to https://developer.intuit.com/app/developer/playground. Login if prompted. Fill out Step 1 by selected the Production version of the "App" you created in the previous section. Check "Payments"  scope only in the OAuth Settings section, and click "Get authorization code". You will be redirected to another page where you will select the company you would like the payment captures from your Magento site to be associated with. After that page you will be redirected back to the OAuth 2.0 Playground page. Step 2 fields should now be prefilled, proceed and click the "Get tokens" button. Two sections of the right should appear; Request and Response. Inside the Response file you will need to take the value after "refreshToken":  but before the comma (without the quotes). See below picture. Enter this value into the "Refresh Token" Admin field.

Make sure to save the page.