Skip to main content

Same-terminal Application Integration

1. Introduction

The merchant's POS application runs at the same POS terminal. It can pull up checkout component to complete payment through the payment integration APIs of WiseCashier.

Overall structure of Same terminal application integration

1.1 Typical process workflow

Same terminal application integration workflow
  1. POS application send order info (include order number, amount) to WiseCashier app to pull payment checkout component.
  2. The checkout component of WiseCashier collects the bank card information/mobile wallet user payment voucher and processes it securely, then merges it and order information in the transaction data, and sends the payment request to Paycloud .
  3. Paycloud processes the transaction packet and sends to payment gateway or acquire system.
  4. Payment gateway or acquire system responses result to Paycloud .
  5. Paycloud responses transaction result to WiseCashier application.
  6. WiseCashier application returns transaction result to POS application.

1.2 Integration method

POS application uses Android Intent to interact with WiseCashier application. The following diagram shows the interactions between this 2 applications.

Same terminal application integration workflow integration method,POS application uses Android Intent to interact with WiseCashier application
  1. POS application call "startActivityForResult" function to invoke the WiseCashier application .
  2. WiseCashier application parse the bundle data from POS application and then process transaction.
  3. Then WiseCashier application call "setResult" function after the transaction and "finish" own Activity.
  4. POS application received the transaction result by "onActivityResult" event.

2. Transaction APIs

Different aspects of each field are defined in this document according to the following conventions.

  • M: Required parameters
  • C: Required parameters when some conditions are met
  • O: Optional parameters
  • -: Not Present

2.1 Purchase/Sale

Sale transaction refers to the payment operation performed by the cardholder when purchasing goods or services from a merchant. The transaction amount is deducted from the cardholder's account and transferred to the merchant's account.

Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMThe type code of Sale transaction, Fixed value SALE
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
loginModeStringO-“Login” - need login, default value
“LoginFree” - login free
userIDStringO-userID/Login ID
userPasswordStringO-userPassword/Login password
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
businessOrderNoStringMMThe order number of the merchant's point of sale application or business system, it must be unique in its system
paymentScenarioStringMM“CARD” – for Card Payment
“SCANQR” – Customers scan a code to pay
“BSCANQR” – Customers display qr code to pay
“CASH” – for cash Payment
paymentMethodStringC-Specify a Payment method. This field is mandatory only when "paymentScenario" is set to "3" or "4".
Please refer to Payment method
amtString12MMOrder amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
tipAmountString12OOTip amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
noteString128O-The order note information
notifyUrlString128O-Service URL for receiving transaction notification webhooks
transDateString8-MTransaction date, format: YYYYMMDD
transTimeString6-MTransaction time, format: HHMMSS
operatorString4-Ooperator's work number
authCodeString6-CAuthentication code. This field returns value when card payment transasction.
refNoString12-CRetrieval Reference Number .This field returns value when card payment transasction.
cardNoString19-CCard PAN number, It has been masked according to PCI specification. example: 430277****5723. This field returns value when card payment transasction.
entryModeString2-OThis field returns value when card payment transasction:
1 - Swipe magnetic stripe card
2 - Contact chip card
3 - Contactless chip card
4 - Manual entry input
cardIssuerNameString10-OCard issuer Name
cardIssuerIDString2-OCard Issuer ID
cardHolderNameString32-OCardholder name
transactionIDString32-MThe transaction id of Paycloud.
forecourtDataArray-OIf the merchant is a gas station, please use this parameter to set specific product information for the gas station. forecourtData is an array, and each element's structure can be found in 'forecourt field'.
The total sum of forecourtData item amounts must be equal to the order amount amt

forecourt field:

Name Type Length Request Response Description
codeStringM-Product Code
It is usually a two-digit numeric code, such as: 02
quantityStringM-Quantity Litres (3 decimals)
Keep three decimal places, for example: 1.050
amountStringM-Amount (cents)
An integer in cents, where 1 South African Rand is represented as 100 here. Its unit is different from amt.
Example: 100

2.2 Purchase Refund/Purchase Cancellation

Void transaction usually means that within a short period of time after the transaction has been completed, the merchant needs to cancel the transaction for some reason (e.g., merchant error, customer change of mind, etc.).

  • The reversal must usually be done on the same day of the transaction and before the batch settlement.
  • Upon successful reversal, the original transaction amount will be refunded to the cardholder's account as if the transaction never occurred.
  • A reversal usually requires the original transaction voucher or related information for the operation.

A refund transaction is a process in which a cardholder needs to return an item or cancel a service for some reason (e.g., a problem with the item, dissatisfaction with the service, etc.) after the transaction has cleared and requests that the amount paid be returned to the card account.

  • The refund may occur on the same day of the transaction, or a few days or more later.
  • Refunds usually require the cardholder to provide proof of purchase and a reason for the refund, and the merchant will refund the appropriate amount to the cardholder's card account after reviewing the refund.
Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMThe type code of Void transaction, Fixed value REFUND
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
loginModeStringO-“Login” - need login, default value
“LoginFree” - login free
userIDStringO-userID/Login ID
userPasswordStringO-userPassword/Login password
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
originBusinessOrderNoStringM-The order number of the original purchase transaction
businessOrderNoStringMMThe order number of the merchant's point of sale application or business system, it must be unique in its system
amtString12MMOrder amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
paymentScenarioStringM-
“CARD” – for Card Payment
“SCANQR” – Customers scan a code to pay
“BSCANQR” – Customers display qr code to pay
“CASH” – for cash Payment
refNoString12MMRetrieval Reference Number .This field returns value when card payment transasction.
originTransDateString8M-Original transaction date, format: YYYYMMDD
notifyUrlString128O-Service URL for receiving transaction notification webhooks
paymentMethodString-MPlease refer to Payment method
transDateString8-MTransaction date, format: YYYYMMDD
transTimeString6-MTransaction time, format: HHMMSS
operatorString4-Ooperator's work number
authCodeString6-MAuthentication code. This field returns value when card payment transasction.
cardIssuerString10-OCard issuer Name
cardNoString19-MCard PAN number, It has been masked according to PCI specification. example: 430277****5723. This field returns value when card payment transasction.
entryModeString2-OThis field returns value when card payment transasction:
1 - Swipe magnetic stripe card
2 - Contact chip card
3 - Contactless chip card
4 - Manual entry input
tipAmountString12-OTip amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
transactionIDString32-MThe transaction id of Paycloud.

2.3 Pre-auth

Pre-auth transactions are a type of card transaction authorization by which a merchant can ensure that the transaction amount is frozen or held in the customer's account until the transaction is completed.

During the authorization stage, the merchant requests authorization from the customer's bank for a specific amount, which is temporarily frozen if the customer has a sufficient available balance or credit limit in their account. This means that the amount is not actually deducted yet, but the customer cannot use the funds for other purchases during this time.

Authorization is commonly used in those situations where the final transaction amount is uncertain, common in lodging service, rental service, unattended self-service, etc.

Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMThe type code of Authorizaion transaction, Fixed value PREAUTH
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
loginModeStringO-“Login” - need login, default value
“LoginFree” - login free
userIDStringO-userID/Login ID
userPasswordStringO-userPassword/Login password
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
businessOrderNoStringMMThe order number of the merchant's point of sale application or business system, it must be unique in its system
paymentScenarioStringM-“CARD” – for Card Payment
amtString12MMOrder amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
noteString128O-The order note information
notifyUrlString128O-Service URL for receiving transaction notification webhooks
paymentMethodString-MPlease refer to Payment method
transDateString8-MTransaction date, format: YYYYMMDD
transTimeString6-MTransaction time, format: HHMMSS
operatorString4-Ooperator's work number
authCodeString6-MAuthentication code. This field returns value when card payment transasction.
cardIssuerString10-OCard issuer Name
refNoString12-MRetrieval Reference Number .This field returns value when card payment transasction.
cardNoString19-MCard PAN number, It has been masked according to PCI specification. example: 430277****5723. This field returns value when card payment transasction.
entryModeString2-OThis field returns value when card payment transasction:
1 - Swipe magnetic stripe card
2 - Contact chip card
3 - Contactless chip card
4 - Manual entry input
tipAmountString12-OTip amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.

