Implement the additional data callback
Implement the tender_additional_data_CB
and assign to the function pointer status_tender_additional_data
. For more information on how to do this, see Implement callbacks with register_device_request.
Code example
void tender_additional_data_CB(response_header *status_tender, ped_device_info *ped_state, void *echo_struct)
Invoke the additional data callback
Make a create_tender
call with the GetAdditionalData
tender option to invoke the tender_additional_data_CB
. The card number is used as a key to collect additional data and make it available to the POS during the transaction. Create this function and assign to the function pointer status_tender_additional_data
.
Apart from card information, there are two additional sets of data:
- Loyalty data for merchant branded cards and/or recurring references in case of a non-merchant card. Loyalty data is retrieved from the merchant loyalty database. The plataforma de pagamentos da Adyen and the merchant managed loyalty system must be able to communicate. The merchant guarantees that no sensitive data elements, like card numbers, are present in the loyalty data that is passed, as this would bring the merchant into the scope of PCI DSS. Provide the shopper reference and/or shopper reference at the start of the transaction. If the card has been used before, the existing alias, last used shopper reference, and last used shopper email address are returned. A new alias is generated if it does not already exist.
- Digital Customer Recognition and Global Blue data. This option is also required to implement DCC. Use the standard Adyen facilities for recurring payments, by either using the alias or the shopper reference to retrieve the recurring details for a specific customer. These recurring details can then be used to submit subsequent recurring transactions. The shopper recognition details can also be used to support one-click payments in the web shop. Recurring details are recorded only when the payment is authorized. Recurring payments can not be processed against cards that are not authorized.
Some schemes do not allow recurring payments, see the payment methods overview for more information.
The shopper reference and/or the shopper email address can be provided in the TransactionRequest
passed to the library when starting such a transaction.
Code example
The additional data callback function declaration is:
void additional_data_CB(response_header*, ped_device_info*, void * echo_struct)
Additional Data Response
The response_header
page lists the returned data elements, including additional_data_struct
elements.
Allocate the additional_data_obj
Use the additional_data_obj_allocate
function to allocate, initialize and return an additional_data_obj
structure. Populate the request by performing string duplication to fill heap-allocated strings. The library automatically frees this memory.
Confirm the additional data callback
The confirm_additional_data
function After the POS receives the additional data callback from the PED, the POS must confirm in order to continue the transaction. Based on the information received during the callback, the amount can be adjusted. The currency must be the same as the original currency.
Parameters
Field | Description |
---|---|
terminal_id |
Terminal id of the PED. |
tender_reference |
The tender_reference of the transaction. |
adjust_currency |
The currency of the transaction (must match original currency). |
adjust_amount |
The adjusted amount. |
shopper_reference |
The shopper reference. |
shopper_email |
The shopper email. |
additional_data_obj |
Object used to hold additional data |
Code example
The declaration of the call to confirm the additional data callback is as follows:
void confirm_additional_data(char *terminal_id, char * tender_reference, char * adjust_currency, char * adjust_amount, char * shopper_reference, char * shopper_email, additional_data_struct * additional_data_obj);
To finish the transaction without changes or new information, enter the terminal_id
and tender_reference
and set all other fields to NULL.
Example
- A transaction was started for EUR 10,00.
- The loyalty data received in the call indicates this is a shopper that is eligible for a discount of 10%.
In this case, the amount can be changed to EUR 9,00.
It is also possible to record the shopper reference and shopper email at this stage, if the shopper has been identified.