Web SDK Core
Library for generating cryptograms from data received from the payment form. The library generates the response asynchronously! A callback is used to get the result.
The library is used by the Merchant on their website. A list of payment form parameters (mdOrder
, pan
, expiry
, etc.) is passed to the library, and the output is a cryptogram ready for transfer to the acquiring backend.
Example of use
<script src="https://3dsec.berekebank.kz/payment/modules/card-kit-core/card-kit-core.js"></script>
<script>
window.CKCToken.generateWithCard(
{
pan: '4111111111111111',
cvc: '123',
expiryMMYY: '12/24',
mdOrder: '63447c9c-b432-7c8e-962f-161c0008f9da',
// pubKey: '-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAioZS/AN/xWtZsQNFjOc8VjKnE5xwQuT0zV0q2j2JpBN66We1+dya9gfqt14Mg53tHfvTB+hbHpmK8mYlPdpZXnIIN3TuBv9llfwmAMm4pFRDG8KeIgOVLSGptHufjwoh2iE4YfxZWgCbnkqjDk6YiTPdy+W7nxF+fPUEsFE1YJDTRwzVqpsbjfKW9tQAjDxpAwfsiyhk0NzTEsDahWtjk1+WaqqrN0LRQgtaTnnbjSr3npmegu63mgTXBX1MT5olRY+BjCaPCZLt+6sFNd/wVI+UBo3/U6jHEHVe3T1vdZWNhJe2twFzrSSpm5aevDK7OpQzMT7v2wUIRWIlFvIxFwIDAQAB-----END PUBLIC KEY-----',
},
function (result) {
console.log('Result:', result);
// // Example result:
// {
// token: null,
// errors: [
// {field: "pan", error: "invalid-length"},
// {field: "cvc", error: "required"}
// ]
// }
}
);
</script>
Parameters
Parameter | Mandatory | Purpose |
---|---|---|
mdOrder | yes | Identifier of the order |
pan | yes | Card number (no spaces) |
cvc | no | CVV/CVC code of the card |
expiryMMYY | no | date in MM/YY or MMYY format |
pubKey | no | Public key for encryption (if the parameter is not set, the key will be obtained from the server automatically) |
Errors
Error type | Explanation |
---|---|
required | The field is required. |
invalid-format | Data format is invalid. |
invalid-length | Field length is invalid. |
invalid-pub-key | Key is invalid. |
get-pub-key-failed | Failed to get key from server. |
Response format
{
token: "...", // obtained token ready for passing
errors: [ // errors array
{
field: "pan", // Field name
error: "invalid-length" // Error type
},
]
}
Example of payment request with generated cryptogram
curl --location --request POST 'https://3dsec.berekebank.kz/payment/rest/paymentorder.do' \
--header 'Content-type: application/x-www-form-urlencoded' \
--data-urlencode 'MDORDER=63447c9c-b432-7c8e-962f-161c0008f9da' \
--data-urlencode 'language=en' \
--data-urlencode 'TEXT=CARDHOLDER NAME' \
--data-urlencode 'email=' \
--data-urlencode 'seToken=Cfqv4t2XHBb9k8ixM7jxxCvziETS4koa3bV3F0QUvGVY47nKyMBqjGzV%2FrvmCAw6KzwoBDzeLsqwBLEzvQhaF627ZS0OJnhttBi4fL3%2Fh%2FsBSwFtxr3s%2BoVUeoE3e4SNVUq9vciinOyNCIKqfpeQya%2BpOUYt3MgrtSeu66Ar12XEj4k6lecZN7Ffquj9RqhZsYhP63np5VCxJR90cNQG%2BTMWIFU6rqxLAe4gzCJtcXNrPT8aDOI201Zwd%2Be4K1YnrI7dZGlibO7MVMPB9m7NJaJTHko%2FMiJNWumAjS4yDDovLraIKMwOFTvAhqXsHslthpcUO0GZXEIaDRgERD7%2Bjw%3D%3D' \
--data-urlencode 'userName=tm-api' \
--data-urlencode 'password=XXXXXXX'