我正在尝试使用 Intuit 的 QBMS 在网站上设置信用卡界面,并且我已经按照 Intuit 文档上的规范设置了 XML 请求。我还设置了我的 AppID、连接票证和应用程序登录。但是当我进行测试时,我收到以下错误:
SAX 解析器返回的未知错误。来自其他包的异常:java.lang.StringIndexOutOfBoundsException:字符串索引超出范围:-1
这是 XML 请求:
$productionUrl = 'https://merchantaccount.quickbooks.com/j/AppGateway';
$connectionTicket = 'SDK-xxx-xxx-xxxxxxxxxxxxxxxxxxxxxxxx';
$applicationLogin = 'qbms.site.com';
$appID = "111111111";
$xml = rawurlencode('<?xml version="1.0"?>
<?qbmsxml version="4.1"?>
<QBMSXML>
<SignonMsgsRq>
<SignonDesktopRq>
<ClientDateTime>' . date('Y-m-d\TH:i:s') . '</ClientDateTime>
<ApplicationLogin>' . $applicationLogin . '</ApplicationLogin>
<ConnectionTicket>' . $connectionTicket . '</ConnectionTicket>
<Language>English</Language>
<AppID>' . $appID . '</AppID>
<AppVer>1.0</AppVer>
</SignonDesktopRq>
</SignonMsgsRq>
<QBMSXMLMsgsRq>
<CustomerCreditCardChargeRq>
<TransRequestID>' . $_transId . '</TransRequestID>
<CreditCardNumber>' . $_cc_number . '</CreditCardNumber>
<ExpirationMonth>' . $_cc_exp_month . '</ExpirationMonth>
<ExpirationYear>' . $_cc_exp_year . '</ExpirationYear>
<IsCardPresent>false</IsCardPresent>
<Amount>' . $_amount . '</Amount>
<NameOnCard>' . $_cc_name . '</NameOnCard>
<CreditCardAddress>' . $_cc_address . '</CreditCardAddress>
<CreditCardPostalCode>' . $_cc_zip . '</CreditCardPostalCode>
<SalesTaxAmount>' . $_tax . '</SalesTaxAmount>
</CustomerCreditCardChargeRq>
</QBMSXMLMsgsRq>
</QBMSXML>');
$header[] = "Content-type: application/x-qbmsxml";
$header[] = "Content-length: " . strlen($xml);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_URL, $productionUrl);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);