Web SDK Core
Library for generating cryptograms from data received from the payment form. The library generates the response asynchronously! A webhook is used to get the result.
The library is used by the Merchant on their website. A list of payment form parameters (pan
, expiry
, cvc
, 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://dev.bpcbt.com/payment/modules/card-kit-core/card-kit-core.js"></script>
<script>
window.CKCToken.generateWithCard(
{
pan: '4111111111111111',
cvc: '123',
expiryMMYY: '12/24',
// 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);
}
);
</script>
Parameters
Parameter | Mandatory | Purpose |
---|---|---|
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://dev.bpcbt.com/api2/payments' \
--header 'X-Api-Key: 6HUXQFbeomV1zf5i8cgm5W8KfncENVEa5uh8RngB' \
--header 'Content-Type: application/json' \
--data '{
"amount": 70000,
"currency": "EUR",
"paymentMethod": {
"type": "card",
"card": {
"token": "GmOWQLXeBH+eghJcI2DKOKYp5fkYVxagcZYfW/dY2aQqDNBBro8VntVAw4+DuKK3adiyfFLn+SMCxL/DUSMO4dMVy+RI8E7riHwCMiFDDvfX9PuBLQ/JstLBcrxctm2ctIRb5lY7tGO79s5W0njhC8ugck81hJtsWBCi0GbOoUalJGPJG9MtG6omuFsAIswRHnVerq92Wc2g/ZyUDz23zK5I6azGMQEVPdLZae1SCiQ+Fa+X6EBme1QbXlAGackwHCXgQ2uhGDt3Xb/DGgNFP5VQa/MMa70nlJYWvsAlXQoUPdEv9V5zOHOh8G2fntXECSlRA2QnVwN5XhvKRnWMaw=="
}
},
"returnUrl": "https://mybestmerchantreturnurl.com/"
}'
Categories:
eCommerce
SDK
API V2