Integrating tips.
Integrating tip screen.
To start handling tips with this feature, the library [NETPAY Smart SDK] must be downloaded from the following drive(https://drive.google.com/file/d/1j_9FntNa9VQ_CmISD6S_OtiDs6nRr5Kf/view?usp=sharing ), this feature is only available from Smart Pinpad Dev 1.3.5.p.p_20220530 or latest, which can be found at the NetPay Market.
The following code implements the doTrans method, which now includes a new boolean parameter. This parameter is “displayScreenTip”, which will call the tip screen once the request is made to the Smart PinPad.
saleWithTip.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
String string_amount = amountEt.getText().toString();
double amount = string_amount.equals("") ? 0.0: Double.parseDouble(string_amount);
String string_msi = act_msi.getText().toString();
Integer msi = (string_msi.equals("Sin Meses") || string_msi.equals("")) ? 0 : Integer.parseInt(string_msi);
String string_tip = amountTip.getText().toString();
double tip = string_tip.equals("") ? 0: Double.parseDouble(string_tip);
String folio = folioEt.getText().toString();
try {
SaleRequest sale = new SaleRequest("mx.com.netpay.demosdk", amount, tip, msi, null, null,
null, null, folio, null, null, null, null,
null, null, null);
smartApi.doTrans(sale, null, null, true);
}
catch(Exception e){
Toast.makeText(MainActivityJava.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
Demo SDK ( Java)
In the following path you can download the demo SDK in Java.
Once the Smart Pinpad receives the request with this new parameter, the following screen will be displayed:
On this screen you will be able to choose an option as shown on the image below. Also, the user can enter a different tip amount or percentage with the Other option.
Note: The max amount for a tip is 25%, setting any other amount above will not let you continue with the transaction.
After that, the following screen will be showed. This screen displays a detailed summary of the transaction, the subtotal amount, tip, and total that will be charged.
Finally, if the operation is successful, the following ticket will be printed with a new section showing the breakdown of the tip.
Error message (Tip percentage exceeding 25%)
Entering a percentage exceeding 25% of the total amount of the sale in the "Other (%)" option
Entering an amount exceeding 25% of the total amount of the sale in the "Other ($) option.
When pressing the "Continue" button, the terminal will display the message "Oops! The tip cannot be greater than 25%"
By pressing the "Accept" button, the screen will allow you to adjust the amount or percentage of the tip to continue with the sale.
The breakdown of the subtotal (amount of the sale) Tip (amount destined to collect for tip) and total (Sum between the Subtotal + Tip) will be shown.
Pressing "continue" on the previous screen will display the screen Waiting for card reading in which you can continue with the collection process.
Business ticket
Costumer ticket.
JSON Response
{
"affiliation":" 9352287370",
"amount":"109.0",
"authCode":"222222",
"bin":"376665",
"cardType":"C",
"cardTypeName":"AMEX",
"folioNumber":"prueba1",
"isRePrint":false,
"orderId":"200917102306-0820649118",
"reprintModule":"C",
"spanRoute":"1234",
"transDate":"SEP,17,20 15:10:06",
"transType":"A",
"meessage":"Transaccion exitosa",
"success":true
}
Updated over 1 year ago