# Payhere Webhook + Api takes 14 seconds to hide webview on checkout

**URL:** <https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262>\
**Category:** Ask for Help\
**Created:** [July 26, 2022, 3:29pm UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262 "2022-07-26T15:29:42Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 26, 2022, 3:29pm UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/1 "2022-07-26T15:29:42Z")

</div>

hi folks,  
I was testing to see if i could get a connection with Payhere/Make/Glide.  
-The payhere checkout is inside a webview on a tab that only shows up during checkout.  
-If a payment is successful then the glide api changes a column value so that the webview now becomes hidden and a payment success/button shows up. I need users to click this button to clear the custom form and hide the tab.

Currently the Make scenario is quite simple as i am just trying to see if i can make a connection: if payment is successful, change a column value to a number. This number triggers the visibility.

I was hoping that the api would be fast enough to hide the webview before the Payhere’s “payment successful” page showed up as that would look glitchy and confusing to see a confirmation page suddenly vanish to another confirmation page. But it was worse than that. It took 14 seconds for the visibility condition to change. That won’t work as the use can navigate off/click cancel, go to the email app when the email comes in etc.

is this normal behaviour? if so then this route won’t be an option.

---

<div class="post-metadata">

**Author:** ![eltintero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eltintero/32/76520_2.png) [@eltintero](https://community.glideapps.com/u/eltintero)\
**Post date:** [July 26, 2022, 3:54pm UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/2 "2022-07-26T15:54:30Z")

</div>

Is your app PRO? Is the data sync settings on extra? I think in most cases it takes up to 10 seconds?

---

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 26, 2022, 4:11pm UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/3 "2022-07-26T16:11:24Z")

</div>

Glide is Pro. I upgraded so that i could have access to APIs.  
Make is the free plan but i think it should still be considered “instant” or whenever it is received.

I’m unsure what data sync on extra means

---

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 26, 2022, 6:59pm UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/4 "2022-07-26T18:59:22Z")

</div>

also, Make says it is only taking 1 or 2 seconds.

 ![Screen Shot 2022-07-26 at 2.57.13 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/3/f3d2348b6ac681ef8f8b1d49ce9dff92aa899eb0.jpeg)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 27, 2022, 1:01am UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/5 "2022-07-27T01:01:20Z")

</div>

What if you set the PayHere successful page to your app’s home page? When I read your comment the other day I thought it was a long con to have it set up like that, that simply won’t be fast enough to beat the PayHere redirect.

---

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 27, 2022, 3:19pm UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/6 "2022-07-27T15:19:01Z")

</div>

So I don’t believe that I can set the payhere successful page to my home screen. Maybe because it is the home screen? I know that we can do so for deeplinked pages. In this case it says it cannot embed itself. I would still have the issue as I explain in the video below where the “edit/cancel” button would still show up above the web embedd.

What is puzzling is that I was watched @Robert_Petitto 's video on Glide APIs, and when he clicks the calendly create new event button, the new row is added into glide in just under 6 seconds.

 ![Screen Shot 2022-07-27 at 10.44.13 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/2/1269e3f4932c441784b7a33ee5a244caaa4df2f6.png)

---

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 27, 2022, 7:40pm UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/7 "2022-07-27T19:40:33Z")

</div>

so some good news and some bad news.

**Good news:**  
I wanted to know if the “create row” api fired faster than the change column api. Looks like it does. I was able to get it down to about 4-5 seconds. It’s way better, but still worrisome as the “back/edit” button is still visible. Maybe it just feels like an eternity to me as i know what is actually going on on the page. The customer might not notice, but i think it is too risky to run it that way.

I did it by having glide create a row with one variable (the userid being pushed through payhere as a custom field). I then made a relation to it from my other sheet. I set the visibility of my checkout page elements to whether or not this relation was empty or not. My plan is to delete that row once the user finishes the transaction.

**The bad news:**  
I tried it once more right after, and something very strange happened. It took 18 seconds AND 5 new rows were created. Make had 5 instances of the zap, all with the same transaction information. So somehow the webook was triggered 5 times. Payhere only had that one transaction when i checked (which makes sense because all the webooks had the same info). I tried a third time and everything worked ok.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 28, 2022, 2:12am UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/8 "2022-07-28T02:12:25Z")

</div>

> [@apaschea](#):
>
> I know that we can do so for deeplinked pages. In this case it says it cannot embed itself.

Ah that sucks. Seems like PayHere tried to have a webview of the page, which wouldn’t work due to security reasons, instead of navigating straight to that page, which was what I assumed.

So I assume the whole reason you don’t want to use just the webview (not the other buttons you have on there) is because you fear the edge cases that the user clicks the “done” button before they actually pay?

Does it matter to you that the order is done or not? Logically, I think when they accidentally click done they can always click your button to get in and actually pay. Then, the webhook fires and it should trigger some kind of visibility condition in your app to hide the payment button for that order.

That’s the way I usually build it. Do you have any concerns you want to share? I just want to understand more about why you have to do it like this, because it’s not the way I usually see it.

---

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 28, 2022, 3:46am UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/9 "2022-07-28T03:46:10Z")

</div>

So it doesn’t matter if they hit done and go back before they pay. It’s once they pay that there is an issue.

I need for them to hit a button to write the custom form data to a new table and then clear the form.