2.4 Pre-auth Completion

Completion transaction is the process of requesting the merchant to formally debit the customer's account for the previously authorized amount after the authorization, when the actual consumption of the service or goods is complete and the final amount is determined. This step is a follow-up to the authorization and ensures that the merchant receives the payment.

For example, when a customer checks out of a hotel at the end of their stay, the hotel will compare the previously authorized amount to the actual amount spent; if the actual amount spent is higher, the hotel will request an additional authorization to cover the difference; if the actual amount spent is lower, only the actual amount spent will be deducted, and the remainder of the authorized amount will be released back to the customer's account.

Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMThe type code of Authorizaion Compleation transaction, Fixed value PREAUTHCOMPLETE
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
loginModeStringO-“Login” - need login, default value
“LoginFree” - login free
userIDStringO-userID/Login ID
userPasswordStringO-userPassword/Login password
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
originBusinessOrderNoString12M-The order number of the original purchase transaction
businessOrderNoStringMMThe order number of the merchant's point of sale application or business system, it must be unique in its system
paymentScenarioStringM-“CARD” – for Card Payment
amtString12MMAuthorization confirmation amount, final payment amount, and any excess amount during authorization will be refunded to the customer's account. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
authCodeString6MMAuthentication code. This field returns value when card payment transasction.
notifyUrlString128O-Service URL for receiving transaction notification webhooks
paymentMethodString-MPlease refer to Payment method
transDateString8-MTransaction date, format: YYYYMMDD
transTimeString6-MTransaction time, format: HHMMSS
operatorString4-Ooperator's work number
refNoString12-MRetrieval Reference Number .This field returns value when card payment transasction.
cardNoString19-MCard PAN number, It has been masked according to PCI specification. example: 430277****5723. This field returns value when card payment transasction.
entryModeString2-OThis field returns value when card payment transasction:
1 - Swipe magnetic stripe card
2 - Contact chip card
3 - Contactless chip card
4 - Manual entry input
cardIssuerString10-OCard issuer Name
tipAmountString12-OTip amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.

2.5 Pre-auth Cancellation

When the pre-authorization transaction is canceled, the frozen funds will be returned to the cardholder's account.

Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMThe type code of Authorizaion Compleation transaction, Fixed value PREAUTHCANCEL
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
loginModeStringO-“Login” - need login, default value
“LoginFree” - login free
userIDStringO-userID/Login ID
userPasswordStringO-userPassword/Login password
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
originBusinessOrderNoString12M-The order number of the original purchase transaction
businessOrderNoStringMMThe order number of the merchant's point of sale application or business system, it must be unique in its system
paymentScenarioStringM-“CARD” – for Card Payment
amtString12MMAuthorization confirmation amount, final payment amount, and any excess amount during authorization will be refunded to the customer's account. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
authCodeString6MMAuthentication code. This field returns value when card payment transasction.
notifyUrlString128O-Service URL for receiving transaction notification webhooks
paymentMethodString-MPlease refer to Payment method
transDateString8-MTransaction date, format: YYYYMMDD
transTimeString6-MTransaction time, format: HHMMSS
operatorString4-Ooperator's work number
refNoString12-MRetrieval Reference Number .This field returns value when card payment transasction.
cardNoString19-MCard PAN number, It has been masked according to PCI specification. example: 430277****5723. This field returns value when card payment transasction.
entryModeString2-OThis field returns value when card payment transasction:
1 - Swipe magnetic stripe card
2 - Contact chip card
3 - Contactless chip card
4 - Manual entry input
cardIssuerString10-OCard issuer Name
tipAmountString12-OTip amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.

