public function actionFetchPlans()
    {
        try {
            $this->requirePostRequest();
            $this->requireAcceptsJson();

            $request = Craft::$app->getRequest();
            $gatewayId = $request->getRequiredBodyParam('gatewayId');
            $gateway = Commerce::getInstance()->getGateways()->getGatewayById($gatewayId);

            if (!$gateway || !$gateway instanceof Gateway) {
                throw new BadRequestHttpException('That is not a valid gateway id.');
            }

            return $this->asJson($gateway->getSubscriptionPlans());
        } catch (\Throwable $e) {
            return $this->asErrorJson($e->getMessage());
        }
    }