From 5c2c8b6b555fd843f7bc901bab9f3a2c2e210746 Mon Sep 17 00:00:00 2001 From: SEMICS <47321195+semics-tech@users.noreply.github.com> Date: Tue, 7 Feb 2023 00:11:51 +0000 Subject: [PATCH] optional null value for callbackUrl sendDataToCallbackUrl fails when stripeSettings.callbackUrl is null. It is not required in the admin panel, so should take this into account. --- server/services/stripeService.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/services/stripeService.js b/server/services/stripeService.js index 4420f7a..7efdc25 100644 --- a/server/services/stripeService.js +++ b/server/services/stripeService.js @@ -191,6 +191,10 @@ module.exports = ({ strapi }) => ({ async sendDataToCallbackUrl(session) { try { const stripeSettings = await this.initialize(); + + // Return if no callbackUrl is set + if (!stripeSettings.callbackUrl) return; + await axiosInstance.post(stripeSettings.callbackUrl, session); } catch (error) { throw new ApplicationError(error.message);