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 Sadad POS.


1.1 Typical Process Workflow

apptoapp
  1. POS application send order info (include order number, amount) to Sadad POSapp to pull payment checkout component.
  2. The checkout component of Sadad POScollects 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 Sadad switch.
  3. Sadad switchprocesses the transaction packet and sends to payment gateway or acquire system.
  4. Payment gateway or acquire system responses result to Sadad switch.
  5. Sadad switchresponses transaction result to Sadad POSapplication.
  6. Sadad POSapplication returns transaction result to POS application.

1.2 Integration method

POS application uses Android Intent to interact with Sadad POSapplication. The following diagram shows the interactions between these 2 applications.

  1. POS application call "startActivityForResult" function to invoke the Sadad POSapplication
  2. Sadad POSapplication parse the bundle data from POS application and then process transaction
  3. Then Sadad POSapplication 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 Pre-Init

Pre-initialize the application. This interface can reduce the latency of the first transaction.

NameTypeLengthRequestResponseDescription
versionString-MMAPI version, fixed value "A01"
transTypeString-MMThe type code of Sale transaction, fixed value PRE-INIT
appIdString18M-The payment app ID registered in SADAD switch
loginModeString-O-"Login" = need login, default value "LoginFree" = login free
userIDString-O-User ID / Login ID
userPasswordString-O-User password / Login password
resultString--MRefer to Appendix – Transaction Result Code
resultMsgString--CFailure message

2.2 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.

NameTypeLengthRequestResponseDescription
versionString-MMAPI version, fixed value "A01"
transTypeString-MMThe type code of Sale transaction, fixed value SALE
appIdString18M-The payment app ID registered in SADAD switch
loginModeString-O-"Login" = need login, default value "LoginFree" = login free
userIDString-O-User ID / Login ID
userPasswordString-O-User password / Login password
transDataJSON-MCTransaction data object
resultString--MRefer to appendix - Transaction Result Code
resultMsgString--CFailure message

transData field

NameTypeLengthRequestResponseDescription
businessOrderNoString-MMThe order number of the merchant's point of sale application or business system, it must be unique in its system
paymentScenarioString-MM"CARD" – for Card Payment
"SCANQR" – Customers scan a code to pay
"BSCANQR" – Customers display QR code to pay
"CASH" – for Cash Payment
paymentMethodString-C-Specify a Payment method. This field is mandatory only when paymentScenario is set to "3" or "4". Please refer to Payment Method Section
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
POSModeString1O-1 - Integration mode: Automatically closes the Payment App transaction results page
2 - Standalone mode: Manually close the Payment App transaction results page

Default value is 1
onScreenTipBoolean-O-Whether or not to enter tips on the Cashier page, default is false
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 transaction
refNoString12-CRetrieval Reference Number. This field returns value when card payment transaction
cardNoString19-CCard PAN number, masked according to PCI specification. Example: 430277****5723. This field returns value when card payment transaction
entryModeString1-OThis field returns value when card payment transaction:
1 - Swipe magnetic stripe card
2 - Contact chip card
3 - Contactless chip card
4 - Manual entry input
cardHolderNameString32-OCardholder name
transactionIDString32-MThe transaction ID of SADAD switch
cardTypeString1-OType of bank card:
1 - Debit card
2 - Credit card
vehicleUsageString1OOVehicle usage:
0 - Private
1 - Business
odometerReadingString6OOOdometer reading. A maximum of 6-digit integer
forecourtDataArray-O-If 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 structure can be found in forecourt field. The total sum of forecourtData item amounts must be equal to the order amount amt

forecourt field

NameTypeLengthRequestResponseDescription
codeString-M-Product Code.
Multiple fuel types per transaction are NOT allowed. It is usually a two-digit numeric code, such as 02
quantityString-M-Quantity in Litres (3 decimal places).
Keep three decimal places, for example: 1.050
amountString-M-Amount in cents.
An integer in cents, where 1 South African Rand = 100. Its unit is different from amt. Example: 100

2.3 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.
NameTypeLengthRequestResponseDescription
versionString-MMAPI version, fixed value "A01"
transTypeString-MMThe type code of Void transaction, fixed value REFUND
appIdString18M-The payment app ID registered in SADAD switch
loginModeString-O-"Login" - need login, default value "LoginFree" - login free
userIDString-O-userID / Login ID
userPasswordString-O-userPassword / Login password
transDataJSON-MCTransaction data object
resultString--MRefer to appendix - Transaction Result Code
resultMsgString--CFailure message

