Interface for Executing a TAP Transaction via CardCom Using a Third-Party Application (Using SDK)
Prerequisites for Executing a TAP Transaction via the SDK
- Purchase the Tap On Phone module only.
- At this stage, the feature supports Android devices only.
- Register the Finpad device with the Israel Payments Association (S.B.A.).
- Android: the device must include NFC.
- Android: location services must be enabled.
- Android: make sure that Developer options are disabled.
Overview of the TAP Payment Process
- When the application is launched for the first time:
- Call the CardCom API to obtain the details and register the endpoint device.
- Register the device with the SDK using
RegisterDevice.
- For each payment transaction:
- Call the device to perform a credit card payment (NIS 100), using the response received in step 1.a.
- Receive the device response and send it to the CardCom API.
Note:
The RegisterDevice response received in step 1 is valid for a limited period. Step 1 must be performed periodically; the registration validity period is returned when the function is called.
Installing the SDK in the Application
- Make sure that the application has the following permissions:
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature android:name="android.hardware.nfc" android:required="false" />
- Add the SDK to the application.
We will provide the files. Add them under dependencies:
implementation "com.denovo:topliteapp-PROD:3.0.1.2"
implementation files("../libs/CardCom-v1.2.16-Release_Prod.aar")Step 1.a: Call the CardCom API to Obtain Details and Register the Endpoint Device
Device registration request
| Name | Description | Example |
|---|---|---|
| ApiName | Terminal username | |
| Terminal | CardCom terminal number | |
| UID | Device UID |
Response
| Name | Description | Example |
|---|---|---|
| ResponseCode | 0 = success; any other value = failure | |
| Description | Error message description | |
| TPN | Save at the application level. Send when registering the device in step 1.b. | |
| MerchantCode | Save at the application level. Send when registering the device in step 1.b. | |
| SapakMutavNumber | Save at the application level. Send when performing the payment in step 2.a. |
Step 1.b: Register the Device with the SDK Using RegisterDevice
Register the device by calling topService.registerDevice. See the example below.
Call parameters:
| Name | Description | Example |
|---|---|---|
| TPN | As received in step 1.a. | |
| MerchantCode | As received in step 1.a. |
Parameters received in onRegisterSuccess:
| Name | Description | Example |
|---|---|---|
| message | Success message | |
| session_key | Save at the application level. Send when performing a transaction. | |
| auth_token | Save at the application level; not currently used. | |
| session_created_timestamp | When the session key was created. | |
| session_expire_time | Validity period of the session key, starting from session_created_timestamp. |
When the session_key expires, register the device again. The registration is valid while session_created_timestamp + session_expire_time is later than the current date.
Parameters received in onRegisterError:
| Name | Description | Example |
|---|---|---|
| error_code | Error message code—see the list of codes. | |
| error_message | Error message description. |
We recommend displaying the error message and error code to the user for troubleshooting.
Example request:
ToPService topService = new ToPService(Activity activity);
topService.registerDevice(tpn, merchantCode, new ToPService.onRegistrationListener() {
@Override
public void onProcess(String message) {
// UPDATE PROGRESS DIALOG message HERE
}
@Override
public void onRegisterSuccess(JSONObject successObject) {
// DISMISS PROGRESS DIALOG HERE
// sample success response
// {
// "message": "Registration done successfully",
// "session_key": "xxxxxxxxxxxxxxxxxxxxxx",
// "auth_token": "xxxxxxxxxxxxxxxxxxxxxx",
// "session_created_timestamp": "1672038767",
// "session_expire_time": "86400"
// }
}
@Override
public void onRegisterError(JSONObject errorObject) {
// DISMISS PROGRESS DIALOG HERE
// sample error response
// {"error_code": "403", "error_message": "Invalid TPN"}
}
});Step 1.b: Perform the Payment on the Device
Call topService.performTransaction.
| Name | Description | Example | Type |
|---|---|---|---|
| sessionKey | As received during registration in step 1.b. | ||
| inputObject | |||
| type | REFUND or SALE. | SALE – paymentREFUND – refund | String |
| amount | Amount. | Number only | |
| Lang | Always iw. | Hebrew | |
| CustomObject | |||
| CustomerName | Optional. | ||
| CustomerEmail | Optional. | ||
| PhoneNumber | Optional. | ||
| HolderID | Optional. | ||
| AllowFullCardNumberInResponse | True. | ||
| SapakMutavNumber | As received in step 1.a. | ||
| NumberOfPayments | Number of payments. | ||
| CreditType | If the number of payments is 1, send value 1. If the number of payments is greater than 1, send value 8 for regular installments or value 6 for credit installments. |
Response:
| Name | Description | Example | Type |
|---|---|---|---|
| response_code | Response code. | 0 | String |
| message | Response description. | String | |
| status | Transaction status. | Approved / Declined | String |
| transaction_id | Transaction number. | 000123456789 | String |
| transactionResult | Transaction details. | String | |
| customMessage | String | ||
| DE48 | String | ||
| ReturnCode | Response code. | 0 | String |
| ReturnMessage | Response description. | String | |
| CardNumber | Card number. | 4580000000000000 | String |
| ExpDate_MMYY | Card expiration date. | 06/29 | String |
| CardBrandCode | Card brand code. | 1 | String |
| CardIssuerCode | Card issuer code. | 1 | String |
| CardFinancerCode | Card acquirer code. | 2 | String |
| Token | Card token. | 56f1321c-03b7-478e-a0dc-76ff83e3c8c5 | String |
| ApprovalNumber | Approval number. | 1234567 | String |
| ResultRecord | Encrypted transaction details. | String | |
| UID | Transaction identifier. | 0000123456789123456789 | String |
Example payment request:
{
"type": "REFUND" / "SALE",
"amount": "1.00",
"lang": "iw",
"CustomObject": {
"CustomerName": "Test Test",
"CustomerEmail": "test@test.test",
"PhoneNumber": "9999999999",
"HolderID": "999999999",
"AllowFullCardNumberInResponse": true,
"SapakMutavNumber": "123456",
"NumberOfPayments": 1,
"CreditType": 1
}
}
ToPService topService = new ToPService(Activity activity);
topService.performTransaction(inputObject, sessionKey, new ToPService.OnTransactionListener() {
@Override
public void onTransactionResponse(JSONObject successObject) {
// response_code: '00' means a successful transaction;
// any other value means that the transaction failed
}
@Override
public void onTransactionError(JSONObject errorObject) {
// sample error response
// {"error_code": "21", "message": "Transaction Cancelled"}
}
@Override
public void onRegisterNeeded(JSONObject errorObject) {
// sample error response
// {
// "error_code": "990",
// "message": "Session key is expired, To authenticate, please re-initiate device registration api"
// }
}
});Calling the CardCom Server to Register the Transaction—Step 2.b
Request
| Name | Description | Example |
|---|---|---|
| ApiName | Terminal username. | |
| Terminal | CardCom terminal number. | |
| UID | Device UID. | |
| SdkTransactionInfo | The request sent in step 1.b. | |
| TransactionResult | The response returned in step 1.b. |
Response
| Name | Description | Example |
|---|---|---|
| ResponseCode | Response code. | 0 = success / any other value = failure |
| Description | Response description. |
Note: If a communication error occurs, send the request again.
If an error is received, the card will not be charged. Display a failed-payment message.
Afterward, register the physical device through the API and register successful transactions according to the following interface: