【发布时间】:2013-10-05 17:00:38
【问题描述】:
我想为电子商务网站实施 Quickbook 支付流程。我搜索了很多,但找不到合适的解决方案。
【问题讨论】:
标签: php intuit-partner-platform intuit
我想为电子商务网站实施 Quickbook 支付流程。我搜索了很多,但找不到合适的解决方案。
【问题讨论】:
标签: php intuit-partner-platform intuit
如果您需要一个测试/开发商家帐户,请提供说明here 以获得一个。否则,请在其余步骤中使用您的实际 Intuit 用户名/密码。
按照说明on our QuickBooks wiki 在桌面模式下注册。
注册后,您应该有一个应用登录、应用 ID 和一个连接票。您将在实际注册过程中获得 App Login 和 App ID,然后在完成短连接过程后获得 Connection Ticket。
从 GitHub 下载 QuickBooks PHP DevKit:https://github.com/consolibyte/quickbooks-php
查看这个示例文件:docs/example_merchant_services.php (click here for direct link to code on GitHub)
填写您的应用登录/连接票。
阅读 docs/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);
}
【讨论】:
您可以查看以下网站。
https://developer.intuit.com/docs/030_qbms
如果您有任何特定的 qts,请提出支持票。
https://developer.intuit.com/Support/Incident
谢谢
【讨论】:
对于开发者: 在上面建议的文档中,您将找到生成密钥的步骤。由于我在开发过程中遇到了一些问题,让我给你更多的意见。
第 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) 中编写一个新的 key.php 文件
shell_exec('openssl genrsa -out ../host.key 1024');
成功执行此代码后,您将在 public_html 文件夹外的服务器中找到 host.key。
使用 FTP 或 cpanel 下载此文件,并在本地系统终端中执行以下步骤(对于 *nix 用户)。您将要求输入有关您所在国家/地区的一些信息以及所有这些信息,只需输入“。”即可将其留空。 - 这是必要的,否则您将无法获得签名证书。
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 []:.
之后,您将获得 csr 签名的证书字符串。将其复制并保存到.txt文件,用于生成.pem文件,用于商户连接。
【讨论】: