Create the tender

Implement the callback

Implement the create_tender_CB and pass this as a parameter of the create_tender call.  For more information on how to do this, see Implement callbacks.

Code example

The callback function declaration is:

void create_tender_CB(create_tender_response*, void * echo_str)

Allocate request structure

Use create_tender_allocate to allocate memory for an create_tender_request structure. Populate the request by performing string duplication and filling heap allocated strings. If you want the data for later use, retain it, or it will be released automatically.

Call the create_tender Function

Call the create_tender function to initiate the sale transaction, which triggers any relevant callbacks. The POS waits for the final state and the  status_tender_final  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.


Value Description
create_tender_request Pointer to the create_tender_request structure, this struct contains all the input parameters for this call.
create_tender_callback Pointer to the callback function in the POS that will be called with the results of the create tender call
echo_struct 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.

Code example

The declaration of the call to start a transaction is as follows:

ADYEN_RESULT create_tender(create_tender_request*, create_tender_CB*, echo_struct*);

Handle the callback

The POS needs to wait for the create_tender_CB to 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 callback that contains the final transaction result. Another transaction can only be started when the final transaction result is received.


Data element Description
create_tender_response 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 create_tender_response.
echo_struct 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.

The 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.