这个是可能的吗?
我有一个电子商务网站,有一个eWay支付网关,所以我想获得加密的卡细节与客户端加密密钥,可以在代码$(".form").attr("data-eway-encrypt-key", "The encryption key is placed here");中看到,我想知道这是否可能,因为我想传递加密的数据到另一种形式这里是加密js https://secure.ewaypayments.com/scripts/eCrypt.js的链接
发布于 2020-08-26 12:01:10
我也做过类似的事情,不太确定你的问题在哪里需要帮助,但这是我的代码。我使用"RealCardNumber“作为文本字段,使用"CardNumber”作为隐藏字段,填充加密数据并将其发送到服务器(卡代码也是如此)。
$.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');
});https://stackoverflow.com/questions/60829069
复制相似问题