#morteza_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ 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.
Question 1
hi there!
why do we have webhooks ? I mean when someone makes a purchase why payment result is not immediate ?
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.
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 ??
what do you mean by "some time" exactly?
normally within a couple of seconds you should receive the webhook event.
sometimes i mean
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.
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
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.
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
is this integration fine ?
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.
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 ?
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
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>
);
}
No, that's not what I'm saying. The confirmation method you call in your app would resolve, and return an error if it fails: https://docs.stripe.com/terminal/payments/collect-card-payment?terminal-sdk-platform=react-native#confirm-payment
Not sure what Payment Sheet has to do with in-person/Tap to Pay payments?
this is for react native stripe, when there is no error, is it 100% success or still need to check webhook ?
I think the link I shared answers that:
When confirming a payment fails, the SDK returns an error that includes the updated PaymentIntent. Your application needs to inspect the PaymentIntent to decide how to deal with the error.
https://docs.stripe.com/terminal/payments/collect-card-payment?terminal-sdk-platform=react-native#handling-failures
ok, if confirmPayment was successful then payment is 100% successful right ?
or still need to check webhook ?
Yes, if status: 'succeeded' then that payment was successful and the reader will reflect that. As we've said, the webhook is if you need to process any logic async after the payment, like send a receipt to the customer or whatever
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 !!
Yeah, that seems redundant
is there any chances that a confirmed payment responds with failed webhook ?
I don't understand what that means?
for example I get status:success from confirmPayment and for the same order I get a webhook with failed status
No that's impossible