{"record":{"id":"4098da967983f084","repo":"medusajs/medusa","slug":"not-allowed-4098da","errorCode":"NOT_ALLOWED","errorMessage":"You must provide the region_id to list payment providers","messagePattern":"You must provide the region_id to list payment providers","errorType":"exception","errorClass":"MedusaError","httpStatus":403,"severity":"warning","filePath":"packages/medusa/src/api/store/payment-providers/route.ts","lineNumber":18,"sourceCode":"import {\n  AuthenticatedMedusaRequest,\n  MedusaResponse,\n} from \"@medusajs/framework/http\"\nimport {\n  ContainerRegistrationKeys,\n  MedusaError,\n  remoteQueryObjectFromString,\n} from \"@medusajs/framework/utils\"\nimport { HttpTypes } from \"@medusajs/framework/types\"\n\n// TODO: Add more fields to provider, such as default name and maybe logo.\nexport const GET = async (\n  req: AuthenticatedMedusaRequest<HttpTypes.StorePaymentProviderFilters>,\n  res: MedusaResponse<HttpTypes.StorePaymentProviderListResponse>\n) => {\n  if (!req.filterableFields.region_id) {\n    throw new MedusaError(\n      MedusaError.Types.NOT_ALLOWED,\n      \"You must provide the region_id to list payment providers\"\n    )\n  }\n\n  const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)\n  const queryObject = remoteQueryObjectFromString({\n    entryPoint: \"region_payment_provider\",\n    variables: {\n      filters: {\n        region_id: req.filterableFields.region_id,\n      },\n      ...req.queryConfig.pagination,\n    },\n    fields: req.queryConfig.fields.map((f) => `payment_provider.${f}`),\n  })\n\n  const { rows: regionPaymentProvidersRelation, metadata } = await remoteQuery(","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/medusa/src/api/store/payment-providers/route.ts#L1-L36","documentation":"Thrown by GET /store/payment-providers when the required region_id filter is missing. Payment providers are scoped per region in Medusa, so listing them requires knowing which region to query. The route validates req.filterableFields.region_id and throws NOT_ALLOWED when absent.","triggerScenarios":"Calling GET /store/payment-providers without ?region_id=... in the query string.","commonSituations":"Frontend fetches payment providers before a cart/region is selected; region_id stored in local state is null/undefined and serialized as nothing; forgetting the query param after upgrading storefront code.","solutions":["Pass region_id as a query parameter: GET /store/payment-providers?region_id=re_...","Derive the region_id from the current cart (cart.region_id) before calling the endpoint","Ensure your region bootstrap logic (e.g. region cookie resolution) has run before fetching providers"],"exampleFix":"// before\nconst providers = await sdk.store.paymentProvider.list({}) // 400-ish: region_id required\n\n// after\nconst providers = await sdk.store.paymentProvider.list({ region_id: cart.region_id })","handlingStrategy":"validation","validationCode":"if (!regionId) throw new Error('Select a region first')\nconst providers = await sdk.store.paymentProvider.list({ region_id: regionId })","typeGuard":"const hasRegionId = (cart: Cart | null): cart is Cart & { region_id: string } =>\n  !!cart?.region_id","tryCatchPattern":null,"preventionTips":["Always derive region_id from the current cart","Run region bootstrap before checkout rendering","Validate query params before store API calls"],"tags":["store-api","payment-providers","region","validation"],"backgroundTag":"missing-required-query-param","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}