So once they click pay and the order is processing, then they could accidentally hit done and start wandering the app. It’s only 5 seconds but it does feel extremely long when you are waiting for a confirmation. By hitting done they would be brought back to the order screen or the order review, which will make them think “huh? Did my order go through? I thought I just paid”. Then all of a sudden out of nowhere the visibility condition will kick in and they will be very confused.

If they don’t hit done at the top left and let the payhere confirmation screen come up, then they are now faced with two “done” buttons. The one in the web view and the one on the top left. So now they aren’t sure what to click, and then all of a sudden the visibility kicks in and they are at a new screen. It’s a bit all over the place.

That’s why I think doing it the tab way is a little better because they are less likely to hit “cancel order” if they have already paid. They might be inclined to click the “done” button in the other one. Also, opening the web view as a link will close it if the app crashes or the internet fails. The tab will always get pushed back to the user when they come back, forcing them to hit a button to get out of it.

It’s just those few seconds that are really killing me. The payhere confirmation goes pretty fast, so I’m not sure why everything else is taking so long. I tried removing the filter for the “only if success” in Make. I thought maybe if glide didn’t have to wait for a successful payment, but just any payment to start the writing of the table process, it would start as soon as a transaction was initiated, not when initiated then checked if successful. This would have brought them to “loading screen” or “holding area” till I could then check if successful or failed. But it did not help the timing.

I am losing hope. Browsed the “glidecartv2” thread and checked out the app. Even something well built like that has a 12 second wait time and a warning saying “please be patient and wait”. I just know customers… they don’t read. I always expect the worst.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 28, 2022, 11:06am UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/10 "2022-07-28T11:06:41Z")

</div>

> [@apaschea](#):
>
> If they don’t hit done at the top left and let the payhere confirmation screen come up, then they are now faced with two “done” buttons. The one in the web view and the one on the top left.

I agree with this. Unfortunately the “Done” button in both sides are not things we can customize.

Considering what you said, I wonder if it’s better for you to use a Stripe Checkout process instead. Just take them out of the app and don’t have to worry about them accidentally clicking anywhere.

Once they pay in Stripe, it should take some seconds for the row to appear in Glide and hide the Stripe button, if you configure it correctly.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 28, 2022, 11:10am UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/11 "2022-07-28T11:10:52Z")

</div>

> [@apaschea](#):
>
> The payhere confirmation goes pretty fast, so I’m not sure why everything else is taking so long.

> [@apaschea](#):
>
> I thought maybe if glide didn’t have to wait for a successful payment, but just any payment to start the writing of the table process, it would start as soon as a transaction was initiated

The whole thing here is on Make’s side. So PayHere receives the payment, initiates a webhook payload, then Make processes your flow and write a row back to Glide. Then it has to communicate to the device that a new row has appeared. In my experience, it would take at least 6 seconds, for some cases more than 10 seconds.

It used to be much worse pre-Glide API, I’m not sure if they can make it any faster.

---

<div class="post-metadata">

**Author:** ![apaschea](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@apaschea](https://community.glideapps.com/u/apaschea)\
**Post date:** [July 29, 2022, 1:02am UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/12 "2022-07-29T01:02:43Z")

</div>

I am unfortunately going to give up on getting payments prior to ordering. My only hope is if Glide overhauls the buy button.

I tried just bringing them out of the app and using stripe, but if they send it to someone to pay or do all kinds of different things, then it’ll just send a payment into nowhere.

Afterwards I tried a multitude of payhere alternatives. All were similar. I had some high hopes for one called “checkoutpage” but in the end the zap took even longer to fire. I thought because the loading of payment confirmation took 6-7 seconds, that the zap would fire and the visibility would trigger right as I got the confirmation. But it took another 10 seconds.

Tried zappier and integromat. Also tried paying for higher tiers so that there would be “high priority” when the zaps or scenes would come in. But that didn’t help. It may have shaved off like half a second for integromat.

I guess there has to be some give and take with no code. Nothing is perfect. I’ve already spent 3 days on it and need to get back to building. Hoping some updates from glide will allow for it down the road.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 29, 2022, 1:07am UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/13 "2022-07-29T01:07:11Z")

</div>

The buy button has had no love since its original introduction, I doubt there’s something on the way.

> [@apaschea](#):
>
> All were similar. I had some high hopes for one called “checkoutpage” but in the end the zap took even longer to fire. I thought because the loading of payment confirmation took 6-7 seconds, that the zap would fire and the visibility would trigger right as I got the confirmation. But it took another 10 seconds.

As I said in my previous comment, it would take some more time for the automation tool, whether it be Zapier or Make, to process your payload and push it back to Glide, then some more time for Glide to reflect it on the device, so ultimately it would always be later than you seeing the confirmation screen in the app itself, since it’s almost instant.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [July 29, 2022, 1:13am UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/14 "2022-07-29T01:13:15Z")

</div>

> [@ThinhDinh](#):
>
> The buy button has had no love since its original introduction

This has been a line I’ve had to say to clients often…

@ThinhDinh Think there’s anyway to build a custom payment form using user specific columns and webhooks to Payhere (or Stripe) API?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 29, 2022, 1:51am UTC](https://community.glideapps.com/t/payhere-webhook-api-takes-14-seconds-to-hide-webview-on-checkout/45262/15 "2022-07-29T01:51:30Z")

</div>

You can create a new payment link using the API, but there has to be a middle step to generate it before you show it to the end user. I think it’s risky to do it on the fly (e.g let the user fill in the details that you will use in the link, then have to show the payment page just seconds later on the screen).
