{"title":"Register the PED with the Adyen payments platform","category":"default","creationDate":1776961627,"content":"<p>Before using the connected PEDs to process transactions on the plataforma de pagamentos da Adyen, you must authenticate and authorize them with the\u00a0plataforma de pagamentos da Adyen (at least once).\u00a0Authenticate and authorize the PED by making a <code>register_device<\/code> call to the library with input parameters. The library returns a callback. Process this after the system processes the PED registration call.\u00a0<\/p>\n<p>After you authenticate and authorize each PED, they are registered in your <a href=\"https:\/\/ca-live.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a><\/p>\n<div class=\"sc-notice note\"><div>\n<p>The call and the callback are asynchronous to prevent the call from blocking the calling thread.<\/p>\n<\/div><\/div>\n<p>Register the PED after you <a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/register-the-application-with-adyen-c-library\">authenticate and authorize the POS<\/a>. If the POS is not authenticated and authorized, the call fails.<\/p>\n<h2 id=\"implement-the-callback\">Implement the callback<\/h2>\n<p>Implement the\u00a0<code>register_ped_CB<\/code>\u00a0and pass this as a parameter of the <code>register_device<\/code> call. For more information on how to do this, see\u00a0<a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/calls-and-callbacks-c-library\/implement-callbacks\">Implement callbacks<\/a>.<\/p>\n<h3 id=\"code-example\">Code example<\/h3>\n<p>The callback function declaration is:\u00a0<\/p>\n<pre><code class=\"language-cpp\">void register_ped_CB(register_device_response * result, void * echo_struct)<\/code><\/pre>\n<h2 id=\"allocate-request-structure\">Allocate request structure<\/h2>\n<p>Use <code>register_dev_allocate<\/code> to allocate a\u00a0<a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/structs\/register_device_request\">register_device_request<\/a> structure. Populate the request\u00a0by performing string duplication to fill heap-allocated strings.\u00a0\u00a0The library automatically frees this memory..<\/p>\n<h2 id=\"call-the-register_device-function\">Call the register_device Function<\/h2>\n<p>Call the <code>register_device<\/code> function to\u00a0authenticate and authorize the PED by making this\u00a0call to the library with input parameters. The library returns a callback. Process this after the system processes the PED registration call.\u00a0<\/p>\n<h3 id=\"parameters\">Parameters<\/h3>\n<table style=\"width:100%;\"><colgroup><col style=\"width: 11%\"><col style=\"width: 0%\"><col style=\"width: 0%\"><col style=\"width: 88%\"><\/colgroup><thead><tr class=\"header\"><th>Name<\/th><th>Type<\/th><th>Required<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>\n<p><code>register_dev_req<\/code><\/p>\n<\/td><td>\n<p><a href=\"\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/structs\/register_device_request\">register_device_request<\/a><\/p>\n<\/td><td>\n<p><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/p>\n<\/td><td>\n<p>Pointer to the\u00a0<code>register_device_request<\/code>\u00a0struct, this struct contains all the input parameters for this call. For a list of parameters, see\u00a0<a href=\"\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/structs\/register_device_request\">register_device_request<\/a>.<div class=\"sc-notice note\"><div>You can register a PED to a specific store by populating the store parameter of the <code>register_device_request<\/code>.<\/div><\/div><\/p>\n<\/td><\/tr><tr><td>\n<p><code>register_ped_CB<\/code><\/p>\n<\/td><td>\n<p>Function<\/p>\n<\/td><td>\n<p><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/p>\n<\/td><td>\n<p>Pointer to the callback function the system returns to the POS with the results of the <code>register_device<\/code> call.<\/p>\n<\/td><\/tr><tr><td>\n<p><code>echo_struct<\/code><\/p>\n<\/td><td>\n<p>Struct:\u00a0<a href=\"\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/structs\/echo_struct\">echo_struct<\/a><\/p>\n<\/td><td>\n<p><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/p>\n<\/td><td>\n<p>Pointer to a POS defined struct that is echoed back in the callback. Use echo_struct to share a POS data struct between the call to the library and the callback from the library in response to the call.<\/p>\n<\/td><\/tr><\/tbody><\/table>\n<div class=\"sc-notice info\"><div>\n<p>You can register more than one PED on the library with the register_device function.<\/p>\n<\/div><\/div>\n<h3 id=\"code-example-1\">Code example<\/h3>\n<p>The declaration of the call to register the PED is as follows:<\/p>\n<pre><code class=\"language-cpp\">ADYLibraryResult register_device_result = register_device(register_device_request_ptr, register_ped_CB, &amp;state);<\/code><\/pre>\n<h2 id=\"handle-the-callback\">Handle the callback<\/h2>\n<p>The POS needs to wait for the <code>register_ped_cb<\/code> to happen, before it can continue with other functions.<\/p>\n<h3 id=\"parameters-1\">Parameters<\/h3>\n<p>The callback passes the following parameters:<\/p>\n<table style=\"width:100%;\"><colgroup><col style=\"width: 8%\"><col style=\"width: 91%\"><\/colgroup><thead><tr class=\"header\"><th>Value<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>\n<p><code>ped_device_info<\/code><\/p>\n<\/td><td>\n<p>A pointer to a <code>ped_device_info<\/code>\u00a0struct that defines the status and details of the PED. For a list of parameters, see\u00a0<a href=\"\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/structs\/ped_device_info\">ped_device_info<\/a>.These data elements are recorded in the\u00a0<a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>.The<code>\u00a0terminal_serial_number<\/code>,<code> terminal_type<\/code>,<code> terminal_brand<\/code>,<code> terminal_api_version<\/code>,<code> terminal_os_version<\/code>,\u00a0and\u00a0<code>terminal_hardware_version<\/code>\u00a0data elements are used to define the exact state of the PED. Use these elements to investigate issues.<\/p>\n<\/td><\/tr><tr><td>\n<p><code>echo_struct<\/code><\/p>\n<\/td><td>\n<p>A pointer to a User-defined struct that can be set by the POS on the <code>device_callbacks<\/code> struct and which is being echoed back here.<\/p>\n<\/td><\/tr><\/tbody><\/table>\n<h2 id=\"other-register-device-callback-functions\">Other Register device callback functions<\/h2>\n<p>To allow the library to return callbacks specified by the POS. they need to be provided to the library. The callback functions are registered during the register device stage, where the callbacks handlers are specified in the callbacks structure of the <code>register_device_request<\/code>.<\/p>\n<p>The following callback functions must be specified:<\/p>\n<ul>\n<li><a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library\/handle-progress-events-c-library\">Handle progress events - C library<\/a><\/li>\n<li><a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library\/handle-the-additional-data-callback-c-library\">Handle the Additional Data callback - C library<\/a><\/li>\n<li><a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/extras-c-library\/handle-dynamic-currency-conversion-c-library\">Handle Dynamic Currency Conversion - C library<\/a><\/li>\n<li><a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library\/handle-the-print-receipt-callback-c-library\">Handle the Print Receipt callback - C library<\/a><\/li>\n<li><a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library\/handle-the-signature-callback-c-library\">Handle the Signature callback - C library<\/a><\/li>\n<li><a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library\/handle-the-final-state-callback-c-library\">status_tender_final<\/a><\/li>\n<\/ul>\n<p>As the payment process is handled by the PED, all state information should also be retrieved from the PED. The POS application must never assume the final state and should wait for the final state of the transaction as reported by the PED (from the library). Even when the POS initiates a request to cancel, it should wait until the library returns the final state of the transaction.<\/p>\n<p>The POS needs to wait for the register device callback to happen, before it can continue with other functions, in particular, performing transactions.<\/p>\n<div class=\"sc-notice note\"><div>\n<p>This callback not only arrives in response to a register_device call, it is also be called every time a change in device status occurs, It is possible to happen during a transaction.<\/p>\n<\/div><\/div>","url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/register-the-ped-with-the-adyen-payments-platform-c-library","articleFields":{"id":"24217502","type":"page","_expandable":{"operations":""},"status":"current","last_edit_on":"21-05-2019 12:08"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/register-the-ped-with-the-adyen-payments-platform-c-library","title":"Register the PED with the Adyen payments platform","content":"Before using the connected PEDs to process transactions on the plataforma de pagamentos da Adyen, you must authenticate and authorize them with the\u00a0plataforma de pagamentos da Adyen (at least once).\u00a0Authenticate and authorize the PED by making a register_device call to the library with input parameters. The library returns a callback. Process this after the system processes the PED registration call.\u00a0\nAfter you authenticate and authorize each PED, they are registered in your Customer Area\n\nThe call and the callback are asynchronous to prevent the call from blocking the calling thread.\n\nRegister the PED after you authenticate and authorize the POS. If the POS is not authenticated and authorized, the call fails.\nImplement the callback\nImplement the\u00a0register_ped_CB\u00a0and pass this as a parameter of the register_device call. For more information on how to do this, see\u00a0Implement callbacks.\nCode example\nThe callback function declaration is:\u00a0\nvoid register_ped_CB(register_device_response * result, void * echo_struct)\nAllocate request structure\nUse register_dev_allocate to allocate a\u00a0register_device_request structure. Populate the request\u00a0by performing string duplication to fill heap-allocated strings.\u00a0\u00a0The library automatically frees this memory..\nCall the register_device Function\nCall the register_device function to\u00a0authenticate and authorize the PED by making this\u00a0call to the library with input parameters. The library returns a callback. Process this after the system processes the PED registration call.\u00a0\nParameters\nNameTypeRequiredDescription\nregister_dev_req\n\nregister_device_request\n\n\n\nPointer to the\u00a0register_device_request\u00a0struct, this struct contains all the input parameters for this call. For a list of parameters, see\u00a0register_device_request.You can register a PED to a specific store by populating the store parameter of the register_device_request.\n\nregister_ped_CB\n\nFunction\n\n\n\nPointer to the callback function the system returns to the POS with the results of the register_device call.\n\necho_struct\n\nStruct:\u00a0echo_struct\n\n\n\nPointer to a POS defined struct that is echoed back in the callback. Use echo_struct to share a POS data struct between the call to the library and the callback from the library in response to the call.\n\n\nYou can register more than one PED on the library with the register_device function.\n\nCode example\nThe declaration of the call to register the PED is as follows:\nADYLibraryResult register_device_result = register_device(register_device_request_ptr, register_ped_CB, &amp;state);\nHandle the callback\nThe POS needs to wait for the register_ped_cb to happen, before it can continue with other functions.\nParameters\nThe callback passes the following parameters:\nValueDescription\nped_device_info\n\nA pointer to a ped_device_info\u00a0struct that defines the status and details of the PED. For a list of parameters, see\u00a0ped_device_info.These data elements are recorded in the\u00a0Customer Area.The\u00a0terminal_serial_number, terminal_type, terminal_brand, terminal_api_version, terminal_os_version,\u00a0and\u00a0terminal_hardware_version\u00a0data elements are used to define the exact state of the PED. Use these elements to investigate issues.\n\necho_struct\n\nA pointer to a User-defined struct that can be set by the POS on the device_callbacks struct and which is being echoed back here.\n\nOther Register device callback functions\nTo allow the library to return callbacks specified by the POS. they need to be provided to the library. The callback functions are registered during the register device stage, where the callbacks handlers are specified in the callbacks structure of the register_device_request.\nThe following callback functions must be specified:\n\nHandle progress events - C library\nHandle the Additional Data callback - C library\nHandle Dynamic Currency Conversion - C library\nHandle the Print Receipt callback - C library\nHandle the Signature callback - C library\nstatus_tender_final\n\nAs the payment process is handled by the PED, all state information should also be retrieved from the PED. The POS application must never assume the final state and should wait for the final state of the transaction as reported by the PED (from the library). Even when the POS initiates a request to cancel, it should wait until the library returns the final state of the transaction.\nThe POS needs to wait for the register device callback to happen, before it can continue with other functions, in particular, performing transactions.\n\nThis callback not only arrives in response to a register_device call, it is also be called every time a change in device status occurs, It is possible to happen during a transaction.\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":"Key steps","lvl6":"Register the PED with the Adyen payments platform"},"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\/key-steps-c-library","lvl6":"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/register-the-ped-with-the-adyen-payments-platform-c-library"},"levels":7,"category":"In-person payments","category_color":"green","tags":["Register","Adyen","payments","platform"]}}
