Sale

Description

The Sale function initiates the payment application to facilitate payment for goods or services rendered to customers.


Request

Parameters

The following table describes the parameters of the SALE request message.

PARAMETERSTYPEDESCRIPTIONEXAMPLE
REQUIRED
launchTypeSTRINGMust be “SALE”
Used for launching the Ecentric Payment App to process a payment.
SALE
merchantIDSTRINGThe merchant ID assigned to the merchant.
The merchant ID will always be the same ID for a specific merchant.
To be provided by Ecentric.
910100000000001
authenticationKeySTRINGThe authentication token that was generated by the server on a successful retail auth call to the Ecentric Payment App.e27b5456-8bff6-4746-94bg-367253356eb
transactionAmountLONGThe full transaction amount to be charged in cents.
This amount will include a cashAmount if it was specified.
1000
OPTIONAL
merchantNameSTRING
ALPHANUMERIC WITH SPACES
The name of the merchant that requested the transaction, as stored at the bank.Merchant A
cashAmountLONGThe amount of cash that was withdrawn in cents.
The cashAmount will be included in the transacionAmount.
500
transactionDescriptionSTRING
ALPHANUMERIC WITH SPACES
Reference description for the merchant’s records.3rd party app desc
transactionReferenceNumberSTRING
ALPHANUMERIC
Reference number field that also appears in a merchant portal when available.ref#123456
cellNumberToSMSReceiptSTRING
NUMERIC
10-digit cell phone number for receipt SMS destination. Can be blank.
NOTE: If isReceiptRequired is true then this is a mandatory field.
0721234567
emailAddressToSendReceiptALPHANUMERICValid email address for receipt email destination. Can be blank.
NOTE: If isReceiptRequired is true then this is a mandatory field.
[email protected]
isReceiptRequiredBOOLEANIf set to true, at least one of the receipt parameters above needs to be set.
If set to false the user will not be prompted to send a receipt after payment using the Ecentric Payment App.
NOTE: According to VISA and Mastercard requirements, this must always be set to true unless the app developer is providing an alternative means to send a receipt
true
alwaysShowTransactionStatusScreenBOOLEANOnce the Ecentric Payment App has processed a transaction there is a status screen that shows the success/failure of processing.
Set this flag to true if you would like this displayed otherwise false to hide it. Default is false.
true
externalSTANSTRING
NUMERIC
A systems trace number generated by some 3rd party ERP systems.123456
externalRRNSTRING ALPHANUMERICA RRN generated by some 3rd party ERP systems.ABCDEF123456
externalTransactionGUIDSTRING ALPHANUMERICA GUID that identifies a specific transaction generated by 3rd party ERP systems.2fdca02f-3cbe-4e8c-82ad-86a1a16b72e8
externalInvoiceGUIDSTRING ALPHANUMERICA GUID that identifies a particular invoice that may appear on more than one transaction.2fdca02f-3cbe-4e8c-82ad-86a1a16b72e9
transactionUuidSTRING ALPHANUMERICUnique ID of transactionbdf9d0af-17b3-48ca-8a0b-37dc52bf49bc
externalTransactionDateTimeSTRINGA date and time the transaction was generated on the 3rd party ERP systems. Has the format of “yyyy-MM-dd'T'HH:mm:ss”2017-04-28T09:30:00
externalTerminalIdSTRING
NUMERIC
A terminal identifier for device configured on the 3rd party ERP system.98100010
latitudeSTRING
NUMERIC
A geolocation identifier indicating the latitude position of the device.-28.1619942
longitudeSTRING
NUMERIC
A geolocation identifier indicating the longitude position of the device.30.2350981
accuracySTRING
NUMERIC
A accuracy indicator of the geolocation.
additionalDataOBJECTSee Additional Parameters section for the AdditionalData Object.N/A

Additional Parameters

The following tables describes the additional parameters of the SALE request message, based on the preference of the merchant.

AdditionalData Object

PARAMETERSTYPESIZE(MAX)DESCRIPTIONEXAMPLE
merchantInfoOBJECTN/ASee parameters under MerchantInfo Object.
example included in code Sample Code SALE Request
N/A
TokenizationOBJECTN/ASee parameters under Tokenization Object.
example included in code Sample Code SALE Request
N/A
extendedTrxTypeNUMERIC STRING12The unique 4 digit number configured on Postilion switch, which 3rd party integrators can use to route transactions to a different acquirer.
Provided by Ecentric.
example included in code Sample Code SALE Request
1234
(*)
subMid
NUMERIC STRING15The unique ID for each sub merchant. Determined by the PayFac.
example included in code Sample Code SALE Request
574595612358745

