#morteza_webhooks

1 messages ¡ Page 1 of 1 (latest)

sand boughBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1359101568808517834

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

muted cloud
#

Question 1

chrome elk
#

hi there!

muted cloud
#

why do we have webhooks ? I mean when someone makes a purchase why payment result is not immediate ?

chrome elk
#

the payment is immediate. but if your server needs to run some custom action after the payment, then a webhook event is the perfect place for this.

muted cloud
#

but sometime we see that webhook response takes some time

#

so you are saying that if i get success from sdk , like react native stripe, the payment is definitely successful ??

chrome elk
#

what do you mean by "some time" exactly?

#

normally within a couple of seconds you should receive the webhook event.

muted cloud
#

sometimes i mean

chrome elk
#

so you are saying that if i get success from sdk , like react native stripe, the payment is definitely successful ??
which API call exactly are you making? if it's to confirm a payment, and you get a successfull, response, then yes the payment was successful.

muted cloud
#

well, i'm using react native stripe package, it has a openSheet and then I don't know what the SDK calls behind the scenes

chrome elk
#

got it. so what's your question exactly?
if you have some code that needs to run after the payment succeeds, for example to fulfill an order, you should use webhook events for this.
otherwise, if just after making the payment the user close their app, then your code mlight never be run.

muted cloud
#

we have developed a tap to pay app, and it's used for example at a baber, when user gets the service, they make a purchase at tap to pay app, then we wait for webhook response and it takes some 10-20 seconds to respond. user can't wait for the payment response at the barber, they want it to be immediate right?

#

after user makes a purchase, we have developed an api in the back-end that check if web-hook has responded or not and usually it takes some time

sand boughBOT
muted cloud
#

is this integration fine ?

chrome elk
#

I don't understand. why does the end user should wait for the webhook event? the webhook event is just for you to handle post-payment processing.

muted cloud
#

well, Imagine you get a service at the shop and you leave, like a hair removel service, then you make a purchase and leave the shop, what if webhook responses with failure ?

foggy ocean
#

There should be ~immediate feedback on the Tap to Pay readers whether or not the payment was successful. As noted, the webhook event is for any post-payment logic you might want to run, like emailing a receipt or whatever

muted cloud
#

so you are saying when we get success from sdk, it's always a success ?

#

export default function CheckoutScreen() {
// continued from above

const openPaymentSheet = async () => {
const { error } = await presentPaymentSheet();

if (error) {
  Alert.alert(`Error code: ${error.code}`, error.message);
} else {
  Alert.alert('Success', 'Your order is confirmed!');
}

};

return (
<Screen>
<Button
variant="primary"
disabled={!loading}
title="Checkout"
onPress={openPaymentSheet}
/>
</Screen>
);
}

foggy ocean
#

Not sure what Payment Sheet has to do with in-person/Tap to Pay payments?

muted cloud
foggy ocean
muted cloud
#

ok, if confirmPayment was successful then payment is 100% successful right ?

#

or still need to check webhook ?

foggy ocean
muted cloud
#

uh huh, you know what we've been doing ? we have an api in the backend that gets orderid and check if webhook has responded for that or not and we call it after a successful payment !!

#

that's why sometime user has to wait for our own api to know if payment was successfull or not !!

foggy ocean
#

Yeah, that seems redundant

muted cloud
#

is there any chances that a confirmed payment responds with failed webhook ?

foggy ocean
#

I don't understand what that means?

muted cloud
#

for example I get status:success from confirmPayment and for the same order I get a webhook with failed status

foggy ocean
#

No that's impossible

muted cloud
#

ok then

#

thank you

#

it was a great help