I get properly credit card info upon input done I called a function to validate credit card with luhn module ( npm install luhn) as I use :
var luhn = require("luhn");
is_valid = luhn.validate(card); // should respond true.
if (!is_valid) {
console.log("Not a valid credit card");
}
return;`
Uncaught ReferenceError: require is not defined
I am sorry If this is simple question but since I could not find a logic short solution for npm packed usage. onsubmit
I call this time kkTahsil()
function.
function kkTahsil() {
datalariAl();
var Iyzipay = require('iyzipay');
var iyzipay = new window.Iyzipay({
apiKey: 'sandbox-PZ8jicWrEeE1rt1O75FTOegr5lsW3xxx',
secretKey: 'sandbox-2Q6aaP1FK3HFrXkTsHfftxfiudFMfxxx',
uri: 'https://sandbox-api.iyzipay.com'
});
var nameOnCard = document.getElementById('name-on-card').value;
var expireMonth = document.getElementById('card-exp-month').value;
var expireYear = document.getElementById('card-exp-year').value;
var cvc= document.getElementById('card-cvv').value;
again same error.
so in js, there must be easy way to use npm modules. But I could not found yet.
Please I need a help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…