# Connect Mobile Applications to Application Server
source: https://developer.mastercard.com/mastercard-merchant-presented-qr/documentation/server-apis/reference-app/connect-mobile-app/index.md

Now that you know how an MPQR application can successfully scan and parse MPQR-compliant QR code, and you understand how to build a middleware server that can succesfully make MPQR API calls, you can now make payments directly from the mobile application. The mobile application, after parsing the QR code, sends payment data to the Spring IO middleware server generated using Open API client generator, which makes API calls to the MPQR API.
Diagram mpqr-sequence-flow

### Initiating a Push Payment Transaction from Mobile Application {#initiating-a-push-payment-transaction-from-mobile-application}

The sample mobile application not only utilizes MPQR Device SDKs to scan and parse MPQR-compliant QR codes, it can also send the payment request to the middleware server. The sample mobile application is only integrated to one of the many end points configured and exposed by the middleware server. Since the sample mobile application is not a complete wallet application and does not have the ability to display transaction history, the only end point that is integrated is the "/merchantPaymentTransfer" endpoint. Here is the code located in "app/src/main/java/com/mastercard/labs/sng/qrscantester/results/ScanActivity.java".
* Java

```java
public void requestPayment(View v) {

        if (paymentRequest != null) {
            paymentRequest.cancel();
        }

        showProcessingPaymentLoading();

        final String receiverIdentifier = paymentData.getMerchant().getIdentifierMastercard04();
        final PaymentRequest requestData = new PaymentRequest("ptnr_BEeCrYJHh2BXTXPy_PEtp-8DBOo", receiverIdentifier, paymentData);

        paymentRequest = ApiClient.getInterface().makePayment(requestData);
        paymentRequest.enqueue(new Callback<PaymentResponse>() {
            @Override
            public void onResponse(Call<PaymentResponse> call, Response<PaymentResponse> response) {
                hideProcessingPaymentLoading();
                paymentRequest = null;

                if (!response.isSuccessful()) {
                    DialogUtils.showDialog(ScanActivity.this, R.string.error, R.string.payment_failed);
                    return;
                }

                PaymentResponse paymentResponse = response.body();
                if (paymentResponse != null) {
                    DialogUtils.showDialog(ScanActivity.this, R.string.error, R.string.receipt_success_payment);
                }
            }
```

### Make a Test Call with Your Device and Retrieve the Transactions {#make-a-test-call-with-your-device-and-retrieve-the-transactions}

Now that your application server and mobile application is running, you can make test calls from your mobile application. Testing ensures that the mobile application can successfully make calls to the middleware Spring IO server, and the Spring IO server will then make the MPQR API call.

In order to do so, ensure that your application emulator is connected to the local server in your machine. Our sample application is already connected to the base url http://10.0.2.2:8080/ (as defined in "/app/src/main/java/com/mastercard/labs/sng/qrscantester/api/ApiClient.java"). This is an IP address that allows your emulator to communicate with your local server. If you are using a non-default emulator or if you have connected your device via USB, you may need to change the IP address.

To now perform a test payment from the sample mobile application:

1. Ensure that your sample mobile application is installed on your emulator and you have imported MPQR-compliant QR code on the same emulator (review step 5 on [this page](https://developer.mastercard.com/mastercard-merchant-presented-qr/documentation/server-apis/reference-app/payment-application-setup/index.md) if you haven't yet).
2. Open the sample application and upload the MPQR-compliant QR code by clicking on the "Upload" icon. You should now see the parsed data from the QR code. Click on the "Pay" button to make a call to the middleware server, which then makes a call to the MPQR API (Merchant Transfer - Payment).

If payment is successful, you should get a message 'Payment is successful' in your mobile application.

Now that you understand how to build a sample MPQR mobile application and a middleware wallet server which makes calls to the MPQR API, you can use this knowledge to build your very own wallet application and wallet server that integrates our MPQR Device SDKs and MPQR API.
