Performs the void/refund process referenced without paymentId.¶
This method must be called to perform the void/refund referenced without paymentId.
From version 3.1.5.0
When a transaction is made, it could previously be confirmed by printing it (or via printReceipt), or by making a new transaction. Now, the reversal can also be confirmed by using the new autoConfirm parameter - indicating whether or not to confirm regardless of printing - or by using the new confirmReversePayment() method.
Methods¶
| Signature | Description |
|---|---|
void reversePaymentWithFilter(ReversePaymentFilterRequest settlementRequest, PaymentCallback paymentCallback) |
Performs the cancellation/return process referenced without paymentId. |
void confirmReversePayment(String paymentId, PaymentCallback paymentCallback) |
Confirms a previously made payment reverse authorization. |
void cancelReversePayment(String paymentId, PaymentCallback paymentCallback) |
Undo a chargeback request. |
reversePaymentWithFilter()¶
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
request |
ReversePaymentFilterRequest |
Yes | Objeto de transferência de dados que conterá as informações da requisição da anulação/devolução referenciada sem paymentId. Note que nem todos os parâmetros são obrigatórios. |
callback |
PaymentCallback |
Yes | Interface que será executada para notificações de sucesso ou erro do processo de anulação/devolução. |
Parameter details request (ReversePaymentFilterRequest)
| Name | Type | Mandatory | Description |
|---|---|---|---|
value |
BigDecimal |
No | Transaction amount to be returned. 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 |
Yes | 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. |
operationMethod |
Integer |
No | Indicates the transaction method (QR or Card) used for the original payment. Allow the following values: 0 - Only with physical card (read or typed); 1 - Only with QRCode; If not reported, capture modes available in the terminal. |
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 |
ticketNumber |
String |
No | Indicates the coupon number, after the payment transaction carried out with a physical card. |
cv |
String |
No | Indicates the CV number (acquirerNsu), after the payment transaction made with a physical card. |
originalQRId |
String |
No | QrCode identifier generated by the capture terminal. When the payment transaction is carried out via QR Code |
Payment.paymentDate |
Date |
No | Indicates the payment date/time for the Payments App. When the payment transaction is not known by the capture terminal, that is, it was made in another terminal. |
previewMerchantReceipt |
Boolean |
No | Indicates whether the merchant voucher preview screen should be displayed after confirming the transaction. The default value is true, which means the voucher will be displayed. |
previewCustomerReceipt |
Boolean |
No | Indicates whether the customer voucher preview screen should be displayed after confirming the transaction. The default value is true, which means the voucher will be displayed. |
autoConfirm (v3.1.5.0) |
Boolean |
No | Indicates whether the transaction should be confirmed automatically. Possible values: 1. null (default) : confirms automatically if the receipt is printed.2. true : confirms automatically regardless of the printing rule.3. false : does not confirm automatically, pending confirmation. |
merchantGroupCode |
String |
If allowMultimerchant= true, groupCode is required |
Merchant group code. |
callback
| Name | Type | Mandatory | Description |
|---|---|---|---|
onSuccess |
Method for notification on success | ||
ReversePayment.paymentId |
String |
Yes | Rollback transaction ID. |
ReversePayment.acquirerId |
String |
Yes | Acquirer ID. |
ReversePayment.cancelable |
Boolean |
Yes | Returns whether the transaction can be rolled back (true) or not (false). |
ReversePayment.acquirerResponseCode |
String |
Yes | Purchaser response code. |
ReversePayment.acquirerResponseDate |
String |
Yes | Date/time returned by the acquirer. |
ReversePayment.acquirerAuthorizationNumber |
String |
Yes | Authorization number provided by the acquirer (it appears on the cardholder's receipt). |
acquirerAdditionalMessage |
String |
No | Additional message sent by the acquirer in the transaction response. |
ReversePayment.Receipt.clientVia |
String |
No | Voucher content - customer's copy. |
ReversePayment.Receipt.merchantVia |
String |
No | Content of the voucher - copy of the establishment. |
batchNumber |
String |
Yes | Lot number. |
nsuTerminal |
String |
Yes | NSU generated by the terminal for the transaction. The rightmost 4 digits correspond to the Ticket Number. |
cardholderName |
String |
Yes | Customer name on card. |
cardBin |
String |
Yes | First 6 digits of the card. |
panLast4Digits |
String |
Yes | Last 4 digits of the card. |
terminalId |
String |
Yes | Terminal identifier. |
qrId |
String |
No | QrCode identifier generated by the capture terminal. |
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. |
acquirerAdditionalMessage |
String |
No | Additional message sent by the acquirer in the transaction response. |
### confirmReversePayment() |
This method must be called to confirm a reversal that the terminal has managed to fully process the authorization leg sent by the Authorizer.
This method should not be called for a chargeback that has already been confirmed, i.e. where the confirmReversePayment() method has already been executed.
This method should not be called for a reversal that has already been undone, i.e. where the cancelReversePayment() method has already been executed.
This no method must be called for a reversal that has been denied by the Authorizer, i.e. the transaction must have been authorized by the Authorizer.
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
paymentId |
String |
Yes | Identifier of the transaction to be confirmed. The Identifier referred to is the one used in the payment application. |
callback |
PaymentCallback |
Yes | Interface that will be executed for success or error notifications. |
Parameter details
callback
| Name | Type | Mandatory | Description |
|---|---|---|---|
onSuccess |
Method for notification on success | ||
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 reason for the non-authorization. If the transaction was denied by the acquirer, it will contain the message returned by the acquirer. |
cancelReversePayment()¶
This method must be called to undo a previously authorized chargeback transaction. This transaction must not have been rolled back yet and must have been authorized (not denied) previously.
As stated in the description of reversePayment(), it is possible that there is no undo for the chargeback transaction for a given acquirer. Thus, the cancelReversePayment() method may return a specific error stating that it is not possible to perform such an operation (see Response Codes).
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
paymentId |
String |
Yes | Identifier of the transaction to be rolled back. The Identifier referred to is the one used in the payment application. |
callback |
PaymentCallback |
Yes | Interface that will be executed for success or error notifications. |
Parameter details
callback
| Name | Type | Mandatory | Description |
|---|---|---|---|
onSuccess |
Method for notification on success | ||
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 reason for the non-authorization. If the transaction was denied by the acquirer, it will contain the message returned by the acquirer. |
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");
ReversePaymentFilterRequest request = new ReversePaymentFilterRequest();
request.setApplicationInfo(appInfo);
request.setPrintMerchantReceipt(true);
try {
paymentClient.reversePaymentWithFilter(request, 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!");
}
}