debug
This commit is contained in:
parent
0cf6daf434
commit
a8964793af
|
@ -8,6 +8,8 @@ const stripe = new Stripe(env.stripeSecretKey, {
|
||||||
});
|
});
|
||||||
|
|
||||||
const paymentRouter = express.Router();
|
const paymentRouter = express.Router();
|
||||||
|
const endpointSecret = env.stripeWebhookSecret;
|
||||||
|
console.log({ endpointSecret });
|
||||||
|
|
||||||
paymentRouter.post(
|
paymentRouter.post(
|
||||||
'/webhook',
|
'/webhook',
|
||||||
|
@ -18,12 +20,13 @@ paymentRouter.post(
|
||||||
// If you are testing with the CLI, find the secret by running 'stripe listen'
|
// If you are testing with the CLI, find the secret by running 'stripe listen'
|
||||||
// If you are using an endpoint defined with the API or dashboard, look in your webhook settings
|
// If you are using an endpoint defined with the API or dashboard, look in your webhook settings
|
||||||
// at https://dashboard.stripe.com/webhooks
|
// at https://dashboard.stripe.com/webhooks
|
||||||
const endpointSecret = env.stripeWebhookSecret;
|
|
||||||
// Only verify the event if you have an endpoint secret defined.
|
// Only verify the event if you have an endpoint secret defined.
|
||||||
// Otherwise use the basic event deserialized with JSON.parse
|
// Otherwise use the basic event deserialized with JSON.parse
|
||||||
if (endpointSecret) {
|
if (endpointSecret) {
|
||||||
// Get the signature sent by Stripe
|
// Get the signature sent by Stripe
|
||||||
const signature = request.headers['stripe-signature'] || "";
|
const signature = request.headers['stripe-signature'] || "";
|
||||||
|
console.log(request.headers);
|
||||||
|
console.log({ signature, endpointSecret });
|
||||||
try {
|
try {
|
||||||
event = stripe.webhooks.constructEvent(
|
event = stripe.webhooks.constructEvent(
|
||||||
request.body,
|
request.body,
|
||||||
|
|
Loading…
Reference in New Issue