Sale Method
Sends a Sale transaction to the host.
Syntax
ptechbenefit.sale([callback])
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
A basic EBT sale transaction is similar to a Debit transaction, in that a CardPIN and CardKSN are required in addition to swiped or manually entered Card data. A Sale transaction removes funds from the EBT cardholder's account for the TransactionAmount indicated. This transaction is automatically added to the current open batch, and will be settled after the current batch is released with the PTechHostSettle class.
The EBT card may be specified by either a CardMagneticStripe returned by a card reader, (Track2 only), or manually entered through the CardNumber. CardExpMonth, and CardExpYear.
The ResponseCode and ResponseText properties indicate whether this transaction was successful. For example:
Manually-keyed Cash Benefits transaction with cash back:
class.CardEntryDataSource = dsManuallyEntered class.CardNumber = "9999999800002773" class.CardExpMonth = 12 class.CardExpYear = 2009 class.CardPIN = "623F36B53CC18393" class.CardKSN = "000000008F000021" class.BenefitType = btCashBenefits class.TransactionAmount = "25.00" '$20 purchase with $5 cash back class.CashBack = "5.00" class.Sale()
Swiped Food Stamp transaction:
class.CardEntryDataSource = dsTrack2 class.CardMagneticStripe = "9999999800002773=09121015432112345678" class.CardPIN = "623F36B53CC18393" class.CardKSN = "000000008F000021" class.BenefitType = btFoodStamps class.TransactionAmount = "25.00" 'Cash back not supported for food stamps! class.Sale()