{"title":"Activate scanning a single barcode using Terminal API","category":"default","creationDate":1672052400,"content":"<div class=\"additional-info-block output-inline\">\n<h5 class=\"article__heading additional-info-block__title\">Multiple barcodes<\/h5><div class=\"additional-info-block__body\"><p>To scan multiple barcodes instead of a single barcode, you can start a <a href=\"\/pt\/point-of-sale\/android-terminals\/scan-barcode\/batch-session\">batch scan session<\/a>.<\/p><\/div><\/div>\n\n<p>On Android payment terminals <a href=\"\/pt\/point-of-sale\/user-manuals\/s1e-user-manual\">S1E Barcode<\/a>, <a href=\"\/pt\/point-of-sale\/user-manuals\/s1e2l-user-manual\">S1E2L<\/a>, <a href=\"\/pt\/point-of-sale\/user-manuals\/s1f2-user-manual\">S1F2L<\/a>, and <a href=\"\/pt\/point-of-sale\/user-manuals\/s1u2-user-manual\">S1U2<\/a> you can use Terminal API requests to:<\/p>\n<ul>\n<li>Activate the scan button on the terminal so that your staff can scan a single item.<\/li>\n<li>Cancel scanning to deactivate the barcode scanner and the scan button.<\/li>\n<li>Specify how much time you want to allow for scanning.<\/li>\n<\/ul>\n<p>You do not need to <a href=\"\/pt\/point-of-sale\/android-terminals\/scan-barcode\/button-scan\">set up the scanning button<\/a> in the Customer Area to use this method.<\/p>\n<h2>Requirements<\/h2>\n<p>Before you begin, take into account the following requirements, limitations, and preparations.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Requirement<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><strong>Integration type<\/strong><\/td>\n<td style=\"text-align: left;\">A <a href=\"\/pt\/point-of-sale\/design-your-integration\/terminal-api\/\">Terminal API integration<\/a> with payment terminals.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>Hardware<\/strong><\/td>\n<td style=\"text-align: left;\">Android payment terminal models <a href=\"\/pt\/point-of-sale\/user-manuals\/s1e-user-manual\">S1E Barcode<\/a>, <a href=\"\/pt\/point-of-sale\/user-manuals\/s1e2l-user-manual\">S1E2L<\/a>, <a href=\"\/pt\/point-of-sale\/user-manuals\/s1f2-user-manual\">S1F2L<\/a>, or <a href=\"\/pt\/point-of-sale\/user-manuals\/s1u2-user-manual\">S1U2<\/a> that have a barcode scanner.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>Setup steps<\/strong><\/td>\n<td style=\"text-align: left;\">Before you begin: <ul><li markdown=\"1\">You need to implement a way to process the scanned content in your POS app.<li markdown=\"1\">Implement a button in your POS app UI to trigger the scan.<\/li><\/ul><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>How it works<\/h2>\n<ol>\n<li>You send an admin request to activate the barcode scanner.<\/li>\n<li>Your staff scans an item.<\/li>\n<li>A successful scan deactivates the barcode scanning button, and you receive the barcode content in the response to the admin request.<\/li>\n<li>With the logic that you have created, you pass the content from the response to your POS app.<\/li>\n<\/ol>\n<h2>Activate the barcode scanner for a single scan<\/h2>\n<p>To activate the barcode scanner for a single scan, you only need to send a request.<\/p>\n<ol>\n<li>\n<p>Create a JSON object with the following data elements:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Parameter<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><code>Session<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\">An object with: <ul><li markdown=\"1\"><code>Id<\/code>: your unique reference of the scanning session.<\/li> <li markdown=\"1\"><code>Type<\/code>: <span translate=\"no\"><strong>Once<\/strong><\/span> activates the barcode scanner.<\/li><\/ul><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>Operation<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\">An object with: <ul><li markdown=\"1\"><code>Type<\/code>: <span translate=\"no\"><strong>ScanBarcode<\/strong><\/span>.<\/li><li markdown=\"1\"><code>TimeoutMs<\/code>: how long the barcode scanner stays on, in milliseconds (from 0 to 30000).<\/li><\/ul><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Activate barcode scanner'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n    \\\"Session\\\": {\\n        \\\"Id\\\": 12345,\\n        \\\"Type\\\": \\\"Once\\\"\\n    },\\n    \\\"Operation\\\": [\\n        {\\n            \\\"Type\\\": \\\"ScanBarcode\\\",\\n            \\\"TimeoutMs\\\": 5000\\n        }\\n    ]\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Encode the JSON object to Base64.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Base64 encoded message'\" :id=\"''\" :code-data='[{\"language\":\"raw\",\"tabTitle\":\"\",\"content\":\"ewogICAgIlNlc3Npb24iOnsKICAgICAgICAiSWQiOjEyMzQ1LAogICAgICAgICJUeXBlIjoiT25jZSIKICAgIH0sCiAgICAiT3BlcmF0aW9uIjpbCiAgICAgICAgewogICAgICAgICAgICAiVHlwZSI6IlNjYW5CYXJjb2RlIiwKICAgICAgICAgICAgIlRpbWVvdXRNcyI6NTAwMAogICAgICAgIH0KICAgIF0KfQ==\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Make a <a href=\"\/pt\/point-of-sale\/design-your-integration\/terminal-api\">Terminal API<\/a> admin request, specifying:<\/p>\n<ul>\n<li>\n<p>The standard <a href=\"\/pt\/point-of-sale\/design-your-integration\/terminal-api#request-message-header\">\n  <code>SaleToPOIRequest.MessageHeader<\/code>\n<\/a> object, with <code>MessageClass<\/code> set to <span translate=\"no\"><strong>Service<\/strong><\/span> and <code>MessageCategory<\/code> set to <span translate=\"no\"><strong>Admin<\/strong><\/span>.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Parameter<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><code>ProtocolVersion<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\"><strong>3.0<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>MessageClass<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>Service<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>MessageCategory<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>Admin<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>MessageType<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>Request<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>ServiceID<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\">Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (<code>POIID<\/code>) being used.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>SaleID<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\">Your unique ID for the POS system component to send this request from.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>POIID<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\">The unique ID of the terminal to send this request to. Format: <em>[device model]-[serial number]<\/em>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>The  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/terminal-api\/latest\/post\/admin\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">AdminRequest<\/a> object, including:<\/p>\n<ul>\n<li>\n<p><code>ServiceIdentification<\/code>: The Base64-encoded JSON object.<\/p>\n<!-- list separator -->\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Activate barcode scanner request'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"SaleToPOIRequest\\\": {\\n      \\\"MessageHeader\\\": {\\n         \\\"ProtocolVersion\\\": \\\"3.0\\\",\\n         \\\"MessageClass\\\": \\\"Service\\\",\\n         \\\"MessageCategory\\\": \\\"Admin\\\",\\n         \\\"MessageType\\\": \\\"Request\\\",\\n         \\\"ServiceID\\\": \\\"POSSystemID12345\\\",\\n         \\\"SaleID\\\": \\\"S00101\\\",\\n         \\\"POIID\\\": \\\"S1EL-324688179\\\"\\n      },\\n      \\\"AdminRequest\\\": {\\n         \\\"ServiceIdentification\\\": \\\"ewogICAgIlNlc3Npb24iOiB7CiAgICAgICAgIklkIjogMTIzNDUsCiAgICAgICAgIlR5cGUiOiAiQmVnaW4iCiAgICB9LAogICAgIk9wZXJhdGlvbiI6IFsKICAgICAgICB7CiAgICAgICAgICAgICJUeXBlIjogIlNjYW5CYXJjb2RlIiwKICAgICAgICAgICAgIlRpbWVvdXRNcyI6IDUwMDAKICAgICAgICB9CiAgICBdCn0=\\\"\\n       }\\n   }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The terminal operator can now scan a barcode.<\/p>\n<\/li>\n<li>\n<p>In the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/terminal-api\/latest\/post\/admin#responses-200-Response\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">AdminResponse<\/a>, note:<\/p>\n<ul>\n<li>If successful, the following fields are returned:\n<ul>\n<li><code>Response.Result<\/code>: <span translate=\"no\"><strong>Success<\/strong><\/span><\/li>\n<li><code>AdditionalResponse<\/code>: Contains the Base64-encoded barcode content.<\/li>\n<\/ul><\/li>\n<li>If unsuccessful, the following fields are returned:\n<ul>\n<li><code>Response.Result<\/code>: <span translate=\"no\"><strong>Failure<\/strong><\/span><\/li>\n<li><code>ErrorCondition<\/code>: <span translate=\"no\"><strong>Cancel<\/strong><\/span>, <span translate=\"no\"><strong>Aborted<\/strong><\/span>, <span translate=\"no\"><strong>UnavailableService<\/strong><\/span>, or <span translate=\"no\"><strong>NotFound<\/strong><\/span><\/li>\n<li><code>AdditionalResponse<\/code>: Contains the reason for failure as a Base64-encoded string. Decoding the string results in a message of the following format: <code>{ \"message\": \"Admin ScanBarcode request canceled due to Timeout\" }<\/code>.<\/li>\n<\/ul><\/li>\n<\/ul>\n<div class=\"notices green\">\n<p>The format of the <code>AdditionalResponse<\/code> can be a Base64-encoded or URL-encoded. To always receive the <code>AdditionalResponse<\/code> in one of those formats, contact our <a href=\"https:\/\/ca-test.adyen.com\/ca\/ca\/contactUs\/support.shtml?form=other\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Support Team<\/a>.<\/p>\n<\/div>\n\n<div id=\"tabpCwuc\">\n    <div data-component-wrapper=\"tabs\">\n        <tabs\n                        :items=\"[{&quot;title&quot;:&quot;Activate barcode scanner response - success&quot;,&quot;content&quot;:&quot;\\n&lt;pre&gt;&lt;code class=\\&quot;language-json\\&quot;&gt;{\\n    \\&quot;SaleToPOIResponse\\&quot;: {\\n        \\&quot;AdminResponse\\&quot;: {\\n            \\&quot;Response\\&quot;: {\\n                \\&quot;Result\\&quot;: \\&quot;Success\\&quot;,\\n                 \\&quot;AdditionalResponse\\&quot;: \\&quot;eyAiQmFyY29kZSI6IHsgIkRhdGEiOiAiODYwMDE5NzQxNjgyNCIsICJTeW1ib2xvZ3kiOiAiUVJfQ09ERSIgfSB9\\&quot;\\n            }\\n        },\\n        \\&quot;MessageHeader\\&quot;: {\\n            \\&quot;MessageCategory\\&quot;: \\&quot;Admin\\&quot;,\\n            \\&quot;MessageClass\\&quot;: \\&quot;Service\\&quot;,\\n            \\&quot;MessageType\\&quot;: \\&quot;Response\\&quot;,\\n            \\&quot;POIID\\&quot;: \\&quot;S1EL-324688179\\&quot;,\\n            \\&quot;ProtocolVersion\\&quot;: \\&quot;3.0\\&quot;,\\n            \\&quot;SaleID\\&quot;: \\&quot;POSSystemID12345\\&quot;,\\n            \\&quot;ServiceID\\&quot;: \\&quot;S00101\\&quot;\\n        }\\n    }\\n}&lt;\\\/code&gt;&lt;\\\/pre&gt;\\n&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:&quot;activate_barcode_scanner_response_-_success_0_1&quot;,&quot;relation&quot;:&quot;&quot;},{&quot;title&quot;:&quot;Activate barcode scanner response - failure&quot;,&quot;content&quot;:&quot;\\n&lt;pre&gt;&lt;code class=\\&quot;language-json\\&quot;&gt;{\\n    \\&quot;SaleToPOIResponse\\&quot;: {\\n        \\&quot;AdminResponse\\&quot;: {\\n            \\&quot;Response\\&quot;: {\\n                \\&quot;AdditionalResponse\\&quot;: \\&quot;eyAibWVzc2FnZSI6ICJBZG1pbiBTY2FuQmFyY29kZSByZXF1ZXN0IGNhbmNlbGVkIGR1ZSB0byBUaW1lb3V0IiB9\\&quot;,\\n                   \\&quot;ErrorCondition\\&quot;: \\&quot;Cancel\\&quot;,\\n                   \\&quot;Result\\&quot;: \\&quot;Failure\\&quot;\\n            }\\n        },\\n           \\&quot;MessageHeader\\&quot;: {\\n            \\&quot;ProtocolVersion\\&quot;: \\&quot;3.0\\&quot;,\\n            \\&quot;MessageClass\\&quot;: \\&quot;Service\\&quot;,\\n            \\&quot;MessageCategory\\&quot;: \\&quot;Admin\\&quot;,\\n            \\&quot;MessageType\\&quot;: \\&quot;Request\\&quot;,\\n            \\&quot;ServiceID\\&quot;: \\&quot;POSSystemID12345\\&quot;,\\n            \\&quot;SaleID\\&quot;: \\&quot;S00101\\&quot;,\\n            \\&quot;POIID\\&quot;: \\&quot;S1EL-324688179\\&quot;\\n        }\\n    }\\n}&lt;\\\/code&gt;&lt;\\\/pre&gt;\\n&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:&quot;activate_barcode_scanner_response_-_failure_1_2&quot;,&quot;relation&quot;:&quot;&quot;}]\"\n            :should-update-when-url-changes='false'>\n        <\/tabs>\n    <\/div>\n<\/div>\n\n<\/li>\n<li>\n<p>If <code>Response.Result<\/code> is <span translate=\"no\"><strong>Success<\/strong><\/span>, decode the Base64-encoded string in the <code>AdditionalResponse<\/code>.<br \/>\nNote that this contains:<\/p>\n<ul>\n<li><code>Barcode.Data<\/code>: the content of the scanned barcode.<\/li>\n<li><code>Barcode.Symbology<\/code>: the format of the scanned barcode. If the <a href=\"\/pt\/point-of-sale\/android-terminals\/scan-barcode#barcode-symbologies\">symbology<\/a> is not recognized, the response returns <code>UNKNOWN<\/code>.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Decoded Base64 AdditionalResponse'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n    \\\"Barcode\\\":{\\n        \\\"Data\\\":\\\"8600197416824\\\",\\n        \\\"Symbology\\\":\\\"QR_CODE\\\"\\n    }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>You process the content from the response in your POS app with the logic that you have implemented.<\/p>\n<\/li>\n<\/ol>\n<p>If you want to turn off the barcode scanner before the timeout, you need to send a request to <a href=\"#cancel-session\">cancel the scanning session<\/a>.<\/p>\n<h2 id=\"cancel-session\">Cancel scanning session<\/h2>\n<p>If you want to cancel the activation of the terminal's barcode scanner before the specified timeout, you need to send an <code>AdminRequest<\/code> with the <code>Session.Type<\/code> <span translate=\"no\"><strong>End<\/strong><\/span>.<\/p>\n<ol>\n<li>\n<p>Create a JSON object with the following data elements:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Parameter<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><code>ServiceIdentification.Session<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\">An object with: <ul><li markdown=\"1\"><code>Id<\/code>: the unique reference of the session.<\/li> <li markdown=\"1\"><code>Type<\/code>: <span translate=\"no\"><strong>End<\/strong><\/span> cancels the scanning session.<\/li><\/ul><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Data elements in JSON format'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"\\t{\\n\\t   \\\"Session\\\": {\\n\\t\\t  \\\"Id\\\": 12345,\\n\\t\\t  \\\"Type\\\": \\\"End\\\"\\n\\t   }\\n\\t}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Encode the JSON object to Base64.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Base64 encoded message'\" :id=\"''\" :code-data='[{\"language\":\"raw\",\"tabTitle\":\"\",\"content\":\"\\tewogICAiU2Vzc2lvbiI6ewogICAgICAiSWQiOjEyMzQ1LAogICAgICAiVHlwZSI6IkVuZCIKICAgfQp9\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Make a <a href=\"\/pt\/point-of-sale\/design-your-integration\/terminal-api\">Terminal API<\/a> admin request, specifying:<\/p>\n<ul>\n<li>\n<p>The standard <a href=\"\/pt\/point-of-sale\/design-your-integration\/terminal-api#request-message-header\">\n  <code>SaleToPOIRequest.MessageHeader<\/code>\n<\/a> object, with <code>MessageClass<\/code> set to <span translate=\"no\"><strong>Service<\/strong><\/span> and <code>MessageCategory<\/code> set to <span translate=\"no\"><strong>Admin<\/strong><\/span>.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Parameter<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><code>ProtocolVersion<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\"><strong>3.0<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>MessageClass<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>Service<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>MessageCategory<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>Admin<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>MessageType<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\"><span translate=\"no\"><strong>Request<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>ServiceID<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\">Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (<code>POIID<\/code>) being used.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>SaleID<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\">Your unique ID for the POS system component to send this request from.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>POIID<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td style=\"text-align: left;\">The unique ID of the terminal to send this request to. Format: <em>[device model]-[serial number]<\/em>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>The  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/terminal-api\/latest\/post\/admin\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">AdminRequest<\/a> object, including:<\/p>\n<ul>\n<li>\n<p><code>ServiceIdentification<\/code>: the Base64-encoded JSON object.<\/p>\n<!-- list separator -->\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'End scanning session'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"\\t{\\n\\t   \\\"SaleToPOIRequest\\\":{\\n\\t\\t   \\\"MessageHeader\\\":{\\n             \\\"ProtocolVersion\\\":\\\"3.0\\\",\\n\\t\\t\\t  \\\"MessageClass\\\":\\\"Service\\\",\\n\\t\\t\\t  \\\"MessageCategory\\\":\\\"Admin\\\",\\n\\t\\t\\t  \\\"MessageType\\\":\\\"Request\\\",\\n\\t\\t\\t  \\\"ServiceID\\\":\\\"S00101\\\",\\n\\t\\t\\t  \\\"SaleID\\\":\\\"POSSystemID12345\\\",\\n\\t\\t\\t  \\\"POIID\\\":\\\"S1EL-324688179\\\"\\n\\t\\t   },\\n\\t\\t   \\\"AdminRequest\\\":{\\n\\t\\t\\t   \\\"ServiceIdentification\\\": \\\"ewogICAiU2Vzc2lvbiI6ewogICAgICAiSWQiOjEyMzQ1LAogICAgICAiVHlwZSI6IkVuZCIKICAgfQp9\\\"\\n\\t\\t   }\\n\\t   }\\n\\t}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>If the cancel request succeeds, in the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/terminal-api\/latest\/post\/admin#responses-200-Response\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">AdminResponse<\/a> note:<\/p>\n<ul>\n<li><code>Response.Result<\/code>: <span translate=\"no\"><strong>Success<\/strong><\/span><\/li>\n<li><code>AdditionalResponse<\/code>: Contains the Base64-encoded message. Decoding the string results in a message of the following format: <code>{ \"message\": \"Admin ScanBarcode request was successfully canceled\" }<\/code><\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'End scanning session response - success'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"SaleToPOIResponse\\\": {\\n      \\\"MessageHeader\\\": {\\n         \\\"ProtocolVersion\\\": \\\"3.0\\\",\\n         \\\"MessageClass\\\": \\\"Service\\\",\\n         \\\"MessageCategory\\\": \\\"Admin\\\",\\n         \\\"MessageType\\\": \\\"Request\\\",\\n         \\\"ServiceID\\\": \\\"POSSystemID12345\\\",\\n         \\\"SaleID\\\": \\\"S00101\\\",\\n         \\\"POIID\\\": \\\"V400m-324688179\\\"\\n      },\\n      \\\"AdminResponse\\\": {\\n         \\\"Response\\\": {\\n         \\\"Result\\\": \\\"Success\\\",\\n            \\\"AdditionalResponse\\\": \\\"eyAibWVzc2FnZSI6ICJBZG1pbiBTY2FuQmFyY29kZSByZXF1ZXN0IHdhcyBzdWNjZXNzZnVsbHkgY2FuY2VsZWQiIH0=\\\"\\n         }\\n      }\\n   }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2>See also<\/h2>\n<div class=\"see-also-links output-inline\" id=\"see-also\">\n<ul><li><a href=\"\/point-of-sale\/shopper-engagement\/create-session\"\n                        target=\"_self\"\n                        >\n                    Create a session\n                <\/a><\/li><li><a href=\"\/point-of-sale\/android-terminals\/scan-barcode\/button-scan\"\n                        target=\"_self\"\n                        >\n                    Use terminal button to scan barcodes\n                <\/a><\/li><li><a href=\"\/point-of-sale\/android-terminals\/scan-barcode\/batch-session\"\n                        target=\"_self\"\n                        >\n                    Multiple barcode scans with Terminal API\n                <\/a><\/li><\/ul><\/div>\n","url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/android-terminals\/scan-barcode\/single-session","articleFields":{"description":"Create a scanning session to scan a single barcode.","feedback_component":true,"last_edit_on":"24-04-2025 10:30","page_id":"262d2cc2-e6a0-423d-9b82-e26684d36683","filters_component":false,"decision_tree":"[]"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/android-terminals\/scan-barcode\/single-session","title":"Activate scanning a single barcode using Terminal API","content":"\nMultiple barcodesTo scan multiple barcodes instead of a single barcode, you can start a batch scan session.\n\nOn Android payment terminals S1E Barcode, S1E2L, S1F2L, and S1U2 you can use Terminal API requests to:\n\nActivate the scan button on the terminal so that your staff can scan a single item.\nCancel scanning to deactivate the barcode scanner and the scan button.\nSpecify how much time you want to allow for scanning.\n\nYou do not need to set up the scanning button in the Customer Area to use this method.\nRequirements\nBefore you begin, take into account the following requirements, limitations, and preparations.\n\n\n\nRequirement\nDescription\n\n\n\n\nIntegration type\nA Terminal API integration with payment terminals.\n\n\nHardware\nAndroid payment terminal models S1E Barcode, S1E2L, S1F2L, or S1U2 that have a barcode scanner.\n\n\nSetup steps\nBefore you begin: You need to implement a way to process the scanned content in your POS app.Implement a button in your POS app UI to trigger the scan.\n\n\n\nHow it works\n\nYou send an admin request to activate the barcode scanner.\nYour staff scans an item.\nA successful scan deactivates the barcode scanning button, and you receive the barcode content in the response to the admin request.\nWith the logic that you have created, you pass the content from the response to your POS app.\n\nActivate the barcode scanner for a single scan\nTo activate the barcode scanner for a single scan, you only need to send a request.\n\n\nCreate a JSON object with the following data elements:\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\nSession\n\nAn object with: Id: your unique reference of the scanning session. Type: Once activates the barcode scanner.\n\n\nOperation\n\nAn object with: Type: ScanBarcode.TimeoutMs: how long the barcode scanner stays on, in milliseconds (from 0 to 30000).\n\n\n\n\n\n\n\n\nEncode the JSON object to Base64.\n\n\n\n\n\nMake a Terminal API admin request, specifying:\n\n\nThe standard \n  SaleToPOIRequest.MessageHeader\n object, with MessageClass set to Service and MessageCategory set to Admin.\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\nProtocolVersion\n\n3.0\n\n\nMessageClass\n\nService\n\n\nMessageCategory\n\nAdmin\n\n\nMessageType\n\nRequest\n\n\nServiceID\n\nYour unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (POIID) being used.\n\n\nSaleID\n\nYour unique ID for the POS system component to send this request from.\n\n\nPOIID\n\nThe unique ID of the terminal to send this request to. Format: [device model]-[serial number].\n\n\n\n\n\n\n\nThe  AdminRequest object, including:\n\n\nServiceIdentification: The Base64-encoded JSON object.\n\n\n\n\n\n\n\n\nThe terminal operator can now scan a barcode.\n\n\nIn the  AdminResponse, note:\n\nIf successful, the following fields are returned:\n\nResponse.Result: Success\nAdditionalResponse: Contains the Base64-encoded barcode content.\n\nIf unsuccessful, the following fields are returned:\n\nResponse.Result: Failure\nErrorCondition: Cancel, Aborted, UnavailableService, or NotFound\nAdditionalResponse: Contains the reason for failure as a Base64-encoded string. Decoding the string results in a message of the following format: { \"message\": \"Admin ScanBarcode request canceled due to Timeout\" }.\n\n\n\nThe format of the AdditionalResponse can be a Base64-encoded or URL-encoded. To always receive the AdditionalResponse in one of those formats, contact our Support Team.\n\n\n\n    \n        \n        \n    \n\n\n\n\nIf Response.Result is Success, decode the Base64-encoded string in the AdditionalResponse.\nNote that this contains:\n\nBarcode.Data: the content of the scanned barcode.\nBarcode.Symbology: the format of the scanned barcode. If the symbology is not recognized, the response returns UNKNOWN.\n\n\n\n\n\n\nYou process the content from the response in your POS app with the logic that you have implemented.\n\n\nIf you want to turn off the barcode scanner before the timeout, you need to send a request to cancel the scanning session.\nCancel scanning session\nIf you want to cancel the activation of the terminal's barcode scanner before the specified timeout, you need to send an AdminRequest with the Session.Type End.\n\n\nCreate a JSON object with the following data elements:\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\nServiceIdentification.Session\n\nAn object with: Id: the unique reference of the session. Type: End cancels the scanning session.\n\n\n\n\n\n\n\n\nEncode the JSON object to Base64.\n\n\n\n\n\nMake a Terminal API admin request, specifying:\n\n\nThe standard \n  SaleToPOIRequest.MessageHeader\n object, with MessageClass set to Service and MessageCategory set to Admin.\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\nProtocolVersion\n\n3.0\n\n\nMessageClass\n\nService\n\n\nMessageCategory\n\nAdmin\n\n\nMessageType\n\nRequest\n\n\nServiceID\n\nYour unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (POIID) being used.\n\n\nSaleID\n\nYour unique ID for the POS system component to send this request from.\n\n\nPOIID\n\nThe unique ID of the terminal to send this request to. Format: [device model]-[serial number].\n\n\n\n\n\n\n\nThe  AdminRequest object, including:\n\n\nServiceIdentification: the Base64-encoded JSON object.\n\n\n\n\n\n\n\n\n\n\nIf the cancel request succeeds, in the  AdminResponse note:\n\nResponse.Result: Success\nAdditionalResponse: Contains the Base64-encoded message. Decoding the string results in a message of the following format: { \"message\": \"Admin ScanBarcode request was successfully canceled\" }\n\n\n\n\n\n\nSee also\n\n\n                    Create a session\n                \n                    Use terminal button to scan barcodes\n                \n                    Multiple barcode scans with Terminal API\n                \n","type":"page","locale":"pt","boost":16,"hierarchy":{"lvl0":"Home","lvl1":"Terminais","lvl2":"Android terminals","lvl3":"Barcode scanning","lvl4":"Activate scanning a single barcode using Terminal API"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/point-of-sale","lvl2":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/android-terminals","lvl3":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/android-terminals\/scan-barcode","lvl4":"\/pt\/point-of-sale\/android-terminals\/scan-barcode\/single-session"},"levels":5,"category":"In-person payments","category_color":"green","tags":["Activate","scanning","single","barcode","using","Terminal"]}}
