{"title":"Handle the Additional Data callback","category":"default","creationDate":1776961627,"content":"<h2 id=\"implement-the-additional-data-callback\">Implement the additional data callback<\/h2>\n<p>Implement the\u00a0<code>tender_additional_data_CB<\/code>\u00a0and assign to the function pointer\u00a0<code>status_tender_additional_data<\/code>.\u00a0For 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-with-register_device_request\">Implement callbacks with register_device_request<\/a>.<\/p>\n<h3 id=\"code-example\">Code example<\/h3>\n<pre><code class=\"language-cpp\">void tender_additional_data_CB(response_header *status_tender, ped_device_info *ped_state, void *echo_struct)<\/code><\/pre>\n<h2 id=\"invoke-the-additional-data-callback\">Invoke the additional data callback<\/h2>\n<p>Make a\u00a0<code>create_tender<\/code>\u00a0call with the\u00a0<code>GetAdditionalData<\/code>\u00a0tender option to invoke the <code>tender_additional_data_CB<\/code>. The card number is used as a key to collect additional data and make it available to the POS during the transaction. Create this function and assign to the function pointer <code>status_tender_additional_data<\/code>.<\/p>\n<p>Apart from card information, there are two additional sets of data:<\/p>\n<ol>\n<li>Loyalty data for merchant branded cards and\/or recurring references in case of a non-merchant card. Loyalty data is retrieved from the merchant loyalty database. The plataforma de pagamentos da Adyen\u00a0and the merchant managed loyalty system must be able to communicate. The merchant guarantees that no sensitive data elements, like card numbers, are present in the loyalty data that is passed, as this would bring the merchant into the scope of PCI DSS. Provide the shopper reference and\/or shopper reference at the start of the transaction. If the card has been used before, the existing alias, last used shopper reference, and last used shopper email address are returned. A new alias is generated if it does not already exist.\u00a0<\/li>\n<li>Digital Customer Recognition and Global Blue data. This option is also required to implement DCC. Use the standard Adyen facilities for recurring payments, by either using the alias or the shopper reference to retrieve the recurring details for a specific customer. These recurring details can then be used to submit subsequent\u00a0<a href=\"\/pt\/online-payments\/classic-integrations\/classic-api-integration\/tokenization\">recurring transactions<\/a>. The shopper recognition details can also be used to support one-click payments in the web shop. Recurring details are recorded only when the payment is authorized. Recurring payments can not be processed against cards that are not authorized.<\/li>\n<\/ol>\n<div class=\"sc-notice note\"><div>\n<p>Some schemes do not allow recurring payments, see the <a href=\"\/pt\/payment-methods\">payment methods overview<\/a> for more information.<\/p>\n<\/div><\/div>\n<p>The shopper reference and\/or the shopper email address can be provided in the <code>TransactionRequest<\/code>\u00a0passed to the library when starting such a transaction.<\/p>\n<h3 id=\"code-example-1\">Code example<\/h3>\n<p>The additional data callback function declaration is:<\/p>\n<pre><code class=\"language-cpp\">void additional_data_CB(response_header*, ped_device_info*, void * echo_struct)<\/code><\/pre>\n<h2 id=\"additional-data-response\">Additional Data Response<\/h2>\n<p>The\u00a0<code>response_header<\/code>\u00a0page lists the returned data elements, including <code>additional_data_struct<\/code> elements.<\/p>\n<h2 id=\"allocate-the-additional_data_obj\">Allocate the additional_data_obj<\/h2>\n<p>Use the\u00a0<code>additional_data_obj_allocate<\/code>\u00a0function to allocate, initialize and return an\u00a0<code>additional_data_obj<\/code>\u00a0structure. Populate the request\u00a0by performing string duplication to fill heap-allocated strings.\u00a0\u00a0The library automatically frees this memory.<\/p>\n<h2 id=\"confirm-the-additional-data-callback\">Confirm the additional data callback<\/h2>\n<p>The <code>confirm_additional_data<\/code> function After the POS receives the additional data callback from the PED, the POS must confirm in order to continue the transaction. Based on the information received during the callback, the amount can be adjusted. The currency must be the same as the original currency.<\/p>\n<h3 id=\"parameters\">Parameters<\/h3>\n<table>\n<thead>\n<tr>\n<th>Field<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>terminal_id<\/code><\/td>\n<td>Terminal id of the PED.<\/td>\n<\/tr>\n<tr>\n<td><code>tender_reference<\/code><\/td>\n<td>The tender_reference of the transaction.<\/td>\n<\/tr>\n<tr>\n<td><code>adjust_currency<\/code><\/td>\n<td>The currency of the transaction (must match original currency).<\/td>\n<\/tr>\n<tr>\n<td><code>adjust_amount<\/code><\/td>\n<td>The adjusted amount.<\/td>\n<\/tr>\n<tr>\n<td><code>shopper_reference<\/code><\/td>\n<td>The shopper reference.<\/td>\n<\/tr>\n<tr>\n<td><code>shopper_email<\/code><\/td>\n<td>The shopper email.<\/td>\n<\/tr>\n<tr>\n<td><code>additional_data_obj<\/code><\/td>\n<td>Object used to hold additional data<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"code-example-2\">Code example<\/h3>\n<p>The declaration of the call to confirm the additional data callback is as follows:<\/p>\n<pre><code class=\"language-cpp\">void confirm_additional_data(char *terminal_id, char * tender_reference, char * adjust_currency, char * adjust_amount, char * shopper_reference, char * shopper_email, additional_data_struct * additional_data_obj);<\/code><\/pre>\n<div class=\"sc-notice note\"><div>\n<p>To finish the transaction without changes or new information, enter the <code>terminal_id<\/code> and <code>tender_reference<\/code> and set all other fields to NULL.<\/p>\n<\/div><\/div>\n<h3 id=\"example\">Example<\/h3>\n<ol>\n<li>A transaction was started for EUR 10,00.<\/li>\n<li>The loyalty data received in the call indicates this is a shopper that is eligible for a discount of 10%.<\/li>\n<\/ol>\n<p>In this case, the amount can be changed to EUR 9,00.<\/p>\n<p>It is also possible to record the shopper reference and shopper email at this stage, if the shopper has been identified.<\/p>","url":"https:\/\/docs.adyen.com\/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","articleFields":{"id":"24217511","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\/key-steps-c-library\/process-a-basic-transaction-c-library\/handle-the-additional-data-callback-c-library","title":"Handle the Additional Data callback","content":"Implement the additional data callback\nImplement the\u00a0tender_additional_data_CB\u00a0and assign to the function pointer\u00a0status_tender_additional_data.\u00a0For more information on how to do this, see\u00a0Implement callbacks with register_device_request.\nCode example\nvoid tender_additional_data_CB(response_header *status_tender, ped_device_info *ped_state, void *echo_struct)\nInvoke the additional data callback\nMake a\u00a0create_tender\u00a0call with the\u00a0GetAdditionalData\u00a0tender option to invoke the tender_additional_data_CB. The card number is used as a key to collect additional data and make it available to the POS during the transaction. Create this function and assign to the function pointer status_tender_additional_data.\nApart from card information, there are two additional sets of data:\n\nLoyalty data for merchant branded cards and\/or recurring references in case of a non-merchant card. Loyalty data is retrieved from the merchant loyalty database. The plataforma de pagamentos da Adyen\u00a0and the merchant managed loyalty system must be able to communicate. The merchant guarantees that no sensitive data elements, like card numbers, are present in the loyalty data that is passed, as this would bring the merchant into the scope of PCI DSS. Provide the shopper reference and\/or shopper reference at the start of the transaction. If the card has been used before, the existing alias, last used shopper reference, and last used shopper email address are returned. A new alias is generated if it does not already exist.\u00a0\nDigital Customer Recognition and Global Blue data. This option is also required to implement DCC. Use the standard Adyen facilities for recurring payments, by either using the alias or the shopper reference to retrieve the recurring details for a specific customer. These recurring details can then be used to submit subsequent\u00a0recurring transactions. The shopper recognition details can also be used to support one-click payments in the web shop. Recurring details are recorded only when the payment is authorized. Recurring payments can not be processed against cards that are not authorized.\n\n\nSome schemes do not allow recurring payments, see the payment methods overview for more information.\n\nThe shopper reference and\/or the shopper email address can be provided in the TransactionRequest\u00a0passed to the library when starting such a transaction.\nCode example\nThe additional data callback function declaration is:\nvoid additional_data_CB(response_header*, ped_device_info*, void * echo_struct)\nAdditional Data Response\nThe\u00a0response_header\u00a0page lists the returned data elements, including additional_data_struct elements.\nAllocate the additional_data_obj\nUse the\u00a0additional_data_obj_allocate\u00a0function to allocate, initialize and return an\u00a0additional_data_obj\u00a0structure. Populate the request\u00a0by performing string duplication to fill heap-allocated strings.\u00a0\u00a0The library automatically frees this memory.\nConfirm the additional data callback\nThe confirm_additional_data function After the POS receives the additional data callback from the PED, the POS must confirm in order to continue the transaction. Based on the information received during the callback, the amount can be adjusted. The currency must be the same as the original currency.\nParameters\n\n\n\nField\nDescription\n\n\n\n\nterminal_id\nTerminal id of the PED.\n\n\ntender_reference\nThe tender_reference of the transaction.\n\n\nadjust_currency\nThe currency of the transaction (must match original currency).\n\n\nadjust_amount\nThe adjusted amount.\n\n\nshopper_reference\nThe shopper reference.\n\n\nshopper_email\nThe shopper email.\n\n\nadditional_data_obj\nObject used to hold additional data\n\n\n\nCode example\nThe declaration of the call to confirm the additional data callback is as follows:\nvoid confirm_additional_data(char *terminal_id, char * tender_reference, char * adjust_currency, char * adjust_amount, char * shopper_reference, char * shopper_email, additional_data_struct * additional_data_obj);\n\nTo finish the transaction without changes or new information, enter the terminal_id and tender_reference and set all other fields to NULL.\n\nExample\n\nA transaction was started for EUR 10,00.\nThe loyalty data received in the call indicates this is a shopper that is eligible for a discount of 10%.\n\nIn this case, the amount can be changed to EUR 9,00.\nIt is also possible to record the shopper reference and shopper email at this stage, if the shopper has been identified.","type":"page","locale":"pt","boost":13,"hierarchy":{"lvl0":"Home","lvl1":"Terminais","lvl2":"Deprecation of classic libraries","lvl3":"Library integrations","lvl4":"C library integration","lvl5":"Key steps","lvl6":"Process a basic transaction","lvl7":"Handle the Additional Data callback"},"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":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library","lvl7":"\/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"},"levels":8,"category":"In-person payments","category_color":"green","tags":["Handle","Additional","callback"]}}
