Before using the connected PEDs to process transactions on the plataforma de pagamentos da Adyen, you must authenticate and authorise them with the plataforma de pagamentos da Adyen (at least once). Authenticate and authorise 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.
After you authenticate and authorise each PED, they are registered in your Customer Area
The call and the callback are asynchronous to prevent the call from blocking the calling thread.
Register the PED after you authenticate and authorise the POS. If the POS is not authenticated and authorised, the call fails.
Implement the callback
register_ped_CB and pass this as a parameter of the
register_device call. For more information on how to do this, see Implement callbacks.
The callback function declaration is:
void register_ped_CB(register_device_response * result, void * echo_struct)
Allocate request structure
register_dev_allocate to allocate a register_device_request structure. Populate the request by performing string duplication to fill heap-allocated strings. The library automatically frees this memory..
Call the register_device Function
register_device function to authenticate and authorise the PED by making this call to the library with input parameters. The library returns a callback. Process this after the system processes the PED registration call.
Pointer to the
You can register a PED to a specific store by populating the store parameter of the
|Function||Pointer to the callback function the system returns to the POS with the results of the |
|Struct: echo_struct||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.|
You can register more than one PED on the library with the register_device function.
The declaration of the call to register the PED is as follows:
ADYLibraryResult register_device_result = register_device(register_device_request_ptr, register_ped_CB, &state);
Handle the callback
The POS needs to wait for the
register_ped_cb to happen, before it can continue with other functions.
The callback passes the following parameters:
A pointer to a
These data elements are recorded in the Customer Area.
|A pointer to a User-defined struct that can be set by the POS on the |
Other Register device callback functions
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
The following callback functions must be specified:
- Handle progress events - C library
- Handle the Additional Data callback - C library
- Handle Dynamic Currency Conversion - C library
- Handle the Print Receipt callback - C library
- Handle the Signature callback - C library
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.
The POS needs to wait for the register device callback to happen, before it can continue with other functions, in particular, performing transactions.
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.