I’m trying to implement web payment API with EMV 3D secure to my web store.
I’m not sure the reason, but paymentMethod.tokenize(verificationDetails) returns unknown error on sandbox environment.
The code is almost identical with sample code, like this,
const verificationDetails = {
amount: '10.00',
billingContact: {
givenName: 'John',
familyName: 'Doe',
email: '[email protected]',
phone: '3214563987',
},
currencyCode: 'JPY',
intent: 'CHARGE',
customerInitiated: true,
sellerKeyedIn: false
};
const tokenResult = await paymentMethod.tokenize(verificationDetails);
if (tokenResult.status === 'OK') {
return tokenResult.token;
} else {
let errorMessage = `Tokenization failed with status: ${tokenResult.status}`;
if (tokenResult.errors) {
errorMessage += ` and errors: ${JSON.stringify(
tokenResult.errors
)}`;
}
throw new Error(errorMessage);
}
It works without 3D secure, means tokenize() works without argument.
Javascript console said,
Tokenization has faild.
An unknown error has occurred.
(Anonymous Funcion) - square.js:5826
...
Any ideas?