shellphone.app/app/api/debug/cancel-subscription.ts

19 lines
632 B
TypeScript
Raw Normal View History

import type { BlitzApiHandler } from "blitz";
2021-10-01 22:19:06 +00:00
import { cancelPaddleSubscription } from "integrations/paddle";
import appLogger from "integrations/logger";
const logger = appLogger.child({ route: "/api/debug/cancel-subscription" });
const cancelSubscriptionHandler: BlitzApiHandler = async (req, res) => {
const { subscriptionId } = req.body;
logger.debug(`cancelling subscription for subscriptionId="${subscriptionId}"`);
await cancelPaddleSubscription({ subscriptionId });
logger.debug(`cancelled subscription for subscriptionId="${subscriptionId}"`);
res.status(200).end();
};
export default cancelSubscriptionHandler;