Skip to content

Commit

Permalink
webhook works (problem type for event.data.object)
Browse files Browse the repository at this point in the history
  • Loading branch information
tima101 committed Mar 25, 2019
1 parent e0b6973 commit 683a9f3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions api/server/stripe.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as bodyParser from 'body-parser';
import * as stripe from 'stripe';
import logger from './logs';
// import Team from './models/Team';
import Team from './models/Team';

const dev = process.env.NODE_ENV !== 'production';

Expand Down Expand Up @@ -75,13 +75,14 @@ function stripeWebHooks({ server }) {
async (req, res, next) => {
try {
const event = await verifyWebHook(req);
logger.info(JSON.stringify(event.data.object));
// logger.info(JSON.stringify(event.data.object));
// @ts-ignore
// some problem with @types/stripe ?
const { subscription} = event.data.object;
logger.info(JSON.stringify(subscription));
// await Team.cancelSubscriptionAfterFailedPayment({
// subscriptionId: JSON.stringify(subscription),
// });
// logger.info(JSON.stringify(subscription));
await Team.cancelSubscriptionAfterFailedPayment({
subscriptionId: JSON.stringify(subscription),
});

res.sendStatus(200);
} catch (err) {
Expand Down

0 comments on commit 683a9f3

Please sign in to comment.