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.