# Models

### PaysimpleSDKResponse

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

### PaysimpleSaleResponse

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

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

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

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 **

getDeviceNames()ArrayList<String>Returns a list of found devices.

## PaysimpleSaleRequest

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

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

## Enum DeviceState

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

Gets PaySimple TriPOS instance.

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.

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

clientTokenStringPaySimple client token.
deviceIdentifierStringName of device.

## Get Available Devices

Gets a list of available BBPOS devices.

## Subscribe to Listeners


User must call subscribeToDeviceInteractionListener before making payments with device.

Gives user ability to subscribe to listeners.

listenerPsListenerUser implementation of PsListener.
psDeviceInteractionListenerPsDeviceInteractionListenerUser implementation of transaction related PsDeviceInteractionListener.

Listeners implemented through calling class.

## Get Device Info

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

clientTokenStringPaySimple client token.
saleRequestPaysimpleSaleRequestPaySimple sale request.

## De-Initialize BBPOS

De-initialize Paysimple SDK and disconnect device.

## Hard Reset

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

## Is Device Connected

Checks if BBPOS device is connected.

## Is SDK Initialized

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

## Cancel Current Action

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

# Delegates/Listeners

## PsListener

Listens for general SDK related events. Required.

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.

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.