IPIS
In this article
Some payment devices, like the PSP AltaPay, have the pin entry software (gateway) inside the same device as the POS, called Payment Initiation Service (PIS). The AltaPay (A920), for example, is an Android phone with the payment device and an application that acts as the pin entry software located on the same device. That software communicates with another android application (the POS) with an Intent.
All interaction is done through intents and is handled by the POS application. LS Pay only creates the intent needed and then interprets the result.
Life cycle
The intent instance is activated on the device and returns a result that is processed in LS Pay. LS Pay returns a TransactionResponse with all data given by the transaction.
Example: Android device calls a function in LS Pay that returns intent that is then activated by StartActivity
in the Mono library.
if (engineService.eftType == EFTType.PIS)
{
var intent = engineService.GetPurchaseIntent(paymentRequest, Application.Context.PackageName, "LSPay.TestActivity");
StartActivity(intent as Intent);
}
When the activity finishes, the POS will send the result to LS Pay that returns the response.
protected override void OnResume()
{
base.OnResume();
// TODO check if it's from pax
if (Intent != null && Intent.Data != null)
{
try
{
var response = this.engineService.ParseIntentResponsToTransactionResponse(Intent, Application.Context);
if (response.TransactionType.Equals(TransactionType.Payment))
{
ShowAlert("Purchase response", response.ToString());
}
}
catch(Exception e)
{
ShowAlert("Error processing the response", e.Message);
}
}
this.engineService.EnteringForeground();
}
Core functions
The IPIS interface is simpler than the IPED, having basic functions to get intent for the communication and a parse function for the response data. All functions returning an intent return an object of the type Intent (for Android) and receive these variables:
Transaction request variables
- Request type
- Basic request types: PaymentRequest, RefundRequest, VoidRequest
- Application name
- Name of the Android app ("com.company.name");
- Schema
- The name put into the activity, needed when handling the response
Core functions
- GetPurchaseIntent
- The function returns an object of the type Intent (for Android) and receives request of the type PaymentRequest.
- GetRefundIntent
- The function returns an object of the type Intent (for Android) and receives request of the type RefundRequest.
- GetVoidIntent
- The function returns an object of the type Intent (for Android) and receives request of the type VoidRequest.
- Last transaction
- The function returns an object of the type Intent (for Android).
- ProcessIntentResponse
- This function receives two variables: intent of the type Intent (for Android) with information regarding the intent results; and context of the type Context (Android Context) with additional information.
- The function returns TransactionResponse with all information returned from the PSP through the intent.
- GetTransactionType
- The function returns object of the enum type TransactionType from receipt data
Example
When accessing the functions in the IPIS interface, a cast is needed ((IPIS)eft).
Step 1: Create an instance of IEFTManagement (eft)
eft = eam.GetEft();
Step 2: Get instance of the intent from LS Pay for the action needed (here the purchase)
private async void MakePaymentRequest(PaymentRequest paymentRequest)
{
payProgressDialog.StartProgressDialog(this, GetString(Resource.String.main_progress_processing));
paymentRequest.TransactionId = "123ABC";
try
{
if (engineService.eftType == EFTType.PIS)
{
var intent = ((IPIS)eft).GetPurchaseIntent(paymentRequest, Application.Context.PackageName, "LSPay.TestActivity");
StartActivity(intent as Intent);
}
}
catch (Exception e)
{
ShowAlert(GetString(Resource.String.error), e.Message);
}
payProgressDialog.DismissProgressDialog();
}
Step 3: Finally, get information from the OnResume()
function, and send it to LS Pay to be processed.
protected override void OnResume()
{
base.OnResume();
// TODO check if it's from pax
if (Intent != null && Intent.Data != null)
{
try
{
var response = this.engineService.ParseResponseToTransactionResponse(Intent, Application.Context);
if (response.TransactionType.Equals(TransactionType.Payment))
{
ShowAlert("Purchase response", response.ToString());
}
}
catch(Exception e)
{
ShowAlert("Error processing the response", e.Message);
}
}
this.engineService.EnteringForeground();
}
Progress update
No progress information is needed since the intent is active on the device and will display all information.
Cancel
No cancel is needed, the cardholder can cancel at any time on the PED.
Other methods
No other methods are in the interface.