如何使用accept.js与Authorize.net

时间:2017-07-11 14:36:53

标签: jquery salesforce authorize.net

我们与Authorize.net集成,我们正在实施Accept.js以支持信用卡付款。唯一的问题是,似乎在API参考(http://developer.authorize.net/api/reference/features/acceptjs.html)中没有字段/方法来获取客户的结算信息并将其传递给Authorize.net,因此在交易详情中也可以使用相同的信息。

任何人都可以帮助我们,即如何使用Accept.js同时询问客户账单信息?

1 个答案:

答案 0 :(得分:1)

这很简单,您只需使用下面的XML替换常规API调用中的付款数据,包括您使用Accept.js收到的付款用途......

 <payment>
         <opaqueData>
            <dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor>
            <dataValue>PAYMENT_NONCE</dataValue >
         </opaqueData>
      </payment>

而不是:

<payment>
      <creditCard>
        <cardNumber>5424000000000015</cardNumber>
        <expirationDate>1220</expirationDate>
        <cardCode>999</cardCode>
      </creditCard>
    </payment>

在常规API调用中,如下所示:

 <createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
          <merchantAuthentication>
            <name>YOUR_API_LOGIN</name>
            <transactionKey>YOUR_TRANSACTION_KEY</transactionKey>
          </merchantAuthentication>
          <refId>123456</refId>
          <transactionRequest>
            <transactionType>authCaptureTransaction</transactionType>
            <amount>10</amount>
            <payment>
                 <opaqueData>              
       <dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor>
                    <dataValue>PAYMENT_NONCE</dataValue >
                 </opaqueData>
              </payment>
            <order>
             <invoiceNumber>INV-12345</invoiceNumber>
             <description>Product Description</description>
            </order>
            <lineItems>
              <lineItem>
                <itemId>1</itemId>
                <name>vase</name>
                <description>Nice Vase </description>
                <quantity>1</quantity>
                <unitPrice>45.00</unitPrice>
              </lineItem>
            </lineItems>
               <shipping>
              <amount>4.26</amount>
              <name>level2 tax name</name>
              <description>level2 tax</description>
            </shipping>
            <poNumber>456654</poNumber>
            <customer>
              <id>99999456654</id>
            </customer>
            <billTo>
              <firstName>Sue</firstName>
              <lastName>Smith</lastName>
              <company>ACME Vases</company>
              <address>102 Main Street</address>
              <city>Palm Springs</city>
              <state>CA</state>
              <zip>92234</zip>
              <country>USA</country>
            </billTo>
             </transactionRequest>
        </createTransactionRequest>