(* To save this script as an AppleScript, save this page to your Desktop, rename it to applescriptsample.scpt. To run this script, double-click on it, and it will open up in AppleScipt Editor. To see the log of the script running, select the Event Log in the bottom window of the Script Editor.
To run this as a card present transaction you must use the track data property. You normally capture this information from a Card Swipe (a HID device). I have provided a sample of data from a test credit card in this script. This information will show up as a Track1 or Track2 transaction on the EFSnet web site xml report.
A transaction that is manually entered (comment out the track data line and run the script with the hard-coded information), will show up as Keyed on the EFSnet web site xml report.
You will note that if the track data is populated as well as the other information, track data takes precedence over any other data that is sent to First Data. You must send manually entered data or track data, though you can send both. If both are sent, track data is used. *)
tell application "AuthPayX (First Data) Demo"
make new sale
tell sale 1
set the card type to Debit Card
set the type to Charge
(* You should send a unique reference number for each transaction *)
set the reference number to "0412212117"
(* The amount is also unique per transaction... *)
set the amount to "59.25"
(* Although the following 2 properties are required for each and every transaction, in this case they will be ignored at EFSnet as track data is present. Track data supercedes any manual entry when it is present, in relation to the account number and expiration date. The following 2 set lines simulate manually setting these properties... They are not used by First Data/EFSnet for this transaction since track data is set and sent. *)
set the account number to "4012888888881"
set the expiration date to "0615"
(* Note that the test card that was swiped is a different Visa card. *)
set the track data to "%B4011190070070071^DEBIT TRACK1 & 2^131012345678911111111?
;4011190070070071=131012345678911?"
(* The following properties are optional and are not required to be sent if track data is present. *)
set the street to "1234"
set the zip to "12345"
solicit PIN -- Have the customer entertheir PIN number into the PIN Pad.
submit transaction
end tell
set x to properties of sale 1
delete sale 1
set the result to x
end tell