2.6 Settlement

Reconcile transactions with the bank to confirm if there are any discrepancies, and settle transactions that have no discrepancies.

Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMFixed value SETTLEMENT
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
settlementTypeString12-M“ALL” – to be settle all available host.
“SEL” – to be settle selected host.
transCountString12-Mnumber of transactions
totalAmountString12-OTotal amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
refundCountString12-Onumber of refund transactions. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
refundTotalAmountString6-OTotal of refund amount
transDateString8-MTransaction date, format: YYYYMMDD
transTimeString6-MTransaction time, format: HHMMSS
operatorString4-Ooperator's work number

2.7 Query

Query details of a specified transaction

Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMThe type code of Query transaction, Fixed value QUERY
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
businessOrderNoStringMMThe order number of the merchant's point of sale application or business system, it must be unique in its system
amtString12-MOrder amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
transDateString8-MTransaction date, format: YYYYMMDD
transTimeString6-MTransaction time, format: HHMMSS
operatorString4-Ooperator's work number
authCodeString6-CAuthentication code. This field returns value when card payment transasction.
refNoString12-CRetrieval Reference Number .This field returns value when card payment transasction.
cardNoString19-CCard PAN number, It has been masked according to PCI specification. example: 430277****5723. This field returns value when card payment transasction.
entryModeString2-OThis field returns value when card payment transasction:
1 - Swipe magnetic stripe card
2 - Contact chip card
3 - Contactless chip card
4 - Manual entry input
tipAmountString12-OTip amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
cardIssuerNameString10-OCard issuer Name
cardIssuerIDString2-OCard Issuer ID
cardHolderNameString32-OCardholder name

2.8 Print

Reprint the specified transaction. It will be marked "Reprint" in the receipt.

Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMThe type code of Reprint transaction, Fixed value PRINT
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
businessOrderNoStringM-The order number of the merchant's point of sale application or business system, it must be unique in its system

2.9 DebiCheck

Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMThe type code of Reprint transaction, Fixed value DEBICHECK
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
loginModeStringO-“Login” - need login, default value
“LoginFree” - login free
userIDStringO-userID/Login ID
userPasswordStringO-userPassword/Login password
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
businessOrderNoStringMMThe order number of the merchant's point of sale application or business system, it must be unique in its system
contractReferenceNoStringMMContract reference number
accountNoStringMMBank card number to be verified
debtorIdentificationNoStringMMDebtor identification number
creditorNameStringMMCreditor name
installmentAmountString12MMInstallment amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
maxCollectionAmountString12MMMaximum amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
firstCollectionDateString10M-First collection date
monthlyCollectDateString2M-Monthly collect date
noteString128O-The order note information
notifyUrlString128O-Service URL for receiving transaction notification webhooks
transDateString8-MTransaction date, format: YYYYMMDD
transTimeString6-MTransaction time, format: HHMMSS
operatorString4-Ooperator's work number

2.10 CashBack

CashBack refers to the process where, when a cardholder makes a purchase from a merchant, the merchant refunds a portion of the transaction amount to the cardholder's account based on a specified cashback percentage. The cashback amount is transferred from the merchant's account to the cardholder's account as a promotional reward. The cashback is typically reflected in the cardholder's account in the form of cash or equivalent credit.

Name Type Length Request Response Description
versionStringMMAPI version, fixed value "A01"
transTypeStringMMThe type code of Sale transaction, Fixed value CASHBACK
appIdString18M-The payment app id registered in Paycloud, Please refer to the Payment gateway integration guide
loginModeStringO-“Login” - need login, default value
“LoginFree” - login free
userIDStringO-userID/Login ID
userPasswordStringO-userPassword/Login password
transDataJSONMC
resultString-MRefer to appendix - Transaction result code
resultMsgString-CFailure message

