[DEPRECATED] Synchronizes transactions and closes the current batch.¶
This method must be called to perform batch close and batch submission.
Methods¶
| Signature | Description |
|---|---|
void closeBatch(SettlementRequest settlementRequest, PaymentCallback paymentCallback) |
Synchronizes transactions and closes the current batch. |
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
request |
SettlementRequest |
Yes | Data transfer object that will contain the information of the batch close request. Note that not all parameters are required. |
callback |
PaymentCallback |
Yes | Interface that will be executed for success or error notifications of the batch close process. |
Detail Parameters request (SettlementRequest)
| Name | Type | Mandatory | Description |
|---|---|---|---|
ApplicationInfo.credentials |
Credentials |
Yes | Credentials of the application that is requesting the operation, as registered at PayStore. Basically, it's about the application ID and the access token. |
ApplicationInfo.softwareVersion |
String |
Yes | Version of the application that is requesting payment. |
printMerchantReceipt |
Boolean |
No | Indicates whether the establishment voucher should be printed or not. |
(DEPRECATED: Use SettlementCallbackV2)
callback (SettlementCallback)¶
| Name | Type | Mandatory | Description |
|---|---|---|---|
onSuccess |
Method for notification on success. | ||
Settlement.Receipt.merchantVia |
String |
Yes | Returns a receipt from the acquirer with the batch closing information. |
Settlement.BatchNumber |
String |
Yes | Lot number. |
acquirerResponseCode |
String |
Yes | Host response code. |
terminalId |
String |
Yes | Terminal ID |
acquirerAdditionalMessage |
String |
No | Message sent in EPS reply field 63, to be printed or displayed at the end of the transactional flow. The payments application remains responsible for displaying or verifying the content present in this field on the screen, but must also send the received amount to the integrated application so that it can apply its business rules based on the content of this field. |
onError |
Method for notification in case of failure. | ||
ErrorData.paymentsResponseCode |
String |
Yes | Response code for the error that occurred. See Response_Code |
ErrorData.acquirerResponseCode |
String |
No | Response code for the occurred error returned by the acquirer. Note that this error will only be returned if the transaction is not authorized by the acquirer. |
ErrorData.responseMessage |
String |
Yes | Descriptive message of the reason for the non-authorization. If the transaction was denied by the acquirer, it will contain the message returned by the acquirer. |
ErrorData.acquirerAdditionalMessage |
String |
No | Message sent in EPS reply field 63, to be printed or displayed at the end of the transactional flow. The payments application remains responsible for displaying or verifying the content present in this field on the screen, but must also send the received amount to the integrated application so that it can apply its business rules based on the content of this field. |
Example¶
public class MyActivity extends Activity implements PaymentClient.PaymentCallback {
private PaymentClient paymentClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payment);
paymentClient = new PaymentClientImpl();
}
@Override
protected void onResume() {
super.onResume();
paymentClient.bind(this);
}
@Override
protected void onDestroy() {
try {
paymentClient.unbind(this);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
super.onDestroy();
}
public void doExecute(){
ApplicationInfo appInfo = new ApplicationInfo();
appInfo.setCredentials(new Credentials("demo-app", "TOKEN-KEY-DEMO"));
appInfo.setSoftwareVersion("1.0.0.0");
SettlementRequest settlementRequest = new SettlementRequest();
settlementRequest.setApplicationInfo(appInfo);
settlementRequest.setPrintMerchantReceipt(true);
try {
paymentClient.closeBatch(settlementRequest, this);
} catch (ClientException e) {
Log.e(TAG, "Error while closing batch.", e);
}
}
@Override
public void onError(ErrorData errorData) {
Log.e(TAG, "Error: " + errorData.getResponseMessage());
}
@Override
public void onSuccess(Settlement settlement) {
Log.i(TAG, "Success!");
}
}