Paid apps to use new env variable

This commit is contained in:
Hariom 2023-11-24 18:30:25 +05:30
parent 5dc3065a47
commit 6e253f280a
3 changed files with 8 additions and 5 deletions

View File

@ -76,6 +76,8 @@ STRIPE_CLIENT_ID= # ca_...
PAYMENT_FEE_FIXED=10 # Take 10 additional cents commission
PAYMENT_FEE_PERCENTAGE=0.005 # Take 0.5% commission
# Used to allow apps to be paid for via Stripe
STRIPE_WEBHOOK_SECRET_FOR_APPS=
# - TANDEM
# Used for the Tandem integration -- contact support@tandem.chat for API access.
TANDEM_CLIENT_ID=""
@ -126,4 +128,4 @@ ZOHOCRM_CLIENT_ID=""
ZOHOCRM_CLIENT_SECRET=""
# *********************************************************************************************************
# *********************************************************************************************************

View File

@ -83,13 +83,13 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
throw new HttpCode({ statusCode: 400, message: "Missing stripe-signature" });
}
if (!process.env.STRIPE_WEBHOOK_SECRET) {
throw new HttpCode({ statusCode: 500, message: "Missing process.env.STRIPE_WEBHOOK_SECRET" });
if (!process.env.STRIPE_WEBHOOK_SECRET_FOR_APPS) {
throw new HttpCode({ statusCode: 500, message: "Missing process.env.STRIPE_WEBHOOK_SECRET_FOR_APPS" });
}
const requestBuffer = await buffer(req);
const payload = requestBuffer.toString();
const event = stripe.webhooks.constructEvent(payload, sig, process.env.STRIPE_WEBHOOK_SECRET);
const event = stripe.webhooks.constructEvent(payload, sig, process.env.STRIPE_WEBHOOK_SECRET_FOR_APPS);
const handler = webhookHandlers[event.type];
if (handler) {

View File

@ -334,6 +334,7 @@
"ZOHOCRM_CLIENT_ID",
"ZOHOCRM_CLIENT_SECRET",
"ZOOM_CLIENT_ID",
"ZOOM_CLIENT_SECRET"
"ZOOM_CLIENT_SECRET",
"STRIPE_WEBHOOK_SECRET_FOR_APPS"
]
}