Customer credit check and invoice creation

Setting-up secure communication between Twisto and the e-shop

Twisto API provides two modes: Production and Testing. E-shop has two API keys (public and secret) for each mode.

  • A public key is used to identify e-shop and can be placed directly in your HTML code. It is used to initialize the Twisto.js library, it needs to be set up in _twisto_config object.
  • A secret key is used to encrypt and authenticate requests. This key must be secret and must not appear publicly anywhere. It is used in back-end eshop libraries, or when manually creating an API request.

Warning: It is necessary to add your domain to allowed domains in e-shop administration. JS library can’t be used in any other domain for security reasons. If you will try to use the library on another domain, it will not work.

The test mode is used to test the implementation, and it has no effect on the production mode.Requests and errors can be seen directly in the administration interface. Both modes can be used simultaneously and independently of each other. Each mode has its own keys.

Setting up public key in a browser (Twisto.js)

<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>

Note: The above code makes asynchronous JS call with minimal impact on load page speed.

Setting up keys in back-end eshop libraries

<?php $twisto = new Twisto\Twisto(); $twisto->setPublicKey(''); // You can find your public key in your administration $twisto->setSecretKey(''); // You can find your secret key in your administration ?>

E-shop Administration

E-shop Administration provides access to the Twisto API requests logs. The settings are separate for test and production modes. Please make sure you have the mode switcher in correct position.

Admin Log Image

In the "Integration" section you can find the API keys and set up your e-shop parameters.

Admin Integration Image