首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >eWay客户端加密

eWay客户端加密
EN

Stack Overflow用户
提问于 2020-03-24 18:21:07
回答 1查看 298关注 0票数 0

这个是可能的吗?

我有一个电子商务网站,有一个eWay支付网关,所以我想获得加密的卡细节与客户端加密密钥,可以在代码$(".form").attr("data-eway-encrypt-key", "The encryption key is placed here");中看到,我想知道这是否可能,因为我想传递加密的数据到另一种形式这里是加密js https://secure.ewaypayments.com/scripts/eCrypt.js的链接

EN

回答 1

Stack Overflow用户

发布于 2020-08-26 12:01:10

我也做过类似的事情,不太确定你的问题在哪里需要帮助,但这是我的代码。我使用"RealCardNumber“作为文本字段,使用"CardNumber”作为隐藏字段,填充加密数据并将其发送到服务器(卡代码也是如此)。

代码语言:javascript
复制
   $.getScript("https://secure.ewaypayments.com/scripts/eCrypt.min.js")
       .done(function (script, textStatus) {
           if (eCrypt !== undefined) {
               $('#card-details').show(); // Form details initially hidden
               $('#card-loading').hide(); // Placeholder div shown while loading the eWay script (which should happen pretty quick)
               // Setup the hooks to encrypt the card number once it is submitted
               $(".payment-info-next-step-button")[0].onclick = null; // This is the payment button in my scenario
               $(".payment-info-next-step-button").click(function () {
                   var eWayKey = "<Key goes here>"; // Get from Settings ....
                   try {
                       $('#CardNumber').val(eCrypt.encryptValue($('#RealCardNumber').val(), eWayKey));
                       $('#CardCode').val(eCrypt.encryptValue($('#RealCardCode').val(), eWayKey));
                       // Ready to go .... hook in your normal submit here
                   } catch (e) {
                       alert('Sorry there was a problem with submitting the card details securely');
                       console.log(e);
                   }
               });
           } else {
               $('#card-loading').hide();
               alert('eWay not available - please select a different payment method if available');
           }
       })
       .fail(function (jqxhr, settings, exception) {
           $('#card-loading').hide();
           alert('eWay not available - please select a different payment method if available');
       });
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60829069

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档