Before using the POS systems and connected PEDs to process transactions on the plataforma de pagamentos da Adyen, you must authenticate and authorize the POS system and the PED with the plataforma de pagamentos da Adyen (at least once). Register the POS by making a call to the library with input parameters and processing the callbacks that are returned by the library after registration has been processed.
The POS can then authenticate and authorize any connected PED. After you authenticate and authorize each POS and PED, they are registered in your Customer Area.
The call and the callback are asynchronous to prevent the call from blocking the calling thread.
The merchant account, user id and password that are required to authenticate and authorize the POS are provided by Adyen when the required accounts are being set up.
Implement the callback
Implement the register_app_CB
and pass this as a parameter of the register_app
call. For more information on how to do this, see Implement callbacks.
Code example
The callback function declaration is:
void register_pos_CB(register_app_response * result, void * echo_struct)
Allocate request structure
Use register_app_allocate
to allocate memory for an register_app_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 register_app Function
Call the register_app
function with the provided parameters to authenticate and authorize the POS.
Parameters
Name | Type | Required | Description |
---|---|---|---|
|
Pointer to the | ||
|
Function |
Pointer to the callback function the system returns to the POS with the results of the | |
|
Struct: echo_struct |
Pointer to a user-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. |
Code example
The declaration of the call to register the POS is:
ADYLibraryResult register_app_result = register_app(register_app_request_ptr, register_pos_CB, &state);
Get the function call result
ADYLibraryResult
is used to store the result of the function call, the immediate response to the call. This is an enum that indicates if the system received the request. Should be ADYEN_OK
, if this is not the case, something has gone wrong. In this case, check the input to the call and if it cannot be resolved, log the result and contact Support Team
This is not the final result of the call. The library returns the final result in response to the library initialization call.
Handle the callback
The POS needs to wait for the register_pos_cb
to happen, before it can continue with other functions, like boarding the PED device and performing transactions.
Parameters
The callback passes the following parameters:
Value | Description |
---|---|
|
Response to the |
|
Pointer to a user-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.Pointer to a User 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. |