---
updatedAt: 2025-07-16T16:00:27.000Z
agentTools:
  projectIndex: https://documentation.paysimple.com/v2019/llms.txt
---

# Android Methods/Models/Delegates

# Models

### PaysimpleSDKResponse

| Property         | Type    | Description                    |
| ---------------- | ------- | ------------------------------ |
| didSucceed()     | boolean | If the command was successful. |
| getDescription() | String  | Description of response.       |

### PaysimpleSaleResponse

| Property             | Type                 | Description                                                                                                                       |
| -------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| approved\_amount     | BigDecimal           | Transaction amount.                                                                                                               |
| card\_brand          | String               | Brand of card.                                                                                                                    |
| transaction\_id      | String               | Unique Id of transaction.                                                                                                         |
| acquirer\_message    | String               | Host error message returned on failure or decline. Do not base application logic on this message as it may change without notice. |
| authorization\_code  | String               | Transaction authorization code.                                                                                                   |
| batch\_id            | String               | Settlement batch id (card only).                                                                                                  |
| paysimpleCardData    | PaysimpleCardData    | PaySimple card data.                                                                                                              |
| paysimpleEmvResponse | PaysimpleEmvResponse | Emv response.                                                                                                                     |
| paysimpleSaleOutcome | PaysimpleSaleOutcome | Outcome of sale.                                                                                                                  |

### PaysimpleCardData

| Property             | Type   | Description                   |
| -------------------- | ------ | ----------------------------- |
| card\_masked\_number | String | Masked card number.           |
| card\_logo           | String | Card logo.                    |
| expiration\_month    | String | Card expiration month.        |
| expiration\_year     | String | Card expiration year.         |
| bin                  | String | Transaction bin.              |
| card\_entry\_mode    | String | How card data was entered.    |
| card\_brand          | String | Brand of card.                |
| card\_holder\_name   | String | Name on card.                 |
| last4                | String | Last 4 digits of card number. |

### PaysimpleEmvResponse

| Property                     | Type   | Description                         |
| ---------------------------- | ------ | ----------------------------------- |
| application\_identifier      | String | Name of card service, such as AMEX. |
| application\_preferred\_name | String | Preferred name of institution.      |
| application\_label           | String | Label of institution.               |
| cryptogram                   | String | Cryptogram of transaction.          |
| host\_response\_code         | String | Response 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

| Property             | Type   | Description                                                                                                                                                                                                                                |
| -------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| result               | String | Result summary of transaction.                                                                                                                                                                                                             |
| code                 | String | 4-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\_description | String | Description 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**

| Property         | Type               | Description                      |
| ---------------- | ------------------ | -------------------------------- |
| getDeviceNames() | ArrayList\<String> | Returns a list of found devices. |

## PaysimpleSaleRequest

| Property                                | Type       | Description                                                                                      |
| --------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------ |
| amount (required)                       | BigDecimal | Total amount. Includes all additional charges.                                                   |
| setAllowDuplicates(boolean allow)       | void       | Allow duplicate transactions. Default=false.                                                     |
| setAllowPartialApprovals(boolean allow) | void       | If true, allows partial approvals. Most useful for gift cards with limited funds. Default=false. |
| external\_id                            | String     | Optional. <= 50 characters. Unique identifier for the payment in merchant or partner's system.   |
| transact\_description                   | String     | Optional. <= 5000 characters. Text field reserved for partner/merchant use.                      |
| vault\_on\_success                      | boolean    | Optional. Store card for future use.                                                             |

## Enum ErrorType

| Name              | Description                     |
| ----------------- | ------------------------------- |
| Exception         | Error of type exception.        |
| ExpressErrorEvent | Error from  Express Event Call. |
| TimeoutException  | TriPos Timeout.                 |

## Enum DeviceState

| Name           | Description                |
| -------------- | -------------------------- |
| Connected      | Device connected.          |
| Disconnected   | Device disconnected.       |
| Updating       | Device update in progress. |
| UpdateFinished | Device update finished.    |
| BatteryLow     | Device 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

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

Gets PaySimple TriPOS instance.

| Property             | Type          | Description                                                                                |
| -------------------- | ------------- | ------------------------------------------------------------------------------------------ |
| context              | Context       | Android context.                                                                           |
| paysimpleEnvironment | PsEnvironment | Required. Environment to use. Possible values: "SBX" for sandbox or "PROD" for production. |
| paysimpleEnvironment | PsDeviceType  | BBPOS device. Should not effect ability to tap, swipe or insert.                           |

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

| Property         | Type   | Description             |
| ---------------- | ------ | ----------------------- |
| clientToken      | String | PaySimple client token. |
| deviceIdentifier | String | Name of device.         |

```java
new Thread(() -> {
     PaysimpleSDKResponse res = _paysimpleBBPOS.initializeAndConnect(psToken, "CHB202044007347");
}).start();
```

## Get Available Devices

```java
AvailableDeviceResponse getAvailableDevices() throws InterruptedException;
```

Gets a list of available BBPOS devices.

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

```java
void subscribeToListener(PsListener listener);
void subscribeToDeviceInteractionListener(PsDeviceInteractionListener psDeviceInteractionListener);
```

| Property                    | Type                        | Description                                                             |
| --------------------------- | --------------------------- | ----------------------------------------------------------------------- |
| listener                    | PsListener                  | User implementation of PsListener.                                      |
| psDeviceInteractionListener | PsDeviceInteractionListener | User implementation of transaction related PsDeviceInteractionListener. |

Listeners implemented through calling class.

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

## Get Device Info

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

```java
PaysimpleSDKResponse processSale(String clientToken, PaysimpleSaleRequest saleRequest);
```

| Property    | Type                 | Description             |
| ----------- | -------------------- | ----------------------- |
| clientToken | String               | PaySimple client token. |
| saleRequest | PaysimpleSaleRequest | PaySimple sale request. |

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

```java
void deInitializeBBPOS() throws Exception;
```

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

## Hard Reset

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

```java
PaysimpleSDKResponse hardReset();
```

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

## Is Device Connected

Checks if BBPOS device is connected.

```java
boolean isDeviceConnected();
```

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

## Is SDK Initialized

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

```java
boolean isSdkInitialized();
```

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

## Cancel Current Action

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

```java
boolean cancelCurrentAction();;
```

```java
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);
}
```

| Method                                                 | Description                                                 |
| ------------------------------------------------------ | ----------------------------------------------------------- |
| 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);
    }
}
```

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