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 | 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
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. |
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. |
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);
Property | Type | Description |
---|---|---|
listener | PsListener | User implementation of PsListener. |
psDeviceInteractionListener | PsDeviceInteractionListener | User 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);
Property | Type | Description |
---|---|---|
clientToken | String | PaySimple client token. |
saleRequest | PaysimpleSaleRequest | PaySimple 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);
}
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. |
Updated over 2 years ago