Authorize.net: 发布 XML 数据时应该使用什么变量名? (通过 ColdFusion CFHTTP)
Authorize.net: What Variable Name Should I Use When Posting XML Data? (via ColdFusion CFHTTP)
多年来,我一直使用 Authorize.net AIM 集成方法,使用自定义构建的 ColdFusion 组件 (CFC)。我想尝试使用新的 API 并更新我的 CFC 以使用它。
以前,所有交易数据都作为单独的字段传递,您将 post 传递给 Authorize.net。
例如:x_login、x_tran_key 等...看起来像这样:
<cfhttpparam name="x_login" type="formfield" value="xxx" />
<cfhttpparam name="x_tran_key" type="formfield" value="xxx" />
对于新的 API,我从开发人员文档中注意到的最大变化是所有交易数据都封装为单个 XML(或 JSON)变量,然后post编辑。但是,我在文档中的任何地方都看不到包含 XML(或 JSON)数据的新表单字段名称应该是什么!
流程如下:
<!--- Create my XML request data:--->
<cfxml variable="xmlRequest">
<createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>xxx</name>
<transactionKey>xxx</transactionKey>
</merchantAuthentication>
<refId>xxx</refId>
<transactionRequest>
<transaction request data goes here>
</transactionRequest>
</createTransactionRequest>
</cfxml>
然后我用CFHTTP把数据post传到Authorize.net:
<cfhttp url="https://secure2.authorize.net/gateway/transact.dll" method="post">
<cfhttpparam type="header" name="Content-type" value="application/x-www-form-urlencoded" />
<cfhttpparam name="????" type="formfield" value="#ToString(requestXML)#" />
</cfhttp>
如您所见,我不知道如何为 XML 数据指定 httpparam 名称。
如有任何帮助,我们将不胜感激。
如果您提交XML,您可以使用:
<cfhttp url="https://secure2.authorize.net/gateway/transact.dll" method="post">
<cfhttpparam type="xml" value="#ToString(requestXML)#">
</cfhttp>
基本上是:
<cfhttp url="https://secure2.authorize.net/gateway/transact.dll" method="post">
<cfhttpparam type="header" name="Content-Type" value="text/html">
<cfhttpparam type="body" value="#ToString(requestXML)#">
</cfhttp>
如果您提交 JSON,您将:
<cfhttp url="https://secure2.authorize.net/gateway/transact.dll" method="post">
<cfhttpparam type="header" name="Content-Type" value="application/json">
<cfhttpparam type="body" value="#serializeJSON(requestJSON)#">
</cfhttp>
多年来,我一直使用 Authorize.net AIM 集成方法,使用自定义构建的 ColdFusion 组件 (CFC)。我想尝试使用新的 API 并更新我的 CFC 以使用它。
以前,所有交易数据都作为单独的字段传递,您将 post 传递给 Authorize.net。
例如:x_login、x_tran_key 等...看起来像这样:
<cfhttpparam name="x_login" type="formfield" value="xxx" />
<cfhttpparam name="x_tran_key" type="formfield" value="xxx" />
对于新的 API,我从开发人员文档中注意到的最大变化是所有交易数据都封装为单个 XML(或 JSON)变量,然后post编辑。但是,我在文档中的任何地方都看不到包含 XML(或 JSON)数据的新表单字段名称应该是什么!
流程如下:
<!--- Create my XML request data:--->
<cfxml variable="xmlRequest">
<createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>xxx</name>
<transactionKey>xxx</transactionKey>
</merchantAuthentication>
<refId>xxx</refId>
<transactionRequest>
<transaction request data goes here>
</transactionRequest>
</createTransactionRequest>
</cfxml>
然后我用CFHTTP把数据post传到Authorize.net:
<cfhttp url="https://secure2.authorize.net/gateway/transact.dll" method="post">
<cfhttpparam type="header" name="Content-type" value="application/x-www-form-urlencoded" />
<cfhttpparam name="????" type="formfield" value="#ToString(requestXML)#" />
</cfhttp>
如您所见,我不知道如何为 XML 数据指定 httpparam 名称。
如有任何帮助,我们将不胜感激。
如果您提交XML,您可以使用:
<cfhttp url="https://secure2.authorize.net/gateway/transact.dll" method="post">
<cfhttpparam type="xml" value="#ToString(requestXML)#">
</cfhttp>
基本上是:
<cfhttp url="https://secure2.authorize.net/gateway/transact.dll" method="post">
<cfhttpparam type="header" name="Content-Type" value="text/html">
<cfhttpparam type="body" value="#ToString(requestXML)#">
</cfhttp>
如果您提交 JSON,您将:
<cfhttp url="https://secure2.authorize.net/gateway/transact.dll" method="post">
<cfhttpparam type="header" name="Content-Type" value="application/json">
<cfhttpparam type="body" value="#serializeJSON(requestJSON)#">
</cfhttp>