Ir para o conteúdo

Send payments to Paystore.


This method must be called to send payments from the terminal to Paystore. Sends transaction data to the Paystore API as well as additional information. This mechanism is automatically executed by the terminal, every 2 minutes. However, calling this method performs immediate sending.

Methods

Signature Description
void startPushPayments(PaymentCallback paymentCallback) Sends payments to Paystore.

Parameters

Name Type Mandatory Description
callback PaymentCallback Yes Interface that will be executed for success or error notifications.

Detail Parameters

callback

Name Type Mandatory Description
onSuccess ethod 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.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");

        try {
            paymentClient.startPushPayments(this);
        } catch (ClientException e) {
            Log.e(TAG, "Error while sending payments to Paystore.", e);
        }
    }

    @Override
    public void onError(ErrorData errorData) {
        Log.e(TAG, "Error: " + errorData.getResponseMessage());
    }

    @Override
    public void onSuccess(Object data) {
        Log.i(TAG, "Success!");
    }
}