#raj0911 - Checkout Event

1 messages ยท Page 1 of 1 (latest)

midnight laurel
#

Hi ๐Ÿ‘‹
If the async payment fails, the event triggered will not be asyc_payment_succeeded but rather async_payment_failed

arctic furnace
#

thanks for that, so will async_payment_success works for cards payments too or only bank payments ?

#

Also one more thing, When I create webhook with selected event type in Stripe dashboard and then in my code I don't add this piece of code @file_get_content("php://input"); then still I can run my code with the webhook endpoint I added in Stripe dashboard whenever that event get triggered ?

midnight laurel
#

As that page metioned, this event is only used for payment methods that have a significantly async confirmation process.

#

As for your webhook code, it is important to get the raw request body in order to create a valid Stripe event object.

arctic furnace
#

thanks, I got that, but my point is what if I don't use it? Will it not run my code, even it send request to that URL (endpoint) whether I'm receiving it or not at my end ?

midnight laurel
#

but my point is what if I don't use it?
What is the "it" here?

#

Do you mean just that command or a webook listener entirely?

arctic furnace
#

"it" is for that code line I mentioned

#

@file_get_content("php://input");

midnight laurel
#

This is the approach we use to get the raw $payload object which i used later here:

try {
  $event = \Stripe\Event::constructFrom(
    json_decode($payload, true)
  );
}

If you have another way to get this data successfully you don't have to use it but you may run into issues when you try to construct an event.

arctic furnace
#

thanks for that

#

reason for asking this was, I checked one wordpress payment plugin code, and in there, they have a REST API set up where it runs the code even if I don't add this line @file_get_content("php://input"); even I can't see that payload code in there but it's still running

#

I've tested it

midnight laurel
#

Okay, if that gets you what you need then that will work. Many of our "builder" pages are focused on developers writing their own code. Likely the plugin is handling that somewhere else.

arctic furnace
#

yeah that might be the case

#

thanks for your help though, I really appreciate it

midnight laurel
#

Sure thing! Happy to help ๐Ÿ™‚