JS library
Set public key
<script type="text/javascript">
var _twisto_config = {
public_key: "", // You can find your public key in your administration
script: "https://api.twisto.cz/v2/lib/twisto.js",
};
(function(e,g,a){function h(a){return function(){b._.push([a,arguments])}}var f=["check"],b=e||{},c=document.createElement(a);a=document.getElementsByTagName(a)[0];b._=[];for(var d=0;d<f.length;d++)b[f[d]]=h(f[d]);this[g]=b;c.type="text/javascript";c.async=!0;c.src=e.script;a.parentNode.insertBefore(c,a);delete e.script}).call(window,_twisto_config,"Twisto","script");
</script>
Twisto.check(data, success, error, [options])
Argument | Description |
---|---|
data (array) | JSON order data |
success (function) | Is triggered in case of successful communication with the server |
error (function) | Is triggered in case of unsuccessful communication with the server |
options (object) | Optional. Available options. processingStarted (function) – Is triggered after successful start of processing. |
Performs a customer check and confirms or rejects a payment through Twisto
Twisto.check(
data, // JSON order data
(response) => {
// success callback
if (response.status === 'accepted') {
console.log('check passed and order is accepted')
} else {
console.log('check passed but order has been rejected')
}
},
(response) => {
console.log('error when calling check') // error callback - network error
},
{ processingStarted: (data) => console.log('processingStarted') } // we allow processingStarted in options object
)
Scoring processing started
Example function that is triggered after successful start of scoring
processingStarted(data)
data (object) | Object containing additional information |
transactionid (_string) | ID of transaction |
{
"transaction_id": "hisnmy6enxhq07rx69hniwwd"
}