transData field

NameTypeLengthRequestResponseDescription
originBusinessOrderNoString-M-The order number of the original purchase transaction
businessOrderNoString-MMThe 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
paymentScenarioString-M-"CARD" – for Card Payment
"SCANQR" – Customers scan a code to pay
"BSCANQR" – Customers display QR code to pay
"CASH" – for Cash Payment
refNoString12-MRetrieval Reference Number. This field returns value when card payment transaction
originTransDateString8--Original transaction date, format: YYYYMMDD
noteString128O-The order note information
notifyUrlString128O-Service URL for receiving transaction notification webhooks
POSModeString1O-1 - Integration mode: Automatically closes the Payment App transaction results page

2 - Standalone mode: Manually close the Payment App transaction results page

Default value is 1
paymentMethodString-M-Please refer to Payment Method Section
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 transaction
cardIssuerString10-OCard issuer name
cardNoString19-MCard PAN number, masked according to PCI specification. Example: 430277****5723. This field returns value when card payment transaction
entryModeString2-OThis field returns value when card payment transaction:

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 SADAD switch

2.4 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.

NameTypeLengthRequestResponseDescription
versionString-MMAPI version, fixed value "A01"
transTypeString-MMThe type code of Authorization transaction, fixed value PREAUTH
appIdString18M-The payment app ID registered in SADAD switch
loginModeString-O-"Login" - need login, default value "LoginFree" - login free
userIDString-O-userID / Login ID
userPasswordString-O-userPassword / Login password
transDataJSON-MCTransaction data object
resultString--MRefer to appendix - Transaction Result Code
resultMsgString--CFailure message

transData field

NameTypeLengthRequestResponseDescription
businessOrderNoString-MMThe order number of the merchant's point of sale application or business system, it must be unique in its system
paymentScenarioString-M-"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
POSModeString1O-1 - Integration mode: Automatically closes the Payment App transaction results page

2 - Standalone mode: Manually close the Payment App transaction results page

Default value is 1
paymentMethodString-M-Please refer to Payment Method Section
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 transaction
cardHolderNameString32-OCardholder name
refNoString12-MRetrieval Reference Number. This field returns value when card payment transaction
cardNoString19-MCard PAN number, masked according to PCI specification. Example: 430277****5723. This field returns value when card payment transaction
entryModeString2-OThis field returns value when card payment transaction:

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
cardTypeString1-OType of bank card:

1 - Debit card
2 - Credit card

2.5 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.

NameTypeLengthRequestResponseDescription
versionString-MMAPI version, fixed value "A01"
transTypeString-MMThe type code of Authorization Completion transaction, fixed value PREAUTHCOMPLETE
appIdString18M-The payment app ID registered in SADAD switch
loginModeString-O-"Login" - need login, default value "LoginFree" - login free
userIDString-O-userID / Login ID
userPasswordString-O-userPassword / Login password
transDataJSON-MCTransaction data object
resultString--MRefer to appendix - Transaction Result Code
resultMsgString--CFailure message

transData field

NameTypeLengthRequestResponseDescription
originBusinessOrderNoString12M-The order number of the original purchase transaction
businessOrderNoString-MMThe order number of the merchant's point of sale application or business system, it must be unique in its system
paymentScenarioString-M-"CARD" – for Card Payment
amtString12MMAuthorization confirmation amount. The final payment amount and any excess authorized amount 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
authCodeString6-MAuthentication code. This field returns value when card payment transaction
noteString128O-The order note information
notifyUrlString128O-Service URL for receiving transaction notification webhooks
POSModeString1O-1 - Integration mode: Automatically closes the Payment App transaction results page

2 - Standalone mode: Manually close the Payment App transaction results page

Default value is 1
paymentMethodString-M-Please refer to Payment Method Section
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 transaction
cardNoString19-MCard PAN number, masked according to PCI specification. Example: 430277****5723. This field returns value when card payment transaction
entryModeString2-OThis field returns value when card payment transaction:

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 Pre-auth Cancellation

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

