[DEPRECATED] Performs the unreferenced return process.¶
This method must be called to perform the unreferenced return.
Methods¶
| Signature | Description |
|---|---|
void refundPayment(RefundRequest settlementRequest, PaymentCallback paymentCallback) |
Performs the unreferenced return process. (DEPRECATED: Using refundPaymentV2) |
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
request |
RefundRequest |
Yes | Data transfer object that will contain the unreferenced return request information. Note that not all parameters are required. |
callback |
PaymentCallback |
Yes | Interface that will be executed for success or error notifications of the return process. |
Parameter details request (RefundRequest) (DEPRECATED: Use RefundRequestV2)
| Name | Type | Mandatory | Description |
|---|---|---|---|
value |
BigDecimal |
No | Return value not referenced. If it is not filled in (null), or if it is filled in with 0 (zero), the Payment App must request the amount from the operator. |
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 |
No | Version of the application that is requesting payment. |
printMerchantReceipt |
Boolean |
No | Indicates whether the establishment voucher should be printed or not. The default value is false, that is, the voucher is not printed. |
printCustomerReceipt |
Boolean |
No | Indicates whether the customer receipt should be printed or not. The default value is false, that is, the voucher is not printed. |
productShortName |
String |
No | When filled in, after reading the card and identifying the branded product, if it does not match the productShortName of the product in question, the terminal should display an error on the screen and terminate the transaction. Examples: VI=VISA, MC=MASTERCARD, AX=AMEX |
appTransactionId |
String |
No | Integrated transaction identifier for the software. The Identifier referred to is the one used in the application that originated the return request. It must not be repeated. |
callback (RefundCallback)
| Name | Type | Mandatory | Description |
|---|---|---|---|
onSuccess |
Method for notification on success | ||
Refund.acquirerId |
String |
Yes | Acquirer ID. |
Refund.refundId |
String |
Yes | Return ID. |
Refund.productShortName |
String |
Yes | Corresponds to the productShortName corresponding to the transaction context's flag product. |
Refund.batchNumber |
String |
Yes | ID of the batch to which the transaction belongs. |
Refund.nsuTerminal |
String |
Yes | NSU generated by the terminal for the transaction. The rightmost 4 digits correspond to the Ticket Number. This NSU is informed by the terminal to PhAST in the “merchantTransactionId” parameter. |
Refund.acquirerResponseCode |
String |
Yes | Acquirer response code. |
Refund.acquirerResponseDate |
Date |
Yes | Date/time returned by the acquirer. |
Refund.acquirerAuthorizationNumber |
String |
Yes | Authorization number provided by the acquirer (it appears on the Cardholder's customer receipt). |
Refund.Receipt.merchantVia |
String |
No | Content of the voucher - copy of the establishment. |
Refund.Receipt.clientVia |
String |
No | Voucher content - customer's copy. |
onError |
Method for notification in case of error. | ||
ErrorData.paymentsResponseCode |
String |
Yes | Response code for the error that occurred. See Response Codes |
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 cause of the error. |
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");
RefundRequest refundRequest = new RefundRequest();
refundRequest.setApplicationInfo(appInfo);
refundRequest.setPrintMerchantReceipt(true);
try {
paymentClient.refundPayment(refundRequest, this);
} catch (ClientException e) {
Log.e(TAG, "Error starting devolution", e);
}
}
@Override
public void onError(ErrorData errorData) {
Log.e(TAG, "Error: " + errorData.getResponseMessage());
}
@Override
public void onSuccess(Refund refund) {
Log.i(TAG, "Success!");
}
}