question

Kavin Kannan avatar image
Kavin Kannan asked Kavin Kannan commented

Trouble with ACTION_PAY - Error message - App doesn't have required permission: ORDERS_W

I have created a project that uses the the same code "PaywithSecurePayExample" for clover-android-example repos.

Added the following to android manifest.xml

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="clover.permission.ACTION_PAY" />

However upon launching the AsyncTask that creates the order, I get the following error

com.clover.sdk.v1.ForbiddenException: status code: 403 App doesn't have required permission: ORDERS_W

// Code in Place to create a dynamic order. private class OrderAsyncTask extends AsyncTask<void, void,="" order=""> {

    @Override
    protected final Order doInBackground(Void... params) {
        Order mOrder;
        List<Item> merchantItems;
        Item mItem;
        try {
            // Create a new order
            mOrder = orderConnector.createOrder(new Order());
            // Grab the items from the merchant's inventory
            merchantItems = inventoryConnector.getItems();
            // If there are no item's in the merchant's inventory, then call a toast and return null
            if (merchantItems.isEmpty()) {
                Toast.makeText(getApplicationContext(), getString(R.string.empty_inventory), Toast.LENGTH_SHORT).show();
                finish();
                return null;
            }
            // Taking the first item from the inventory
            mItem = merchantItems.get(0);
            // Add this item to the order, must add using its PriceType
            if (mItem.getPriceType() == PriceType.FIXED) {
                orderConnector.addFixedPriceLineItem(mOrder.getId(), mItem.getId(), null, null);
            } else if (mItem.getPriceType() == PriceType.PER_UNIT) {
                orderConnector.addPerUnitLineItem(mOrder.getId(), mItem.getId(), 1, null, null);
            } else { // The item must be of a VARIABLE PriceType
                orderConnector.addVariablePriceLineItem(mOrder.getId(), mItem.getId(), 5, null, null);
            }
            // Update local representation of the order
            mOrder = orderConnector.getOrder(mOrder.getId());

            return mOrder;
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            e.printStackTrace();
        } catch (ServiceException e) {
            e.printStackTrace();
        } catch (BindingException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected final void onPostExecute(Order order) {
        // Enables the pay buttons if the order is valid
        if (!isFinishing()) {
            MainActivity.this.order = order;
            EditText orderIdText = (EditText) findViewById(R.id.order_id_edit_text);
            orderIdText.setText(order.getId());

            EditText amountText = (EditText) findViewById(R.id.amount_edit_text);
            amountText.setText(order.getTotal() + "");
        }
    }
}

I came across someone saying that the app has to be submitted on the App Store first, which I did, but on the Clover Mini Device (tied up to my Dev Merchant account), I do not see the app on the market place.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jim-patel avatar image
jim-patel answered Kavin Kannan commented

You have to upload your app to your development account and give the app a price for your region for it to show up in the development merchant's app market. Once you do, the selected permissions will activate.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kavin Kannan avatar image Kavin Kannan commented ·

@JimPatel Thanks for the answer, I was able to download the app from the market place, and was able to debug the app with no issues. You are a life saver.

0 Likes 0 ·
Mark Mullan avatar image
Mark Mullan Deactivated answered

Hi Kavin,

Following up from Jim's response, you may need to grant your app with ORDERS_W permission after giving your app a price. Please consult with https://docs.clover.com/build/permiss... and let me know if you have any follow up questions.

Thanks,

Mark

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community