MerchantInfo Object

PARAMETERSTYPESIZE(MAX)DESCRIPTIONEXAMPLE
(*) (#)
Phone_No
STRING
NUMERIC
16The unique phone number of the merchant.

As a PayFac client, the unique phone number of the sub merchant.
0123456789
(*) (#)
Street
STRING
ALPHANUMERIC WITH SPACES
255The unique street address of the merchant.

As a PayFac client, the unique street address of the sub merchant.
cnr Von Willich Ave &, Leonie St
(*) (#)
URL
STRING
ALPHANUMERIC
255The unique URL of the merchant.

As PayFac client, the unique URL of the sub merchant.
www.merchantwebsite.com
(*) (#)
Support_Phone_No
STRING
NUMERIC
16The unique support phone number of the merchant.

As PayFac client, the unique support phone number of the sub merchant.
0123456789
(*) (#)
City
STRING
ALPHANUMERIC
48The city where the merchant's store is located.

As PayFac client, the city where the sub merchant's store is located.
Johannesburg
(*) (#)
Province
STRING
ALPHANUMERIC
48The province where the merchant's store is located.

As PayFac client, the province where the sub merchant's store is located.
GP
(*)
Country_Code
STRING
NUMERIC
16As PayFac client, the country code where the sub merchant's store is located.ZA
(*)
Currency_Code
STRING
NUMERIC
3As PayFac client the currency code that the sub merchant uses to define the transaction currency.
Currency code based on the ISO 8583 standard.
710
(*)
Postal_Code
STRING
NUMERIC
16As PayFac client, the postal code where the sub merchant's store is located.0157

Tokenization Object

PARAMETERSTYPESIZE(MAX)DESCRIPTIONEXAMPLE
MerchantUserIDNUMERIC STRING16Creates the ability to tokenize a customer card, in order for a PSP to perform subsequent transaction on the terminal as another means of securing customer information during transaction processing.1

Sample Code

private void doSale() {
    Intent intent = new Intent();
   	intent.setClassName("com.ecentric.ecentricpay", "com.ecentric.ecentricpay.MainActivity");
    Bundle dataBundle = new Bundle();
    dataBundle.putString("launchType", "SALE");
  	dataBundle.putString("merchantID", "910100000000001")
    dataBundle.putString("authenticationKey", "received_authenticationKey");
    dataBundle.putLong("transactionAmount", 1000); // amount in cents
  
		JSONObject additionalData = new JSONObject();
		try {
      // Add subMid field
			additionalData.put("subMid", "574595612358745");
      
      // Add extendedTrxType
			additionalData.put("extendedTrxType", "6705");
      
			// Create a merchantInfo object
			JSONObject merchantInfo = new JSONObject();
			merchantInfo.put("Phone_No", "0114567891");
			merchantInfo.put("Street", "cnr Von Willich Ave &, Leonie St);
			merchantInfo.put("City", "Johannesburg");
			merchantInfo.put("Province", "Gauteng");
			merchantInfo.put("Country_Code", "ZA");
			merchantInfo.put("Currency_Code", "710");
			merchantInfo.put("Postal_Code", "0157");
			additionalData.put("Merchant_Info", merchantInfo);
                                          
      // Create a Tokenization object
 			JSONObject tokenization = new JSONObject();
			tokenization.put("MerchantUserID", "1");
			additionalData.put("Tokenization", tokenization);
	 
			dataBundle.putString("additionalData", additionalData.toString());
		} catch (JSONException e) {
			e.printStackTrace();
		}

    intent.putExtra("ecentricBundle", dataBundle);
    try {
        intentLauncher.launch(intent);
    } catch (Exception e) {
        Log.e(TAG, "Error launching intent: " + e);
    }

Response

Parameters

The following table describes the parameters of the SALE response message.

PARAMETERSTYPEDESCRIPTIONEXAMPLE
launchTypeSTRINGEcho of the launchType used to launch the Ecentric Payment App.SALE
resultCodeSTRINGRepresents the result status of the intent call to the Ecentric Payment App
● 00: COMPLETED
● 01: SUCCESSFUL
● 02: DECLINED
● 03: ABORTED
● 04: ERROR
00
resultDescriptionSTRINGA user readable representation of the above resultCode i.e. Approved for resultCode 01.
If the bank or switch approves or declines the transaction, the response description is included in this field.
APPROVED
merchantIDSTRINGEcho of the merchantID used in the request.910100000000001
merchantNameSTRINGThe name of the merchant that requested the transaction as stored at the bank.Merchant A
transactionAmountSTRINGApproved total transactionAmount.1000
cashAmountSTRINGApproved cashAmount.500
transactionDescriptionSTRINGEcho of the transactionDescription used to launch the Ecentric Payment App.3rd party app desc
cellNumberToSMSReceiptSTRINGMasked out value of the cell number used to send the receipt to. * * * **657
emailAddressToSendReceiptSTRINGMasked out value of the email address used to send the receipt to.* * * * *@ecentric.com
isReceiptRequiredSTRINGEcho of the isReceiptRequired used to launch the Ecentric Payment App.true
isReceiptDataAvailableSTRINGBoolean indicating whether a receiptBundle object is available. Will always be included for approved or declined transactions.true
receiptBundleSTRINGConsists of a sub-bundle of server parameters that can be used by the partner application to create a receipt.See Sample ecentricBundle SALE Response.
appVersionSTRINGThe software version currently running on the Ecentric Payment App.1.9.2
externalSTANSTRINGEcho of the systems trace number generated by some 3rd party ERP systems.123456
externalRRNSTRINGEcho of the RRN generated by some 3rd party ERP systems.ABCDEF123456
externalTransactionGUIDSTRINGEcho of the GUID that identifies a specific transaction generated by 3rd party ERP systems.2fdca02f-3cbe-4e8c-82ad-86a1a16b72e8
externalInvoiceGUIDSTRINGEcho of the GUID that identifies a particular invoice that may appear on more than one transaction.2fdca02f-3cbe-4e8c-82ad-86a1a16b72e9
externalTransactionDateTimeSTRINGEcho of the date and time the transaction was generated on the 3rd party ERP systems. Has the format of “yyyy-MM-dd'T'HH:mm:ss”2017-04-28T09:30:00
externalTerminalIdSTRINGEcho of the terminal identifier for device configured on the 3rd party ERP system.98100010
transactionUuidSTRINGEcho of the Unique ID of a transaction.bdf9d0af-17b3-48ca-8a0b-37dc52bf49bc
terminalIdSTRINGThis is an automatically system-assigned terminalID of the payment terminal’s identity number, which can be used to assist with settlement information and is returned in BASE36 format.77012398
latitudeSTRINGEcho of geolocation identifier indicating the latitude position of the device.-28.1619942
longitudeSTRINGEcho of geolocation identifier indicating the longitude position of the device.30.2350981
accuracySTRINGEcho of accuracy indicator of the geolocation.
serialNumberSTRINGThe serial number for the device that was used for the RETAIL_AUTH intent call.PC05P2CG10036

Sample Code

private final ActivityResultLauncher<Intent> intentLauncher = registerForActivityResult(
       new ActivityResultContracts.StartActivityForResult(),
       result -> {
           if (result.getResultCode() == Activity.RESULT_OK) {
               Intent data = result.getData();
               if (data != null) {
                   Bundle responseBundle = new Bundle(data.getBundleExtra("ecentricApplicationResponse"));
                   String launchType = responseBundle.getString("launchType");
                   String resultCode = responseBundle.getString("resultCode");
                 		// Determine if the transaction was successfully executed using returned resultCode
                   Boolean success = false;
                   if (resultCode != null && (resultCode.matches("00") || resultCode.matches("01"))) {
                       success = true;
                   }

                   if (responseBundle.get("errorBundle") != null) {
                       Bundle errorBundle = new Bundle(responseBundle.getBundle("errorBundle"));
                   }
               }
           } else {
               Log.e(TAG, "Received error resultCode: " + result.getResultCode());
           }
       }
);

Error Handling

Sample Bundle

"resultDescription": "ABORTED",
"errorBundle": {
    "description": "ERROR",
    "reference": "",
    "errorType": "TRANSACTION",
    "message": "Transaction cancelled by user"
  },
"buildInfo": "Ecentric_DEBUG_Ecentric_INT",
"isReceiptDataAvailable": false,
"resultCode": "03",
"merchantID": "910100000000001",
"serialNumber": "PC05P2CG10036",
"launchType": "SALE",
"cashAmount": "0",
"appVersion": "1.9.8",
"transactionAmount": "1000"