2013-10-05 85 views

回答

3

如果你需要一個測試/開發商家賬戶,指令提供here得到一個。否則,請使用您的實際Intuit用戶名/密碼進行其餘步驟。

按照說明on our QuickBooks wiki以DESKTOP模式註冊。

註冊後,您應該擁有應用程序登錄,應用程序ID和連接故障單。您將從實際的註冊過程中獲得應用程序登錄和應用程序ID,然後在完成簡短連接過程後獲得連接故障單。

下載QuickBooks PHP DevKit從GitHub:https://github.com/consolibyte/quickbooks-php

看看下面這個例子文件:文檔/ example_merchant_services.php(click here for direct link to code on GitHub

填寫您的應用程序登錄/聯票。

通讀有關如何信用卡收取例子是文檔/ example_merchant_service.php文件的其餘部分,授權信用卡等

有在docs /目錄(其他幾個例子example_merchant_service_wallet.php等等),這也顯示瞭如何的信用卡與Intuit公司存儲在一個標準的PCI-方式等

最後的代碼應該結束了看起來像:

<?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); 
} 
+0

感謝您的寶貴幫助。 –

1

對於d eveloper: 在上面建議的文檔中,您將找到生成密鑰的步驟。讓我給你更多的意見,因爲我在開發過程中遇到了一些問題。

第3步:

的服務器上生成一個CSR。您可以通過* nix shell提示符中的以下兩個 命令或使用Windows上的Cygwin執行此操作。 CSR的 [通用名稱]應採用以下形式: your-https-hostname.com:your-application-login。出現提示時,不應輸入電子郵件地址 。你不應該輸入密碼。

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

建議:

如果你糊塗了還是不知道究竟需要做的這個命令那麼這裏就是如果你是PHP開發的解決方案。

首先使用以下php代碼創建私鑰, 您應該使用http://php.net/manual/en/function.shell-exec.php來執行上述命令。出於安全原因,建議從您網站的public_html或www文件夾中創建私鑰。要做到這一點,你可以在你的網站的根文件夾(的public_html/key.php)

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

寫一個新的key.php文件在服務器端進行成功執行這段代碼,你會發現host.key後public_html文件夾。

使用FTP或cPanel下載此文件,並在本地系統終端(針對* nix用戶)中執行以下步驟。你會要求輸入一些有關你的國家的信息,只要給他們留下空白。 - 這是必要的,否則你將無法獲得簽名證書。

[email protected]:/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 []:. 

之後,您將獲得csr簽名證書字符串。將其複製並保存到.txt文件,這將用於生成.pem文件,該文件將用於商戶連接。