{"title":"Create the tender","category":"default","creationDate":1776961627,"content":"<h2 id=\"implement-the-callback\">Implement the callback<\/h2>\n<p>Implement the\u00a0<code>create_tender_CB<\/code>\u00a0and pass this as a parameter of the\u00a0<code>create_tender<\/code>\u00a0call.\u00a0\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\">Implement callbacks<\/a>.<\/p>\n<h3 id=\"code-example\">Code example<\/h3>\n<p>The callback function declaration is:<\/p>\n<pre><code class=\"language-cpp\">void create_tender_CB(create_tender_response*, void * echo_str)<\/code><\/pre>\n<h2 id=\"allocate-request-structure\">Allocate request structure<\/h2>\n<p>Use\u00a0<code>create_tender_allocate<\/code>\u00a0to allocate memory for an\u00a0<code>create_tender_request<\/code>\u00a0structure.\u00a0Populate the request by performing\u00a0string duplication and filling heap allocated strings. If you want the data for later use, retain it, or it will be released automatically.<\/p>\n<h2 id=\"call-the-create_tender-function\">Call the create_tender function<\/h2>\n<p>Call the\u00a0<code>create_tender<\/code> function to initiate the sale transaction, which triggers any relevant callbacks. The POS waits for the final state and the \u00a0<code>status_tender_final<\/code>\u00a0 callback to report the final result of the transaction, even if a cancel request has been issued. The reason for this is that the transaction might already be in a state in which a cancel is not possible. The sale transaction includes the merchant account information, as this is used to register PEDs for multiple merchant accounts, and transactions can be performed on more than one of these merchant accounts.<\/p>\n<h2 id=\"parameters\">Parameters<\/h2>\n<table>\n<thead>\n<tr>\n<th>Value<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>create_tender_request<\/code><\/td>\n<td>Pointer to the <code>create_tender_request<\/code> structure, this struct contains all the input parameters for this call.<\/td>\n<\/tr>\n<tr>\n<td><code>create_tender_callback<\/code><\/td>\n<td>Pointer to the callback function in the POS that will be called with the results of the create tender call<\/td>\n<\/tr>\n<tr>\n<td><code>echo_struct<\/code><\/td>\n<td>Pointer to a POS defined struct. Returned in the callback. It can be used to share a POS data struct between the call to the library and the callback from the library.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"code-example-1\">Code example<\/h3>\n<p>The declaration of the call to start a transaction is as follows:<\/p>\n<pre><code class=\"language-cpp\">ADYEN_RESULT create_tender(create_tender_request*, create_tender_CB*, echo_struct*);<\/code><\/pre>\n<h2 id=\"handle-the-callback\">Handle the callback<\/h2>\n<p>The POS needs to wait for the\u00a0<code>create_tender_CB<\/code>\u00a0to happen, before it can continue with other functions. After the <code>create_tender_cb<\/code> is returned, the system returns a number of other callbacks. Finally, the system returns the <code>tender_finished_cb<\/code>\u00a0callback that contains the final transaction result. Another transaction can only be started when the final transaction result is received.<\/p>\n<h3 id=\"parameters-1\">Parameters<\/h3>\n<table>\n<thead>\n<tr>\n<th>Data element<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>create_tender_response<\/code><\/td>\n<td>A unique reference for the transaction that is generated by the PED device. This reference is used for subsequent actions on the transaction. For a list of parameters, see <a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/structs\/create_tender_response\">create_tender_response<\/a>.<\/td>\n<\/tr>\n<tr>\n<td><code>echo_struct<\/code><\/td>\n<td>Pointer to a user-defined structure. Returned in the callback. It can be used to share a POS data struct between the call to the library and the callback from the library in response to the call.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sc-notice note\"><div>\n<p>The <code>create_tender_CB<\/code> is a callback to the creation of a tender, but does not represent the status or result of the transaction. The result is returned in <code>tender_finished_cb<\/code>.<\/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\/process-a-basic-transaction-c-library\/create-the-tender-c-library","articleFields":{"id":"24217505","type":"page","_expandable":{"operations":""},"status":"current","last_edit_on":"13-11-2019 17:52"},"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\/create-the-tender-c-library","title":"Create the tender","content":"Implement the callback\nImplement the\u00a0create_tender_CB\u00a0and pass this as a parameter of the\u00a0create_tender\u00a0call.\u00a0\u00a0For more information on how to do this, see\u00a0Implement callbacks.\nCode example\nThe callback function declaration is:\nvoid create_tender_CB(create_tender_response*, void * echo_str)\nAllocate request structure\nUse\u00a0create_tender_allocate\u00a0to allocate memory for an\u00a0create_tender_request\u00a0structure.\u00a0Populate the request by performing\u00a0string duplication and filling heap allocated strings. If you want the data for later use, retain it, or it will be released automatically.\nCall the create_tender function\nCall the\u00a0create_tender function to initiate the sale transaction, which triggers any relevant callbacks. The POS waits for the final state and the \u00a0status_tender_final\u00a0 callback to report the final result of the transaction, even if a cancel request has been issued. The reason for this is that the transaction might already be in a state in which a cancel is not possible. The sale transaction includes the merchant account information, as this is used to register PEDs for multiple merchant accounts, and transactions can be performed on more than one of these merchant accounts.\nParameters\n\n\n\nValue\nDescription\n\n\n\n\ncreate_tender_request\nPointer to the create_tender_request structure, this struct contains all the input parameters for this call.\n\n\ncreate_tender_callback\nPointer to the callback function in the POS that will be called with the results of the create tender call\n\n\necho_struct\nPointer to a POS defined struct. Returned in the callback. It can be used to share a POS data struct between the call to the library and the callback from the library.\n\n\n\nCode example\nThe declaration of the call to start a transaction is as follows:\nADYEN_RESULT create_tender(create_tender_request*, create_tender_CB*, echo_struct*);\nHandle the callback\nThe POS needs to wait for the\u00a0create_tender_CB\u00a0to happen, before it can continue with other functions. After the create_tender_cb is returned, the system returns a number of other callbacks. Finally, the system returns the tender_finished_cb\u00a0callback that contains the final transaction result. Another transaction can only be started when the final transaction result is received.\nParameters\n\n\n\nData element\nDescription\n\n\n\n\ncreate_tender_response\nA unique reference for the transaction that is generated by the PED device. This reference is used for subsequent actions on the transaction. For a list of parameters, see create_tender_response.\n\n\necho_struct\nPointer to a user-defined structure. Returned in the callback. It can be used 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\n\n\nThe create_tender_CB is a callback to the creation of a tender, but does not represent the status or result of the transaction. The result is returned in tender_finished_cb.\n","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":"Create the tender"},"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\/create-the-tender-c-library"},"levels":8,"category":"In-person payments","category_color":"green","tags":["Create","tender"]}}
