{"title":"Implement callbacks","category":"default","creationDate":1776961627,"content":"<h2 id=\"about-this-task\">About this task<\/h2>\n<p>In the C Library integration, you will implement most callbacks based on a defined signature.\u00a0<\/p>\n<p>This includes:<\/p>\n<ul>\n<li><code>initialization_CB<\/code><\/li>\n<li><code>library_shutdown_CB<\/code><\/li>\n<li><code>register_pos_CB<\/code><\/li>\n<li><code>register_ped_CB<\/code><\/li>\n<li><code>create_new_tender_CB<\/code><\/li>\n<li><code>library_exception_CB<\/code><\/li>\n<li><code>cancel_or_refund_CB<\/code><\/li>\n<li><code>show_screen_CB<\/code><\/li>\n<li><code>tx_store_CB<\/code><\/li>\n<\/ul>\n<p>We have defined a signature for each callback. The signature we provide looks like:<\/p>\n<pre><code>void initialization_CB(void * result, void * echo_pointer);<\/code><\/pre>\n<p>You will need to implement callback functions with the same signature.\u00a0<\/p>\n<p><div class=\"sc-notice note\"><div> The process differs for callbacks that are added to the\u00a0 <code>register_device_request<\/code>\u00a0structure and passed with the <code>register_ped<\/code> call. \u00a0For these callbacks, see . <\/div><\/div><\/p>\n<h2 id=\"steps\">Steps<\/h2>\n<p>To use these callbacks:<\/p>\n<ol>\n<li>\n<p>Implement the callback with the same signature. In the following example we will implement the\u00a0<code>intitialization_CB<\/code>\u00a0callback.<\/p>\n<pre><code class=\"language-cpp\">void initialization_CB(void * result, void * echo_struct){\n\n    app_context_t * sPOS = (app_context_t *)echo_struct;\n\n    sPOS-&gt;pending_callback = 0;      \/\/mark handled\n\n}<\/code><\/pre>\n<\/li>\n<li>\n<p>Pass\u00a0<code>intitialization_CB<\/code>\u00a0as a parameter of the\u00a0<code>init_library<\/code>\u00a0call.<\/p>\n<pre><code>ADYLibraryResult result = init_library(initReq, initialization_CB, sPOS);<\/code><\/pre>\n<\/li>\n<\/ol>","url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/calls-and-callbacks-c-library\/implement-callbacks","articleFields":{"id":"31493035","type":"page","_expandable":{"operations":""},"status":"current"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/calls-and-callbacks-c-library\/implement-callbacks","title":"Implement callbacks","content":"About this task\nIn the C Library integration, you will implement most callbacks based on a defined signature.\u00a0\nThis includes:\n\ninitialization_CB\nlibrary_shutdown_CB\nregister_pos_CB\nregister_ped_CB\ncreate_new_tender_CB\nlibrary_exception_CB\ncancel_or_refund_CB\nshow_screen_CB\ntx_store_CB\n\nWe have defined a signature for each callback. The signature we provide looks like:\nvoid initialization_CB(void * result, void * echo_pointer);\nYou will need to implement callback functions with the same signature.\u00a0\n The process differs for callbacks that are added to the\u00a0 register_device_request\u00a0structure and passed with the register_ped call. \u00a0For these callbacks, see . \nSteps\nTo use these callbacks:\n\n\nImplement the callback with the same signature. In the following example we will implement the\u00a0intitialization_CB\u00a0callback.\nvoid initialization_CB(void * result, void * echo_struct){\n\n    app_context_t * sPOS = (app_context_t *)echo_struct;\n\n    sPOS-&gt;pending_callback = 0;      \/\/mark handled\n\n}\n\n\nPass\u00a0intitialization_CB\u00a0as a parameter of the\u00a0init_library\u00a0call.\nADYLibraryResult result = init_library(initReq, initialization_CB, sPOS);\n\n","type":"page","locale":"pt","boost":14,"hierarchy":{"lvl0":"Home","lvl1":"Terminais","lvl2":"Deprecation of classic libraries","lvl3":"Library integrations","lvl4":"C library integration","lvl5":"Calls and callbacks","lvl6":"Implement callbacks"},"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\/classic-library-deprecation","lvl3":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations","lvl4":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration","lvl5":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/calls-and-callbacks-c-library","lvl6":"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/calls-and-callbacks-c-library\/implement-callbacks"},"levels":7,"category":"In-person payments","category_color":"green","tags":["Implement","callbacks"]}}
