#Filip-tls

1 messages · Page 1 of 1 (latest)

storm ocean
#

Hello! What the issue you're seeing?

ruby sapphire
#

I'm trying to run through a checkout

#

all the fund arrive to me

#

but on the checkout.session.completed event

#

I trigger sending an email

#

and it just never works

#

All of this worked perfectly on localhost, but as soon as I moved it onto my VPS it's not working for webhooks

storm ocean
#

Do you have an event ID I can take a look at?

ruby sapphire
#

evt_3JeJmmCjwjFZFzX60JTiX5ab

#

Thanks for the help, I really appreciate it

#

This has been not giving me any peace of mind lol

storm ocean
#

I'm still looking! Thanks for being patient

ruby sapphire
#

Thank You!

storm ocean
#

So I can see on our end we're getting an error message of "SSL_connect returned=1 errno=0 state=error: wrong version number"

ruby sapphire
#

What does that mean? A wrong TLS version?

storm ocean
#

It means that we can't find an SSL version that works for us - can you disable sslv3 on your server and see what happens?

ruby sapphire
#

I’ve renifer TLSv3 on my nginx

#

Removed

storm ocean
#

Have you also talked to your hosting provider about this?

ruby sapphire
#

Nope - what would i need to mention to them specifically?

#

For them to downgrade TLS support to 1.2?

#

Im guessing You dont support 1.3 right?

storm ocean
#

I would give them that exact error message "SSL_connect returned=1 errno=0 state=error: wrong version number" and tell than that we require 1.2 for our webhook

ruby sapphire
#

Which makes me think how, all the transaction requests come through, I get the payment, so it’s the events that does not get picked up

storm ocean
#

I wonder if it's something specific to the port - when I try and go to your site with the port you have in your webhook endpoint I get an ERR_UNSAFE_PORT error

ruby sapphire
#

I thought it might have been the port too!

#

Hmmm… what port would you suggest I use?

#

Omg… if this is it… what are the chances!

storm ocean
#

Ohhh I didn't actually know that!

#

Do you have a specific reason for specifying a port? Have you just tried the webhook endpoint w/o the port?

ruby sapphire
#

My express runs on that port! But I just randomly picked 6000

#

When I change the ports, can I just retrigger the web hook from the stripe dashboard?

#

Or do I have to simulate the whole transaction again?

storm ocean
#

You'd have to simulate the transaction again since you'll have to create a new webhook endpoint (the url will be different)

ruby sapphire
#

Okay I see! Is there a way I can test this while it’s live without putting my card through?

storm ocean
#

I'd definitely recommend adding this webhook to your test environment to make sure it works end to end, but if you do want to try it in live mode you could try confirming with events like customer.created which don't create any payment

ruby sapphire
#

Okay cool! I’ll go ahead and try the changes and keep you posted ! As per handling events, what is recommended to handle events

storm ocean
#

Are you looking for a specific recommendation for a certain situation? Or just general guidance on how to handle webhook events? I assume you already wrote your code to handle events if you're already live?

ruby sapphire
#

just general, yeah I have some events "handled" but some I leave blank when I dont need to trigger an action based on them. Is that ok?

storm ocean
#

What do you mean by you leave them blank? Do you have certain events enabled for your webhook endpoint that you're not responding with a 2XX for?

ruby sapphire
#

I have just changed the PORT, and still same thing but for a different event

#

now its for the checkout.session.completed

#

evt_1JeQ7MCjwjFZFzX6ynPgZ9Wn

ruby sapphire
#

app.post('/api/payment_success', (req, res) => {

let event;

try {
event = stripe.webhooks.constructEvent(req.rawBody, req.headers['stripe-signature'], endpointSecret);
} catch (err) {
res.status(400).send("Webhook Error: ${err.message}"`);
}

switch (event.type) {
case 'payment_intent.succeeded':
break;
case 'checkout.session.completed':
const session = event.data.object;
if (session.payment_status === 'paid') {
handlePaymentIntentSucceeded(session);
} else {
console.log("Opps, the session has not been complete.");
}
default:
console.log("Unhandled event type ${event.type}");
}

res.json({returned: true});

});

#

This is what I have

storm ocean
#

There's still something wrong with your SSL for that port as well - if I go to https://shop.developerfilip.com:5000/ I see a ERR_SSL_PROTOCOL_ERROR. I really would suggest having your hosting provider take a look! They should know exactly how to fix it

ruby sapphire
#

I have my webhook only set for :

checkout.session.completed
payment_intent.succeeded

#

Okay will speak to them!

storm ocean
#

And I believe res.json({returned: true}); sends a 200 response code by default so you're good to go there!

ruby sapphire
#

Would that be considered a different domain?

#

I got this on SSL checker

storm ocean
#

Ah, if it's saying that no SSL certificates can be found at that port then yes, you need to add them - I'm not the best with these hosting questions, but I assume that this is something you can configure with them

ruby sapphire
#

Awesome thanks anyway!

#

You have been great help! Appreciate your time