Android Methods/Models/Delegates

Models

PaysimpleSDKResponse

PropertyTypeDescription
didSucceed()booleanIf the command was successful.
getDescription()StringDescription of response.

PaysimpleSaleResponse

PropertyTypeDescription
approved_amountBigDecimalTransaction amount.
card_brandStringBrand of card.
transaction_idStringUnique Id of transaction.
acquirer_messageStringHost error message returned on failure or decline. Do not base application logic on this message as it may change without notice.
authorization_codeStringTransaction authorization code.
batch_idStringSettlement batch id (card only).
paysimpleCardDataPaysimpleCardDataPaySimple card data.
paysimpleEmvResponsePaysimpleEmvResponseEmv response.
paysimpleSaleOutcomePaysimpleSaleOutcomeOutcome of sale.

PaysimpleCardData

PropertyTypeDescription
card_masked_numberStringMasked card number.
card_logoStringCard logo.
expiration_monthStringCard expiration month.
expiration_yearStringCard expiration year.
binStringTransaction bin.
card_entry_modeStringHow card data was entered.
card_brandStringBrand of card.
card_holder_nameStringName on card.
last4StringLast 4 digits of card number.

PaysimpleEmvResponse

PropertyTypeDescription
application_identifierStringName of card service, such as AMEX.
application_preferred_nameStringPreferred name of institution.
application_labelStringLabel of institution.
cryptogramStringCryptogram of transaction.
host_response_codeStringResponse code from the host.

🚧

EMV Receipt Requirements

THE FOLLOWING ARE REQUIRED FOR EMV RECEIPTS
Application Identifier (AID) of the application used.
Application Preferred Name (if available and supported) or Application Label
Cryptogram type/value
Host Response Code/Host Response Message (e.g. 00/AP, etc)
Host Response Message

PaysimpleSaleOutcome

PropertyTypeDescription
resultStringResult summary of transaction.
codeString4-digit PaySimple result code. The code will not change, so it's safe to create code logic reacting to a specific failure code. Code 1000 indicates success.
outcome_descriptionStringDescription of decline, failure or success. This is in human-readable format, so it is a good practice to display this text to the user in your interface. Don't base logic in your code on this text, as it may change from time to time.

AvailableDeviceResponse

Extends PaysimpleSDKResponse

PropertyTypeDescription
getDeviceNames()ArrayListReturns a list of found devices.

PaysimpleSaleRequest

PropertyTypeDescription
amount (required)BigDecimalTotal amount. Includes all additional charges.
setAllowDuplicates(boolean allow)voidAllow duplicate transactions. Default=false.
setAllowPartialApprovals(boolean allow)voidIf true, allows partial approvals. Most useful for gift cards with limited funds. Default=false.
external_idStringOptional. <= 50 characters. Unique identifier for the payment in merchant or partner's system.
transact_descriptionStringOptional. <= 5000 characters. Text field reserved for partner/merchant use.
vault_on_successbooleanOptional. Store card for future use.

Enum ErrorType

NameDescription
ExceptionError of type exception.
ExpressErrorEventError from Express Event Call.
TimeoutExceptionTriPos Timeout.

Enum DeviceState

NameDescription
ConnectedDevice connected.
DisconnectedDevice disconnected.
UpdatingDevice update in progress.
UpdateFinishedDevice update finished.
BatteryLowDevice battery below 50%.

Methods

🚧

Some Methods Must Be Started on a Thread

Example calls will instruct if method needs to be started on a new thread.

Get BBPOS Instance

IPaysimpleBBPOS getInstance(Context context, PsEnvironment paysimpleEnvironment,PsDeviceType psDevice);

Gets PaySimple TriPOS instance.

PropertyTypeDescription
contextContextAndroid context.
paysimpleEnvironmentPsEnvironmentRequired. Environment to use. Possible values: "SBX" for sandbox or "PROD" for production.
paysimpleEnvironmentPsDeviceTypeBBPOS device. Should not effect ability to tap, swipe or insert.
IPaysimpleBBPOS psBBPOS = PaysimpleBBPOS.getInstance(this, PsEnvironment.SBX, PsDeviceType.BbposContactless);

Initialize and Connect Device

PaysimpleSDKResponse initializeAndConnect(String clientToken, String deviceIdentifier);

Initializes client and connects to BBPOS device. Needs a PaySimple client token and the name of the BBPOS device.

PropertyTypeDescription
clientTokenStringPaySimple client token.
deviceIdentifierStringName of device.
new Thread(() -> {
     PaysimpleSDKResponse res = _paysimpleBBPOS.initializeAndConnect(psToken, "CHB202044007347");
}).start();

Get Available Devices

AvailableDeviceResponse getAvailableDevices() throws InterruptedException;

Gets a list of available BBPOS devices.