NameTypeLengthRequestResponseDescription
versionString-MMAPI version, fixed value "A01"
transTypeString-MMThe type code of Authorization Completion transaction, fixed value PREAUTHCANCEL
appIdString18M-The payment app ID registered in SADAD switch
loginModeString-O-"Login" - need login, default value "LoginFree" - login free
userIDString-O-userID / Login ID
userPasswordString-O-userPassword / Login password
transDataJSON-MCTransaction data object
resultString--MRefer to appendix Transaction Result Code
resultMsgString--CFailure message

transData field

NameTypeLengthRequestResponseDescription
originBusinessOrderNoString12M-The order number of the original purchase transaction
businessOrderNoString-MMThe order number of the merchant's point of sale application or business system, it must be unique in its system
paymentScenarioString-M-"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
authCodeString6-MAuthentication code. This field returns value when card payment transaction
notifyUrlString128O-Service URL for receiving transaction notification webhooks
POSModeString1O-1 - Integration mode: Automatically closes the Payment App transaction results page

2 - Standalone mode: Manually close the Payment App transaction results page

Default value is 1
paymentMethodString-M-Please refer to Payment Method Section
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 transaction
cardNoString19-MCard PAN number, masked according to PCI specification. Example: 430277****5723. This field returns value when card payment transaction
entryModeString2-OThis field returns value when card payment transaction:

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
versionString-MMAPI version, fixed value "A01"

2.7 Query

Query details of a specified transaction

NameTypeLengthRequestResponseDescription
versionString-MMAPI version, fixed value "A01"
transTypeString-MMThe type code of Query transaction, fixed value QUERY
appIdString18M-The payment app ID provided by SADAD switch
transDataJSON-MCTransaction data object
resultString-MRefer to appendix – Transaction Result code
resultMsgString-CFailure message

transData field

NameTypeLengthRequestResponseDescription
businessOrderNoString-MMThe 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 transaction
refNoString12-CRetrieval Reference Number. This field returns value when card payment transaction
cardNoString19-CCard PAN number, masked according to PCI specification. Example: 430277****5723. This field returns value when card payment transaction
entryModeString2-OThis field returns value when card payment transaction:

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
cashAmountString12-OCash 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.

NameTypeLengthRequestResponseDescription
versionString-MMAPI version, fixed value "A01"
transTypeString-MMThe type code of Reprint transaction, fixed value PRINT
appIdString18M-The payment app ID registered in SADAD switch
transDataJSON-MCTransaction data object
resultString--MRefer to appendix - Transaction Result Code
resultMsgString--CFailure message

transData field

NameTypeLengthRequestResponseDescription
businessOrderNoString-M-The order number of the merchant's point of sale application or business system, it must be unique in its system

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();
}
}
}

4. Appendix

4.1 Transaction result code

CategoryResult CodeDescription
Sucess00Transaction approved

Terminal kernel exception

A003There is no EMV application in card
A008Transaction has been rejected
A0362 GAC Failed
A040Init SDK failed
C000Read card exception
C001Swipe card failed
C006Card conflict
C008IC card not allow swipe first
C009Read card timeout
C011Track key not found
C014Mag-stripe mode contactless transaction not supported
G000PinPad exception
G003Enter pin canceled
G004Enter pin timeout
G005Enter pin failed
G006Online PIN payments cannot be made without a key in device

Package exception

H010Mac Error
H011Signature verification fails

Network exception

J000Network exception
J001Can't find host
J002Network connection timeout
J003Network connect failed
J004Send data failed
J005Read data failed
J006Read data timeout

Transaction exception

K018Use the same card as the original transaction
K019No data to be settled
K026Manual cancelation by operator
K027Transaction timeout
K029Low battery!
K036Auto Reversal Successful
K037Auto Reversal Failed
K039Cash back amount exceeds the limit.

Third app invoking exception

M002Parameter 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
M012

The original transaction cannot be canceled. Please ensure that:

  1. The original transaction is a pre-auth complete transaction;
  2. The original transaction has been completed;
  3. The original transaction time is today;
  4. The original transaction has not been cenceled
M013The original transaction cannot be refund
M016Duplicate merchant order number
M017Merchant does not support unreferenced refund
M018Forecourt parameter is required

Server exception

N002Sadad switchservice 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 exception

Q001System time error, please connect the network to get the time automatically!
Q002AID is not configured
Q004MerchantId or TerminalId is not configured
Q007The merchant parameter configuration is incorrect
Q008Get Key Info failed

Other exception

Z000Exception occurred. Further investigation required by technical support