#crazylit.dev
1 messages · Page 1 of 1 (latest)
hello @grim meteor! could you explain more on what you mean by the checkout will be successful but won't call the webhook? I don't really understand this portion
Wait up
@twin lantern is my backend dev
He'll explain the problem
@elder lantern
We are using stripe webhook for triggering events in our backend I believe
So the checkout is successful
But then stripe won't trigger the event
It will if it's on test mode
But not on live mode
@twin lantern right?
Yes, we are using stripe CLI on the server to trigger the events and complete the purchase after successfull checkout
can you share your account id? it'd look like acct_123
Wait up
looking at your account, you've setup several webhook endpoints
which one are you having trouble with specifically?
and what is the specific event that you're listening for but is not triggering in live mode?
@twin lantern
I'm using this endpint :
app.post(
"/api/webhook",
bodyParser.raw({ type: "application/json" }),
async (request, response) => {
if (
payload.data.object.mode == "subscription" &&
payload.type === "checkout.session.completed"
) {
//do something
}
if (payload.type === "checkout.session.completed") {
const session = await stripe.checkout.sessions.retrieve(
payload.data.object.id,
{
expand: ["line_items"],
}
);
//do something
}
}
@elder lantern
what about the endpoint url?
sorry, which url?
when you create a webhook endpoint, you need to provide a url for us to send the webhook to i.e. https://stripe.com/docs/api/webhook_endpoints/create#create_webhook_endpoint-url
if you login to this link : https://dashboard.stripe.com/webhooks, you can see all the webhook url(s) that you've setup to receive webhook events in production. Which one are you expecting to receive the checkout.session.completed event on?
Okay, Wait up
alright, for https://dashboard.saucedproxies.com/, your server is returning a 521 error, you would probably want to check on why your server isn't publicly accessible
attempting to access it through the browser is showing the same 521 error
for https://saucedproxies.com/, you haven't had a recent checkout session complete, so there're no webhooks attempted yet
but for this https://saucedproxies.com/, how can I attempt webhooks for it.
I already have webhook setup for it in the code
Web site created using create-react-app
you can either complete a live checkout session i.e. finish paying for something, or you can use the Stripe CLI to trigger an event
stripe trigger <event> --api-key=sk_live_1234
i think this might work
How can I use this?
do you mean instead of this ?
stripe listen --forward-to localhost:5002/api/webhook
let me rephrase, why do you need to use the Stripe CLI to foward webhooks to https://saucedproxies.com/?
is it because this url is not publicly accessible?
no it is live now
both urls are publicly accessible
okay, so for https://dashboard.saucedproxies.com/, if you access this link https://dashboard.stripe.com/webhooks/we_1Jd8y7EMiRIxVc48Y97N5dG3
you will see a resend button
okay
can you click on it and see if it's delivered successfully this time?
that's an error from your server, you're going to need to figure out why it's returning a 405 now
I'm using this website https://saucedproxies.com/ for purchasing , it's backend running on port 5002 and I'm using this [stripe listen --forward-to localhost:5002/api/webhook] to trigger the events
for this https://dashboard.saucedproxies.com/ it is running on port 5000 I'm not using it for purchasing but both websites have webhook setup
Web site created using create-react-app
Web site created using create-react-app
should I remove webhook setup from the dashboard becuse I'm not using it?
if you're not using it, i'd suggest removing it to avoid any confusion
so your saucedproxies is currently returning a 405 error, you'll need to look into it to see why it's returning 405 : https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
Now I removed webhook setup for dashboard and tested the purchasing in the test mode for saucedproxies and it is working so?
@elder lantern
you would probably wait for a checkout session in live mode, to make sure everything is working fine in production
what doesn't work in production? you'd need to provide more context like what is the error message for example?
we get redirected to success page
but it should also trigger an event in backend
that dosen't happenm
i don't see you doing anything in live mode
are you testing in test mode or in live mode?
you've setup the sauceproxies webhook url in live mode, if you're creating a Checkout Session in test mode - the event would naturally be created in test mode (and your sauceproxies webhook url wouldn't receive anything since it's in live mode)
we are using live keys
what else is needed?
yeah because that's the fresh one, we had in past
like yesterday we had checkouts
money was recieved
you just created your sauceproxies webhook url today
and your checkout sessions were done yesterday
so you won't have any checkout events delivered to your sauceproxies webhook url yet
yeah that time we were using dashboard.stripeproxies.com webhook
and it wasn't working it
*either
so
@twin lantern deleted it few minutes ago
don't you see logs for that webhook either?
i see the log to create the sauceproxies webhook
but like i mentioned, you need to have a new checkout created and completed for an event to be sent to that newly created webhook
maybe you can explain more on what you want to do with the old logs?
yesterday we bought stuff in live mode
and the payment came through
but event was probably not triggered
so can you see
if you can see any logs for successful payment and find the error causeD?
the checkout.session.completed event was triggered yesterday, you can see one example here : https://dashboard.stripe.com/events/evt_1JmAMBEMiRIxVc48xzDqmVcf
the reason why you didn't receive it, was probably because delivery failed due to 521 error
if you login to that page, you can view all of the attempts
heya @grim meteor! we can continue here
just tried and got 405 error
I can't really advise you on how to resolve a 405 error since it probably depends on some server configuration on your end. You can try searching online to see what possible reasons/solutions are causing this, some examples which i found which may help :
they're post requests
200
I mean content type
if you haven't seen this yet, it might be a good reference : https://stripe.com/docs/webhooks/quickstart
I am not the dev for this
it doesn't need any content type, all we really need is for your endpoint to return 2xx HTTP status code to Stripe.
Stripe sends webhook events in test mode, and they are also using POST. Have you checked if the event was sent using the Stripe Dashboard?
@grim meteor what do you need help with?
hey
can you read the past convo
this is the status I get now
still it won't work
@celest sparrow
@grim meteor Can I ask you to provide more detailed inforamtion than a txt file dump? What is blocking you, what isn't working? That txt is just a client-side confirmation in Checkout
.
read from here
to here
Please, try to provide a detailed summary of what you need help with. There is a ton of backlog that is unclear (I tried to skim) and there are 14 other people asking questions right now
So we are using stripe cli for webhook events to trigger a backend process on succesful checkout, after checkout we get success message (redirected by stripe) but the backend is not triggered, but this happens only in live mode, in test mode it works perfectly
Stripe CLI is purely for Test mode environments. So you likely are not using this in production right? Do you see the event sent to your webhook endpoint?
do you have an example event id?
wait so you mean
stripe cli won't work for live mode in stripe?
@twin lantern
@celest sparrow
I don't really grasp why you'd use the CLI for live mode. In production you have a real server that is available publicly already, you configure your HTTPS endpoint where we send events directly
i see
does that unblock you @stark salmon ?
sorry wrong auto-complete, damn you Discord
@grim meteor does that unblock you?
I am not the dev, I pinged the dev
he'll come in abit
Hey
I'm using stripe CLI to trigger the events
In test mode it works perfectly
But in live mode it doesn't work
And the stripe cli is listening for the events
@celest sparrow
you just @ me with the same exact question though
did you read what I said above? There's no reason to use the CLI in Live mode, so don't do that
So what should I use to listen for the events