new Thread(() -> {
      AvailableDeviceResponse devices = _paysimpleBBPOS.getAvailableDevices();
}).start();

Subscribe to Listeners

❗️

Required

User must call subscribeToDeviceInteractionListener before making payments with device.

Gives user ability to subscribe to listeners.

void subscribeToListener(PsListener listener);
void subscribeToDeviceInteractionListener(PsDeviceInteractionListener psDeviceInteractionListener);
PropertyTypeDescription
listenerPsListenerUser implementation of PsListener.
psDeviceInteractionListenerPsDeviceInteractionListenerUser implementation of transaction related PsDeviceInteractionListener.

Listeners implemented through calling class.

paysimpleBBPOS.subscribeToListener(this);
paysimpleBBPOS.subscribeToDeviceInteractionListener(this);

Get Device Info

ArrayList<String> getDeviceInfo();

Gets available device information returning an array containing device serial number, description, and device configuration if initialized.

Process Sale

Process sale with client token.

📘

Total Sales Amount Requirements

The amount in PaysimpleSaleRequest saleRequest must be the total amount including tips, fees etc...

PaysimpleSDKResponse processSale(String clientToken, PaysimpleSaleRequest saleRequest);
PropertyTypeDescription
clientTokenStringPaySimple client token.
saleRequestPaysimpleSaleRequestPaySimple sale request.
new Thread(() -> {
     try {
     BigDecimal amount = BigDecimal.valueOf(Math.random() * 100).setScale(2, 
     BigDecimal.ROUND_UP);

     PaysimpleSaleRequest saleRequest = new PaysimpleSaleRequest(amount);
     saleRequest.external_id = "1234";
     saleRequest.transact_description = "TX BBPOS";
     _paysimpleBBPOS.processSale(container.token, saleRequest);
     } catch (Exception e) {
     e.printStackTrace();
}
}).start();

De-Initialize BBPOS

De-initialize Paysimple SDK and disconnect device.

void deInitializeBBPOS() throws Exception;
new Thread(() -> {
     try {
          _paysimpleBBPOS.deInitializeBBPOS();
     } catch (Exception e) {
     e.printStackTrace();
}
}).start();

Hard Reset

Clears Express credentials, clears device configuration, and de-Initializes PaySimple SDK.

PaysimpleSDKResponse hardReset();
PaysimpleSDKResponse res = _paysimpleBBPOS.hardReset();

Is Device Connected

Checks if BBPOS device is connected.

boolean isDeviceConnected();
boolean isInit = _paysimpleBBPOS.isDeviceConnected();

Is SDK Initialized

Check if PaySimple SDK has been successfully initialized with Express credentials.

boolean isSdkInitialized();
boolean isInit = _paysimpleBBPOS.isSdkInitialized();

Cancel Current Action

Currently this applies to process payment flow. Call this if payment gets interrupted. Returns true if successful.

boolean cancelCurrentAction();;
new Thread(() -> {
     try {
         boolean succeed =  _paysimpleBBPOS.cancelCurrentAction();
     } catch (Exception e) {
          e.printStackTrace();
     }
}).start();

Delegates/Listeners

PsListener

Listens for general SDK related events. Required.

public interface PsListener {
    void updateResponse(Double progress, String... response);
    void onError(PaysimpleSDKError sdkError);
    void onDeviceEvent(DeviceState deviceState, String message);
    void onPaymentResponse(PaysimpleSaleResponse response);
}
MethodDescription
updateResponse(Double progress, String... response)Updates client with progress of firmware update.
onError(PaysimpleSDKError sdkError)Notifies client of SDK error responses.
onDeviceEvent(DeviceState deviceState, String message)Notifies client of device specific events.
onPaymentResponse(PaysimpleSaleResponse response)Notifies client when a payment response has been completed.

PsDeviceInteractionListener

Listens for transaction related events.

public interface PsDeviceInteractionListener{
    void onAmountConfirmation(PsAmountConfirmationType var1, BigDecimal var2, PsConfirmAmountListener var3);
    void onPromptUserForCard(String var1);
    void onDisplayText(String var1);
    void onRemoveCard();
    void onCardRemoved();
    interface PsConfirmAmountListener {
        void psConfirmAmount(boolean var1);
    }
}
MethodDescription
onAmountConfirmation(PsAmountConfirmationType var1, BigDecimal var2, PsConfirmAmountListener var3)Notifies client of amount confirmation. Use PsConfirmAmountListener to pass in user response.
onPromptUserForCard(String var1)Notifies client to insert card.
onDisplayText(String var1)Displays general text events. Such as "processing...".
onRemoveCard()Delegate is called when user is prompted to remove card.
onCardRemoved()Delegate is called when user removes card.
psConfirmAmount()Listener to pass user confirmation of amount.