1

我一直在尝试获取要通过的示例 Web 服务请求,但一直收到错误消息。请参阅我的设置。

账号:89994061 店铺ID:test 店铺密码:test

样品请求(代码)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<title>Credit Card Test</title>
<body>
<form NAME="Credit Card" METHOD="post"
ACTION="https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1">
<input type=hidden name="txnmode" value="ccAuthorize" >
<b>XML Message body:</b>
<TEXTAREA class="xmlbox" name="txnRequest" COLS=100 ROWS=10 >
<ccAuthRequestV1 xmlns="http://www.optimalpayments.com/creditcard/xmlschema/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.optimalpayments.com/creditcard/xmlschema/v1">
<merchantAccount>
<accountNum>89994061</accountNum>
<storeID>test</storeID>
<storePwd>test</storePwd>
</merchantAccount>
<merchantRefNum>Ref-12345</merchantRefNum>
<amount>10.00</amount>
<card>
<cardNum>4XXXXXXXXXXXXXX1</cardNum>
<cardExpiry>
<month>11</month>
<year>2015</year>
</cardExpiry>
<cardType>VI</cardType>
<cvdIndicator>1</cvdIndicator>
<cvd>111</cvd>
</card>
<authentication>
<indicator>05</indicator>
<cavv>AAABB4WZlQAAAAAAcJmVENiWiV+=</cavv>
<xid>Q2prWUI2RFNBc3FOTXNlem50eWY=</xid>
</authentication>
<billingDetails>
<cardPayMethod>WEB</cardPayMethod>
<firstName>Jane</firstName>
<lastName>Jones</lastName>
<street>123 Main Street</street>
<city>LA</city>
<state>CA</state>
<country>US</country>
<zip>90210</zip>
<phone>555-555-5555</phone>
<email>janejones@emailserver.com</email>
</billingDetails>
<shippingDetails>
<carrier>FEX</carrier>
<shipMethod>T</shipMethod>
<firstName>Jane</firstName>
<lastName>Jones</lastName>
<street>44 Main Street</street>
<city>LA</city>
<state>CA</state>
<country>US</country>
<zip>90210</zip>
<phone>555-555-5555</phone>
<email>janejones@emailserver.com</email>
</shippingDetails>
<recurring>
<recurringIndicator>I</recurringIndicator>
<originalConfirmationNumber>115147689</originalConfirmationNumber>
</recurring>
<customerIP>127.0.0.1</customerIP>
<productType>M</productType>
<addendumData>
<tag>CUST_ACCT_OPEN_DATE</tag>
<value>20041012</value>
</addendumData>
<addendumData>
<tag>MERCHANT_COUNTRY_CODE</tag>
<value>US</value>
</addendumData>
<addendumData>
<tag>SERVICE_REQUEST_CURRENCY</tag>
<value>on</value>
</addendumData>
</ccAuthRequestV1>
</TEXTAREA>
<br>
<input TYPE=submit class=input VALUE="Send Request">
</form>
</body>
</html>

收到错误

所需的字符串参数“txnMode”不存在

这是文档中的确切要求,它对我不起作用。我在做什么不正确?任何输入将不胜感激。

4

1 回答 1

1

乍一看,一切都很好。但是,代码中有一个小错误。您在 HTML POST 中有以下行

<input type=hidden name="txnmode" value="ccAuthorize" >

正确的做法如下

<input type=hidden name="txnMode" value="ccAuthorize" >

问题是实际的 txnMode 名称拼写错误。这是区分大小写的。进行此更改后,您应该会收到来自 Web 服务 API 的正确响应。

于 2016-11-29T12:21:02.993 回答