When the payment information has been retrieved and the device returns it, you transfer it into JavaScript. See the Appcelerator module documentation which tells you how to communicate across the JavaScript bridge. For example, the Verifone device module that is included with Commerce Cloud Endless Aisle fires the event magneticCardData. The result is returned across the JavaScript bridge, in JavaScript. The verifoneDevice.js code contains an event listener for the magneticCardData event.
After the data is returned from the device, you call either one of these events with the payment information in the payload:
The Adyen code looks like this:
Alloy.eventDispatcher.trigger('payment:cc_approved', {
owner: e.cardHolderName,
card_type: e.cardString,
pan: "xxxx-xxxx-xxxx-"+e.cardNumber,
month: e.cardExpiryMonth,
year: e.cardExpiryYear,
transaction_id: e.pspReference,
payment_reference_id: e.pspAuthCode,
is_contactless: false
});
For release 1.7.1 and earlier:
Ti.App.fireEvent('cc_payment_approved', {
owner: e.cardHolderName,
card_type: e.cardString,
pan: "xxxx-xxxx-xxxx-"+e.cardNumber,
month: e.cardExpiryMonth,
year: e.cardExpiryYear,
transaction_id: e.pspReference,
payment_reference_id: e.pspAuthCode,
is_contactless: false
});
At this point the payment process is complete.
Alloy.eventDispatcher.trigger('payment:credit_card_data', {
track_1:e.track1,
track_2:e.track2,
pan:e.pan,
month:e.month,
year:e.year,
is_contactless:e.contactless == "true",
terminal_id:e.terminal_id
});
For release 1.7.1 and earlier:
Ti.App.fireEvent('cc_payment_entered', {
track_1:e.track1,
track_2:e.track2,
pan:e.pan,
month:e.month,
year:e.year,
is_contactless:e.contactless == "true",
terminal_id:e.terminal_id
});