bool Payment (string)

Performs a PreAuth payment transaction for the requested amount and returns the result via the OnKioEMVTransactionCompleted callback. The transaction must then be confirmed.

Security

Trust Level Required: Full Trust

Parameters

Name Description
input string
Serialized JSON string with the following parameters from the EMVRequestInput class.

Return

True if the command was queued for processing, false otherwise.

Remarks

This call begins a two-step PreAuth transaction. After successfully running a PreAuth transaction, the transaction must then be confirmed or voided. This transaction type is not supported by NETePay. TaxAmount is only required by Shift4. FreedomPay requires the ProductDescriptors parameter.

Examples


var input1 = {
  "PaymentAmount": 425
};
if (!KioEMVDevice.Payment(input1))
   alert('Failed to call Payment!');

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) {

    // did the event fire because of a payment request finished?
    if (lastTransResult.TransType == TransTypes.Payment) {
       // it was approved -- try to confirm it.
	   if (lastTransResult.Result == ResultTypes.Approved) {
         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.Confirm(input2))
            alert('Failed to call confirm');
       }
       else {
            alert('Payment failed, Operation returned: ' + lastTransResult.Result);
       }
    }

    // or did it fire because a confirm finished?
	if (lastTransResult.TransType == TransTypes.Confirm) {
        if (lastTransResult.Result == ResultTypes.Approved) {
           alert('Tranaction confirmed!');
        }
        else {
            alert('Failed to confirm transaction, Operation returned: ' + lastTransResult.Result);
        }
    }
}

Requirements

KioWare for Windows version 8.24 or greater.