Create a Payment Initialization class object and call initiate transaction method by passing the parameters mentioned in the request parameters table.
PayU’s POS terminals support two types of transaction as follows:
- Sale
Customer can use debit or credit card in Sale mode and make transaction “N” number of times. For Sale Transaction, Amount should above Rs. 1000/- (check test cases) in UAT Environment. For production amount should be Minimum of Rs. 5/-. - EMI
Customer can use credit card in EMI mode and make transaction “N” number of times. To support EMI
transaction type please refer EMI Transaction APIs
Watch Out
Request parameters are consistent for all types of transaction . Only the
transactionType
parameter will be changed with the corresponding transaction type.
Method: POST
Request parameters
Parameter | Description | Example |
---|---|---|
Handler
|
| handler |
Device type
|
| DeviceType.ME30S |
Address
|
| |
Amount |
| 11.00 |
Transaction type
|
| PaymentTransactionConst ants.SALE/EMI |
Payment Type
|
| PaymentTransactionConst ants.POS |
Mobile Number |
| 9000000000 |
Name |
| |
Latitude |
| 71.000001 |
Longitude |
| 17.0000001 |
Merchant reference number
|
| 123456 |
Cash back amount
|
| null |
deviceCommMode
|
| DeviceCommunicationMode.BLUETOOTHCOMMUNICATION |
orderReferenceNo
|
| |
appName
|
| |
appVersion |
|
Sample request
try {
initialization = new PaymentInitialization(
PaymentTransactionActivity.this);
initialization.initiateTransaction(handler, deviceName, address, amount,
paymentType, PaymentTransactionConstants.POS, null, null, 71.000001, 17.000001,
merchantRefNo, null, deviceCommMode, merchantRefNo, null, null);
} catch (RuntimeException e) {
e.printStackTrace();
}
Response parameters
Parameter | Description | Example |
---|---|---|
ICCTransactionRes ponse |
| Refer to ICCTRANSACTIONRESPONS payload objects. |
Sample response
Use this code to fetch the response of this API.
@SuppressLint("HandlerLeak")
private final Handler handler = new Handler() {
public void handleMessage(android.os.Message msg) {
checkFlag = true;
if (msg.what == SOCKET_NOT_CONNECTED) {
alertMessage((String) msg.obj);
}
i
f(msg.what == QPOS_ID) {
Toast.makeText(PaymentTransactionActivity.this, (String) msg.obj,
Toast.LENGTH_LONG).show();
} else if (msg.what == CHIP_TRANSACTION_APPROVED ||
msg.what == SWIP_TRANSACTION_APPROVED) {
ICCTransactionResponse iCCTransactionResponse = (ICCTransactionResponse)
msg.obj;
if (iCCTransactionResponse.isSignatureRequired()) {
Intent i = new Intent(PaymentTransactionActivity.this,
SignatureCaptureActivity.class);
i.putExtra("vo", iCCTransactionResponse);
//mpaysdk 2.0
i.putExtra("paymentType", paymentType);
finish();
PaymentTransactionActivity.this.startActivity(i);
} else {
Intent i = new Intent(PaymentTransactionActivity.this,
TransactionDetails.class);
i.putExtra("vo", iCCTransactionResponse);
//mpaysdk 2.0
i.putExtra("paymentType", paymentType);;
f
inish();
PaymentTransactionActivity.this.startActivity(i);
}
} else if (msg.what == CHIP_TRANSACTION_DECLINED ||
msg.what == SWIP_TRANSACTION_DECLINED) {
ICCTransactionResponse vo = (ICCTransactionResponse) msg.obj;
Intent i = new Intent(PaymentTransactionActivity.this, TransactionDetails.class);
i.putExtra("vo", vo);
i.putExtra("paymentType", paymentType);
PaymentTransactionActivity.this.startActivity(i);
Toast.makeText(PaymentTransactionActivity.this, "Transaction Status : " +
vo.getResponseCode() + ":" + vo.getResponseMessage(), Toast.LENGTH_LONG).show();
finish();
} else if (msg.what == QPOS_DEVICE) {
alertMessage((String) msg.obj);
} else if (msg.what == TRANSACTION_FAILED) {
ICCTransactionResponse vo = (ICCTransactionResponse) msg.obj;
if (paymentType.equalsIgnoreCase(EMI)) {
Intent i = new Intent(PaymentTransactionActivity.this,
TransactionDetails.class);
i.putExtra("vo", vo);
i.putExtra("paymentType", paymentType);
PaymentTransactionActivity.this.startActivity(i);
Toast.makeText(PaymentTransactionActivity.this, "Transaction Status :
" + vo.getResponseCode() + ": " + vo.getResponseMessage(), Toast.LENGTH_LONG).show();
finish();
}
else {
Toast.makeText(PaymentTransactionActivity.this, "Transaction Status :
" + vo.getResponseCode() + ": " + vo.getResponseMessage(), Toast.LENGTH_LONG).show();
finish();
}
} else if (msg.what == TRANSACTION_INITIATED) {
Toast.makeText(PaymentTransactionActivity.this, msg.obj.toString(), Toast.LE NGTH_LONG).show();
} else if (msg.what == ERROR_MESSAGE) {
alertMessage((String) msg.obj);
} else if (msg.what == TRANSACTION_PENDING) {
Toast.makeText(PaymentTransactionActivity.this,
(String) msg.obj + "Pending status",
Toast.LENGTH_SHORT).show();
finish();
} else if (msg.what == DISPLAY_STATUS) {
Toast.makeText(PaymentTransactionActivity.this,
(String) msg.obj, Toast.LENGTH_SHORT).show();
} else if (msg.what == QPOS_EMV_MULITPLE_APPLICATION) {
ArrayList < String > applicationList = (ArrayList < String > ) msg.obj;
emvList = (ListView) findViewById(R.id.application_list);
emvList.setVisibility(View.VISIBLE);
ArrayAdapter < String > adapter = new
ArrayAdapter < String > (PaymentTransactionActivity.this,
android.R.layout.simple_list_item_1, applicationList);
emvList.setAdapter(adapter);
emvList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView < ? > parent, View view,
int position, long id) {
if (initialization != null) {
initialization.getQposListener().executeSelectedEMVApplication(position);
emvList.setVisibility(View.GONE);
}
}
});
} else if (msg.what == SUCCESS) {
Toast.makeText(PaymentTransactionActivity.this,
(String) msg.obj, Toast.LENGTH_SHORT).show();
Intent i = new Intent(PaymentTransactionActivity.this,
MainActivity.class);
finish();
PaymentTransactionActivity.this.startActivity(i);
}
}
};