bool VoidSale(string)
Voids a previous Sale transaction in the batch that has not yet been settled. The OnKioEMVTransactionCompleted callback will have most of the parameters needed here. Trust Level Required: High
Parameters
Name | Description |
input |
string Serialized JSON string with the following parameters from the EMVRequestInput class: PaymentAmount, TaxAmount, TransactionRef, CardToken, AuthCode, AcqRefData, ProcessData, and (optional) DeviceName. |
Return
True on success.
Examples
var input1 = {
"PaymentAmount": 425,
"TaxAmount": 10,
"DeviceName": "MyDevice"
};
if (!KioEMVDevice.Sale(input1))
alert('Failed to call Sale!');
var TransTypes = {
"None": 0,
"SetParameters": 1,
"Payment": 2, // PreAuth
"Confirm": 3, // PreAuth Capture
"Terminate": 4,
"VoidTrans": 5,
"Refund": 6,
"SetIdleMsg": 7,
"Sale": 8,
"VoidSale": 9,
"Reset": 10,
"RequestTMSUpdate": 11
};
var ResultTypes = {
"Unknown": 0,
"Approved": 1,
"Declined": 2,
"Error": 3
};
// callback fired when operation processed
function OnKioEMVTransactionCompleted(lastTransResult) {
alert('Operation returned: ' + lastTransResult.Result);
if (lastTransResult.Result == ResultTypes.Approved && lastTransResult.TransType == TransTypes.Sale) {
var input2 = {
"PaymentAmount": lastTransResult.Amount,
"TaxAmount": lastTransResult.Tax,
"TransactionRef": lastTransResult.ReferenceID,
"CardToken": lastTransResult.CardHashToken,
"AuthCode": lastTransResult.AuthorizationCode,
"AcqRefData": lastTransResult.AcqRefData,
"ProcessData": lastTransResult.ProcessData,
"DeviceName": "MyDevice"
};
}
if (!KioEMVDevice.VoidSale(input2))
alert('Failed to call void');
}