Prototype the callback
create_new_tender_CB and pass this as a parameter of the function pointer to the
The callback function declaration is:
Allocate request structure
create_special_tender_request to allocate memory for an
special_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.
The gift card can be presented on three ways:
- Swipe: The gift card is read through a magnetic stripe.
- MKE on PED: The card number is manually entered on the payment terminal (PED). The tender should specify that it expects keyed entry on the terminal, and a card mask should be provided.
- MKE on POS: Scan a barcode on the back of the card from the Cash register application (POS). In this scenario, the card number, card mask and expiry should be provided in special options.
You can specify entry modes by passing special tender options. See Gift Card Matrix.
Add and remove special options
Special options are dictionary key value pairs. This information is passed directly to the PED, which interprets it.
special_tender_add_option to set special options, passing the request along with key value pairs. Use
special_tender_rm_option to remove the set options.
Populate the create_special_tender_request
Populate the request using string duplication.
Call the create_special_tender Function
create_special_tender function to Initiate the sale transaction, which triggers any relevant callbacks, and pass in the request that was previously allocated.
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.
||Pointer to the
||Pointer to the callback function in the POS that will be called with the results of the create special tender call|
||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.|
The declaration of the call to start a transaction is as follows:
Handle the callback
create_new_tender_CB to check if the transaction was accepted by the terminal by checking if tender_reference was populated by the library.
The POS needs to wait for the
create_new_tender_CB to happen, before it can continue with other functions. After the
create_new_tender_CB is returned, the system returns a number of other callbacks. Finally, the system returns the final callback that contains the final transaction result. Another transaction can only be started when the final transaction result is received.
||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.|
||Pointer to a user-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 in response to the call.|
create_new_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