transData field

Name Type Length Request Response Description
businessOrderNoStringMMThe order number of the merchant's point of sale application or business system, it must be unique in its system
paymentScenarioStringMM“CARD” – for Card Payment
amtString12MMOrder amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
tipAmountString12OOTip amount. Unit in the smallest denomination of the currency (cents), for example, 1 USD = 100 cents, 1 ZAR = 100 cents, 1 NAD = 100 cents.
noteString128O-The order note information
notifyUrlString128O-Service URL for receiving transaction notification webhooks
transDateString8-MTransaction date, format: YYYYMMDD
transTimeString6-MTransaction time, format: HHMMSS
operatorString4-Ooperator's work number
authCodeString6-CAuthentication code. This field returns value when card payment transasction.
refNoString12-CRetrieval Reference Number .This field returns value when card payment transasction.
cardNoString19-CCard PAN number, It has been masked according to PCI specification. example: 430277****5723. This field returns value when card payment transasction.
entryModeString2-OThis field returns value when card payment transasction:
1 - Swipe magnetic stripe card
2 - Contact chip card
3 - Contactless chip card
4 - Manual entry input
cardIssuerNameString10-OCard issuer Name
cardIssuerIDString2-OCard Issuer ID
cardHolderNameString32-OCardholder name
transactionIDString32-MThe transaction id of Paycloud.

3. Sample Code

Intent intent = new Intent();
intent.setAction("com.wiseasy.transaction.call");
intent.putExtra("version", "A01");
intent.putExtra("appId", "yourappid");
intent.putExtra("transType", "SALE");
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("businessOrderNo","202202222222");
jsonObject.put("paymentScenario","CARD");
jsonObject.put("amt","000000001000");
intent.putExtra("transData", jsonObject.toString());
} catch (JSONException e) {
e.printStackTrace();
}
startActivityForResult(intent, 1);

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
String result = data.getStringExtra("result");
String resultMsg = data.getStringExtra("resultMsg");
String transData = data.getStringExtra("transData");
if (result.equals("00")){
try {
JSONObject jsonObject = new JSONObject(transData);
String amount = jsonObject.getString("amt");
}catch(JSONException e){
e.printStackTrace();
}
}
}
Please refer to the GitHub source code.

4. Appendix

4.1 Transaction result code

Category Result Code Description
Sucess00Transaction approved
Terminal kernel exceptionA003There is no EMV application in card
A008Transaction has been rejected
A020IC command failed
A0362 GAC Failed
A040Init SDK failed
Card recognizing exceptionC000Read card exception
C001Swipe card failed
C004Read card failed
C006Card conflict
C008IC card not allow swipe first
C009Read card time out
C011Track key not found
C014Mag-stripe mode contactless transaction not supported
Pin-pad exceptionG000PinPad exception
G003Enter pin canceled
G004Enter pin timeout
G005Enter pin failed
Package exceptionH010Mac Error
H011Signature verification fails
Network exceptionJ000Network exception
J002Network connection timeout
J003Network connect failed
J004Send data failed
J005Read data failed
J006Read data timeout
Transaction exceptionK018Use the same card as the original transaction
K019No data to be settled
K026Manual cancelation by operator
K027Transaction timeout
K029Low battery!
Third app invoking exceptionM002Parameter error
M003Invalid Amount
M007This function is not supported now
M008The invoke version is incorrect
M009Invalid application invoke
M010Can`t find original transaction
M011The original transaction cannot be void
M013The original transaction cannot be refund
M014The original transaction cannot be completion
Server exceptionN002Paycloud service request exception
N003Acquire service request exception
User exception P001Incorrect account or password, please try again
P002The account is locked and cannot be logged in
Init exceptionQ001System time error, please connect the network to get the time automatically!
Q002AID is not configured
Q003Payment is not configured.Please contact support.
Other exceptionZ000Exception occurred. Further investigation required by technical support.