代码之家  ›  专栏  ›  技术社区  ›  Alex

在C中实现datacash 3dsecure#

  •  2
  • Alex  · 技术社区  · 16 年前

    我的任务是在我们现有的网站上实现3D安全信用卡验证。 我只是想知道是否有人有设置3dsecure的示例代码?

    我已经看过文件了,但是什么也没找到。

    2 回复  |  直到 12 年前
        1
  •  2
  •   Zhaph - Ben Duguid    15 年前

    我试着找一个和我一起工作的人在这里张贴一些东西,因为他很准确地为我们的一个客户写了这篇文章,但我会带你经历我所理解的过程。

    基本上,一旦您执行了任何预验证请求(例如,使用datacash二进制文件),然后使用datacash代理将付款请求提交给datacash以发送付款请求。

    如果在您的datacash帐户上设置了3d安全,并且通过字段发送消息说3ds可能发生此事务,则可能会返回状态代码150:

    <?xml version="1.0" encoding="UTF-8"?>
    <Response>
      <CardTxn>
        <card_scheme>...</card_scheme>
        <country>...</country>
        <issuer>...</issuer>
        <ThreeDSecure>
          <acs_url>...</acs_url>
          <pareq_message>...</pareq_message>
        </ThreeDSecure>
      </CardTxn>
      <datacash_reference>...</datacash_reference>
      <merchantreference>...</merchantreference>
      <mode>TEST</mode>
      <reason>3DS Payer Verification Required</reason>
      <status>150</status>
      <time>...</time>
    </Response>
    

    以及cardtxn元素中的threedsecure块。

    然后,您需要获取acs-url和pareq-u消息,并使用这些消息向发卡银行提交请求以获得授权。

    这通常采用自提交javascript表单的形式,该表单可以发布到iframe中:

    <!-- Action comes from acs_url returned by DataCash -->
    <form method="post" 
          target="3dAuthFrame"
          action="https://testserver.datacash.com/acs">
      <!-- Value comes from pareq_message returned by DataCash -->
      <input value="[...]"
             name="PaReq"
             type="hidden" />
      <!-- Value is a merchant specified identifier that is dislayed to the user -->
      <input value="[...]"
             name="MD" 
             type="hidden" />
      <!-- Value is a public URL that the 3D Secure server will post back to -->
      <input type="hidden" 
             name="TermUrl" 
             value="[...]"/>
      <p>
        If you do not see your card issuer's instructions, below, please click 
        <input value="Continue" name="TDAction" type="submit" />
      </p>
      <iframe style="width:100%;height:400px" 
              src="javascript:''"
              name="3dAuthFrame"></iframe>
      <script type="text/javascript">
        document.forms[0].elements.TDAction.click();
        document.forms[0].elements.TDAction.disabled=true;</script>
    </form>
    

    然后,termurl的页面将接收来自3D安全服务器的调用,其表单字段为“pares”和“md”(即来自发行银行的响应,以及您之前提供的引用)。

    然后,您将这些授权详细信息作为历史交易提交回Datacash,以完成付款。

    有关详细信息,请参见第D.4节。三维安全,在《开发人员指南》中使用Datacash MPI,等等 this page (可能需要登录)。

    如果你需要更多的细节,请告诉我,我会尽量在这里得到更多的细节。

        2
  •  2
  •   Alex    12 年前

    我现在写了一篇关于这个的文章… http://www.alexjamesbrown.com/blog/development/implementing-datacash-3d-secure-with-asp-net/

    希望这能帮助那些从谷歌偶然发现这一点的人……

    推荐文章