How to get permission to call APP::CART::FETCH in POS terminal?

Hi!

I am trying to port one of the shopify app from legacy “POS App SDK” to “App Bridge”. After porting I am facing the permissions problem while dispatching to fetch cart.

{"action":{"group":"Cart","type":"APP::CART::FETCH","payload":{"id":"beb78a96-a927-0f25-3bb2-476dca003b18"},"version":"2.0.11","clientInterface":{"name":"@shopify/app-bridge","version":"2.0.11"}},"message":"Action is not permitted","type":"APP::ERROR::PERMISSION","id":"beb78a96-a927-0f25-3bb2-476dca003b18"}

When I call app.featuresAvailable() then I get the list where I have Cart group, but every possible action in this group has “false” on dispatch and subscribe.

Then did app.getState and got the following:

{
	"features": {
		"Menu": {
			"NAVIGATION_MENU::UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"NAVIGATION_MENU::LINK::UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"CHANNEL_MENU::UPDATE": {
				"Dispatch": false,
				"Subscribe": false
			},
			"CHANNEL_MENU::LINK::UPDATE": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"Loading": {
			"START": {
				"Dispatch": true,
				"Subscribe": true
			},
			"STOP": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"Navigation": {
			"HISTORY::PUSH": {
				"Dispatch": true,
				"Subscribe": true
			},
			"HISTORY::REPLACE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"REDIRECT::ADMIN::SECTION": {
				"Dispatch": true,
				"Subscribe": true
			},
			"REDIRECT::ADMIN::PATH": {
				"Dispatch": true,
				"Subscribe": true
			},
			"REDIRECT::REMOTE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"REDIRECT::APP": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"Modal": {
			"OPEN": {
				"Dispatch": true,
				"Subscribe": true
			},
			"CLOSE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"CONTENT::UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"FOOTER::BUTTON::CLICK": {
				"Dispatch": true,
				"Subscribe": true
			},
			"FOOTER::BUTTON::UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"UPDATE_SIZE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"DATA": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"Toast": {
			"SHOW": {
				"Dispatch": true,
				"Subscribe": true
			},
			"CLEAR": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"ContextualSaveBar": {
			"DISCARD": {
				"Dispatch": true,
				"Subscribe": true
			},
			"SAVE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"SHOW": {
				"Dispatch": true,
				"Subscribe": true
			},
			"HIDE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"Resource_Picker": {
			"OPEN": {
				"Dispatch": true,
				"Subscribe": true
			},
			"SELECT": {
				"Dispatch": true,
				"Subscribe": true
			},
			"CLOSE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"CANCEL": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"Print": {
			"APP": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"TitleBar": {
			"UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"BUTTONS::BUTTON::CLICK": {
				"Dispatch": true,
				"Subscribe": true
			},
			"BUTTONS::BUTTON::UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"BUTTONS::BUTTONGROUP::UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"BREADCRUMBS::BUTTON::CLICK": {
				"Dispatch": true,
				"Subscribe": true
			},
			"BREADCRUMBS::BUTTON::UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"SessionToken": {
			"REQUEST": {
				"Dispatch": true,
				"Subscribe": true
			},
			"RESPOND": {
				"Dispatch": false,
				"Subscribe": true
			}
		},
		"Client": {
			"INITIALIZE": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"AuthCode": {
			"REQUEST": {
				"Dispatch": false,
				"Subscribe": false
			},
			"RESPOND": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"Button": {
			"CLICK": {
				"Dispatch": true,
				"Subscribe": true
			},
			"UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"ButtonGroup": {
			"UPDATE": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"Cart": {
			"FETCH": {
				"Dispatch": false,
				"Subscribe": false
			},
			"UPDATE": {
				"Dispatch": false,
				"Subscribe": false
			},
			"SET_CUSTOMER": {
				"Dispatch": false,
				"Subscribe": false
			},
			"REMOVE_CUSTOMER": {
				"Dispatch": false,
				"Subscribe": false
			},
			"ADD_CUSTOMER_ADDRESS": {
				"Dispatch": false,
				"Subscribe": false
			},
			"UPDATE_CUSTOMER_ADDRESS": {
				"Dispatch": false,
				"Subscribe": false
			},
			"SET_DISCOUNT": {
				"Dispatch": false,
				"Subscribe": false
			},
			"REMOVE_DISCOUNT": {
				"Dispatch": false,
				"Subscribe": false
			},
			"SET_PROPERTIES": {
				"Dispatch": false,
				"Subscribe": false
			},
			"REMOVE_PROPERTIES": {
				"Dispatch": false,
				"Subscribe": false
			},
			"CLEAR": {
				"Dispatch": false,
				"Subscribe": false
			},
			"ADD_LINE_ITEM": {
				"Dispatch": false,
				"Subscribe": false
			},
			"UPDATE_LINE_ITEM": {
				"Dispatch": false,
				"Subscribe": false
			},
			"REMOVE_LINE_ITEM": {
				"Dispatch": false,
				"Subscribe": false
			},
			"SET_LINE_ITEM_DISCOUNT": {
				"Dispatch": false,
				"Subscribe": false
			},
			"REMOVE_LINE_ITEM_DISCOUNT": {
				"Dispatch": false,
				"Subscribe": false
			},
			"SET_LINE_ITEM_PROPERTIES": {
				"Dispatch": false,
				"Subscribe": false
			},
			"REMOVE_LINE_ITEM_PROPERTIES": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"Error": {
			"INVALID_ACTION": {
				"Dispatch": true,
				"Subscribe": true
			},
			"INVALID_ACTION_TYPE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"INVALID_PAYLOAD": {
				"Dispatch": true,
				"Subscribe": true
			},
			"INVALID_OPTIONS": {
				"Dispatch": true,
				"Subscribe": true
			},
			"UNEXPECTED_ACTION": {
				"Dispatch": true,
				"Subscribe": true
			},
			"PERSISTENCE": {
				"Dispatch": true,
				"Subscribe": true
			},
			"UNSUPPORTED_OPERATION": {
				"Dispatch": true,
				"Subscribe": true
			},
			"NETWORK": {
				"Dispatch": true,
				"Subscribe": true
			},
			"PERMISSION": {
				"Dispatch": true,
				"Subscribe": true
			},
			"FAILED_AUTHENTICATION": {
				"Dispatch": true,
				"Subscribe": true
			},
			"INVALID_ORIGIN": {
				"Dispatch": true,
				"Subscribe": true
			}
		},
		"Features": {
			"UPDATE": {
				"Dispatch": false,
				"Subscribe": true
			},
			"REQUEST": {
				"Dispatch": true,
				"Subscribe": false
			},
			"REQUEST::UPDATE": {
				"Dispatch": false,
				"Subscribe": true
			}
		},
		"FeedbackModal": {
			"OPEN": {
				"Dispatch": false,
				"Subscribe": false
			},
			"CLOSE": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"Fullscreen": {
			"ENTER": {
				"Dispatch": false,
				"Subscribe": false
			},
			"EXIT": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"LeaveConfirmation": {
			"ENABLE": {
				"Dispatch": false,
				"Subscribe": false
			},
			"DISABLE": {
				"Dispatch": false,
				"Subscribe": false
			},
			"CONFIRM": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"Link": {
			"UPDATE": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"Performance": {
			"SKELETON_PAGE_LOAD": {
				"Dispatch": false,
				"Subscribe": false
			},
			"FULL_PAGE_LOAD": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"Pos": {
			"CLOSE": {
				"Dispatch": false,
				"Subscribe": false
			},
			"LOCATION::UPDATE": {
				"Dispatch": false,
				"Subscribe": false
			},
			"USER::UPDATE": {
				"Dispatch": false,
				"Subscribe": false
			},
			"DEVICE::UPDATE": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"Scanner": {
			"OPEN::CAMERA": {
				"Dispatch": false,
				"Subscribe": false
			},
			"CAPTURE": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"Share": {
			"SHOW": {
				"Dispatch": false,
				"Subscribe": false
			},
			"CLOSE": {
				"Dispatch": false,
				"Subscribe": false
			}
		},
		"MarketingExternalActivityTopBar": {
			"UPDATE": {
				"Dispatch": false,
				"Subscribe": false
			},
			"BUTTONS::BUTTON::CLICK": {
				"Dispatch": false,
				"Subscribe": false
			},
			"BUTTONS::BUTTON::UPDATE": {
				"Dispatch": false,
				"Subscribe": false
			}
		}
	},
	"fullscreen": false,
	"pos": {},
	"staffMember": {
		"accountAccess": "Account owner",
		"locale": "en"
	},
	"titleBar": {
		"appInfo": {
			"appId": "gid://shopify/App/6249657",
			"developerName": "Some",
			"icon": "https://cdn.shopify.com/shopifycloud/shopify/assets/default-app-74bfb89634baf86f3402062ef55df218fe55b4f2775ff605d0ccfe1a20f9c0d3.png",
			"name": "name"
		}
	},
	"menu": {},
	"navigation": {},
	"isLegacy": false,
	"loading": {
		"isLoading": false,
		"loadingCounter": 0
	},
	"modal": {
		"open": false
	},
	"toast": {},
	"contextualSaveBar": null,
	"resourcePicker": null,
	"scanner": {},
	"share": {},
	"print": {},
	"cart": {},
	"sessionToken": {},
	"client": {},
	"context": "Main"
}

Seems no any permissions on POS as well! How it even could be?

On the backend side I checked that app has following access scopes: write_themes,write_products,write_orders,write_script_tags,read_themes,read_products,read_orders,read_script_tags.

I even tried to request such permission for action Cart.Action.FETCH by calling

features.subscribe(Features.Action.REQUEST_UPDATE, function (payload) {
            alert("features.subscribe(Features.Action.REQUEST_UPDATE done");
            if (payload.feature[Cart.Action.FETCH]) {
              var Dispatch = payload.feature[Cart.Action.FETCH].Dispatch;
              alert("Cart Fetch has been ".concat(Dispatch ? "enabled" : "disabled"));
              if (Dispatch)
              {
                  var unsubscribe = cart.subscribe(Cart.Action.UPDATE, function(payload) {
                    console.log(payload);
                  });
                  cart.dispatch(Cart.Action.FETCH);
              }
            }
          });
          alert("Do features.dispatch(Features.Action.REQUEST");
features.dispatch(Features.Action.REQUEST, {
  feature: Group.Cart,
  action: Cart.Action.FETCH
});

But then I see that alert(“features.subscribe(Features.Action.REQUEST_UPDATE done”); is never called so that means no reaction on my request.

I am stuck on trying to do such a simple thing like fetching Cart. Which permissions do I need and how to get them? Could somebody help me to understand and fix this issue.

I was struggling with this as well. The piece I was missing was requesting the Group.Cart feature as you did above–thanks for that!

Do you have the read_orders and write_orders scopes setup for your app? If you used the shopify cli you should be able to add those to your .env file.