Before using the connected PEDs to process transactions on the plataforma de pagamentos da Adyen, you must authenticate and authorize them with the plataforma de pagamentos da Adyen (at least once). Authenticate and authorize 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 authorize 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 authorize the POS. If the POS is not authenticated and authorized, the call fails.
Implement the callback
Implement the 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.
Code example
The callback function declaration is:
void register_ped_CB(register_device_response * result, void * echo_struct)
Allocate request structure
Use 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
Call the register_device
function to authenticate and authorize 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.
Parameters
Name | Type | Required | Description |
---|---|---|---|
|
Pointer to the You can register a PED to a specific store by populating the store parameter of the register_device_request . | ||
|
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.
Code example
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.
Parameters
The callback passes the following parameters:
Value | Description |
---|---|
|
A pointer to a |
|
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 register_device_request
.
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
- status_tender_final
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.