Hi,
ich see your checkout demo with the iframe solution and it works well if i start your project. If i adapt this to my own project i get this two values as FALSE so the check can not perform.
This is my Code:
TS FILE:
`
export class HomeComponent implements AfterViewInit {
iframes: any;
_creditCardCheckResponse: any;
_supportedCardTypes: string[];
constructor() {
this._supportedCardTypes = ['V', 'M']
}
ngAfterViewInit() {
this.initPayone();
}
initPayone() {
const supportedCardtypes = ["V", "M"];
const config = {
fields: {
cardpan: {
selector: "cardpan",
style: "font-size: 14px; border: 1px solid #000;",
type: "input"
},
cardcvc2: {
selector: "cvc",
type: "password", // Could be "text" as well.
style: "font-size: 14px; border: 1px solid #000;",
size: "4",
maxlength: "4",
length: { "V": 3, "M": 3 } // enforce 3 digit CVC für VISA and Mastercard
},
cardexpiremonth: {
selector: "cardexpirymonth",
type: "text", // select (default), text, <span class="sp-highlight-term underline sp-cursor-pointer" style="background-color: rgb(255, 255, 255);">tel</span>
size: "2",
maxlength: "2",
iframe: {
width: "40px"
},
style: "font-size: 14px; width: 30px; border: solid 1px #000; height: 22px;"
},
cardexpireyear: {
selector: "cardexpiryyear",
type: "text", // select (default), text, <span class="sp-highlight-term underline sp-cursor-pointer" style="background-color: rgb(255, 255, 255);">tel</span>
iframe: {
width: "60px"
},
style: "font-size: 14px; width: 50px; border: solid 1px #000; height: 22px;"
}
},
defaultStyle: {
input: "font-size: 1em; border: 1px solid #000; width: 175px;",
select: "font-size: 1em; border: 1px solid #000;",
iframe: {
height: "22px",
width: "180px"
}
},
autoCardtypeDetection: {
supportedCardtypes: supportedCardtypes,
callback: (detectedCardtype: any) => {
// For the output container below.
// @ts-ignore
document.getElementById('autodetectionResponsePre').innerHTML = detectedCardtype;
if (detectedCardtype === 'V') {
// @ts-ignore
document.getElementById('visa').style.borderColor = '#00F';
// @ts-ignore
document.getElementById('mastercard').style.borderColor = '#FFF';
} else if (detectedCardtype === 'M') {
// @ts-ignore
document.getElementById('visa').style.borderColor = '#FFF';
// @ts-ignore
document.getElementById('mastercard').style.borderColor = '#00F';
} else {
// @ts-ignore
document.getElementById('visa').style.borderColor = '#FFF';
// @ts-ignore
document.getElementById('mastercard').style.borderColor = '#FFF';
}
} //,
// deactivate: true // To turn off automatic card type detection.
},
language: 'de', //, // Language to display error-messages (default: Payone.ClientApi.Language.en)
error: "error" // area to display error-messages (optional)
};
const request = {
'mid': ID,
'portalid': ID,
'aid': ID,
'hash': this.generateJsHash(),
'mode': 'test',
'responsetype': 'JSON',
'encoding': 'UTF-8',
'request': 'creditcardcheck',
'storecarddata': 'yes'
};
this.iframes = new Payone.ClientApi.HostedIFrames(config, request);
const cardTypesLine = document.querySelector('#checkoutCardTypesLine')
// @ts-ignore
cardTypesLine.innerHTML = this._supportedCardTypes.reduce((acc, type) => (
acc + `<img class="payone-checkout__card ${type === 'V' ? 'payone-checkout__card-visa' : ''}" data-card-type="${type}" src="https://cdn.pay1.de/cc/${type.toLowerCase()}/s/transparent.png" alt="${type} card icon">`
), '')
}
onSubmit() {
console.log("isCardTypeComplete", this.iframes.isCardTypeComplete());
console.log("isCardpanComplete", this.iframes.isCardpanComplete());
console.log("isCvcComplete", this.iframes.isCvcComplete());
console.log("isExpireMonthComplete", this.iframes.isExpireMonthComplete());
console.log("isExpireYearComplete", this.iframes.isExpireYearComplete());
console.log("check", this.iframes.isComplete());
if (this.iframes.isComplete()) {
// Perform "CreditCardCheck" to create and get a PseudoCardPan; then call your function "payCallback"
this.iframes.creditCardCheck('payCallback');
} else {
alert("Not complete. Nothing done.");
}
}
payCallback(response:any) {
}
public generateJsHash(): string
{
// logic to generate hash
}
}
`
My Html:
Card number
Expire month
<div class="payone-checkout__col">
<label for="cardexpiryyear">Expire year</label>
<section id="cardexpiryyear"></section>
</div>
</div>
CVC
<div class="payone-checkout__col">
<label for="country">Country</label>
<select name="country" id="country">
<option value="DE">Germany</option>
<option value="GB">United Kingdom</option>
</select>
</div>
</div>
Surname
Submit
The JSON received from the server
Autodetection callback result
The JSON received from the server
Autodetection callback result

Hi,
ich see your checkout demo with the iframe solution and it works well if i start your project. If i adapt this to my own project i get this two values as FALSE so the check can not perform.
This is my Code:
TS FILE:
`
export class HomeComponent implements AfterViewInit {
iframes: any;
_creditCardCheckResponse: any;
_supportedCardTypes: string[];
constructor() {
this._supportedCardTypes = ['V', 'M']
}
ngAfterViewInit() {
this.initPayone();
}
initPayone() {
}
onSubmit() {
console.log("isCardTypeComplete", this.iframes.isCardTypeComplete());
console.log("isCardpanComplete", this.iframes.isCardpanComplete());
console.log("isCvcComplete", this.iframes.isCvcComplete());
console.log("isExpireMonthComplete", this.iframes.isExpireMonthComplete());
console.log("isExpireYearComplete", this.iframes.isExpireYearComplete());
console.log("check", this.iframes.isComplete());
if (this.iframes.isComplete()) {
// Perform "CreditCardCheck" to create and get a PseudoCardPan; then call your function "payCallback"
this.iframes.creditCardCheck('payCallback');
} else {
alert("Not complete. Nothing done.");
}
}
payCallback(response:any) {
}
public generateJsHash(): string
{
// logic to generate hash
}
}
`
My Html:
The JSON received from the server
Autodetection callback result
The JSON received from the server
Autodetection callback result