# Scan Paying application

**URL:** <https://community.thunkable.com/t/scan-paying-application/1767777>\
**Category:** Questions about Thunkable X\
**Created:** [March 4, 2022, 9:59pm UTC](https://community.thunkable.com/t/scan-paying-application/1767777 "2022-03-04T21:59:23Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.jacob2012x](https://avatars.discourse-cdn.com/v4/letter/t/4bbf92/32.png) [@thomas.jacob2012x](https://community.thunkable.com/u/thomas.jacob2012x)\
**Post date:** [March 4, 2022, 9:59pm UTC](https://community.thunkable.com/t/scan-paying-application/1767777/1 "2022-03-04T21:59:23Z")

</div>

Hi,

I’m planning to develop a scan and pay application using Thunkable X with API integration. But once scanning the merchant id, I’m getting a url where I’m unable to send a query using api call since I’m not able to break the link.

Is there any idea to counter.?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 4, 2022, 10:00pm UTC](https://community.thunkable.com/t/scan-paying-application/1767777/2 "2022-03-04T22:00:50Z")

</div>

Can you give some examples of what you mean? The url should just be a text string so you should be able to use text blocks to parse it.

---

<div class="post-metadata">

**Author:** ![thomas.jacob2012x](https://avatars.discourse-cdn.com/v4/letter/t/4bbf92/32.png) [@thomas.jacob2012x](https://community.thunkable.com/u/thomas.jacob2012x)\
**Post date:** [March 5, 2022, 7:34am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/3 "2022-03-05T07:34:22Z")

</div>

Hi, Thanks for the reply.

After scanning I’ll be receiving a url to initiate the payment.

 ![WhatsApp Image 2022-03-05 at 12.47.41 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/5/65c5947f5770ac6be7f3eea1dfa871287e14d66a.jpeg)

And once i click the button it’ll navigate to the ‘PAYTM App’. But unfortunately idk how to break the url details to add those to the API property. As of now I just made this as the web api url in the blocks which I know is a big blunder.

![Screenshot 2022-03-05 130230](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/5/35ab42f3b22cc085f7c810dbb67ba51a16f3ab03.png)

Expecting a help on this.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 5, 2022, 7:40am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/4 "2022-03-05T07:40:06Z")

</div>

Okay, so the url in the screenshot is the one you scanned, correct?

And what part of it do you need for the API?

---

<div class="post-metadata">

**Author:** ![thomas.jacob2012x](https://avatars.discourse-cdn.com/v4/letter/t/4bbf92/32.png) [@thomas.jacob2012x](https://community.thunkable.com/u/thomas.jacob2012x)\
**Post date:** [March 5, 2022, 8:05am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/5 "2022-03-05T08:05:17Z")

</div>

after scanning through ny application, as you can see the url contains all the deatils like merchant name, id, amount and currency.

If I’m manually making a payment, i can collect those label text and pass it through api but after scanning ill get these in a link.

If I try to open this as a link through thunkable, its not prompting the paytm application to open.

Now coming to the idea - once scanned and after entering the amount, it should collect the general details from the url (like the merchant id, name and currency) and the amount I’m typing manually pass that through API and opens paytm application with checkout page by fetching the details already passed from Thunkable app.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 5, 2022, 9:00am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/6 "2022-03-05T09:00:25Z")

</div>

It sounds like you need to parse the url and pass parts of it to the API. But to help you with that, I need **really specific** information. You’re telling me that you need “details like merchant name, id, amount and currency.” It’s still pretty vague.

Because I don’t know if you need “&mc=5499” or “mc=5499” or “5499” etc.

You can use text blocks like [find first occurrence](https://docs.thunkable.com/text#find-first-last-occurrence) to search within a text string which is what your url is. But I can’t show you the blocks without knowing the specific text you need.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [March 5, 2022, 9:20am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/7 "2022-03-05T09:20:49Z")

</div>

Here is a quick demo that should help you

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/8/a84abd7d2c3f922f6816195ba7ab20b7801b50d0.png)

[https://x.thunkable.com/projectPage/6223205e6c311701b6f7a03c](https://x.thunkable.com/projectPage/6223205e6c311701b6f7a03c)

---

<div class="post-metadata">

**Author:** ![thomas.jacob2012x](https://avatars.discourse-cdn.com/v4/letter/t/4bbf92/32.png) [@thomas.jacob2012x](https://community.thunkable.com/u/thomas.jacob2012x)\
**Post date:** [March 6, 2022, 6:00am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/8 "2022-03-06T06:00:51Z")

</div>

@muneer @tatiang thanks for the support.

@muneer as per your assistance i made the blocks and tested real time, but the extraction went wrong. Attaching the images below.

![Screenshot 2022-03-06 112655](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/4/647742fe3de96d62934e0cd57ed00676572e4702.png)

 ![Screenshot 2022-03-06 112718](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/d/2d466dc410f444f462eac053368c806e74c720be.png)  
 ![WhatsApp Image 2022-03-06 at 11.26.05 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/2/323380685776878b46ba3a74a8de9ad160dd64ea.jpeg)  
 ![WhatsApp Image 2022-03-06 at 11.26.28 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/9/0943f2a1bd010d6609d762d7d512498af782c754.jpeg)

the url structure remains the same, but idk whats gone wrong.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [March 6, 2022, 6:17am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/9 "2022-03-06T06:17:31Z")

</div>

Where is the equals sign **=**?

You should not write `pa` as start text. It should be `pa=`. Others follow the same rule.

I can see other parameters like `mode` and `origin` which was not in the original text. You will need to extract what you need from the **URI**.

---

<div class="post-metadata">

**Author:** ![thomas.jacob2012x](https://avatars.discourse-cdn.com/v4/letter/t/4bbf92/32.png) [@thomas.jacob2012x](https://community.thunkable.com/u/thomas.jacob2012x)\
**Post date:** [March 6, 2022, 7:11am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/10 "2022-03-06T07:11:54Z")

</div>

Thank you @muneer for your prompt reply.

Now instead of the scanning qr data, for the time being I used the same qr link given to you and tried inside my code. But unfortunately the data not yet got properly extracted. The above changes are made and done.

 ![thunk1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/c/2c19d8941591635c5a4a3332fa7e87c71fca45b5.png)  
 ![thunk2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/4/a40b341b11320568f98ebb720b081a459ea2ff32.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 6, 2022, 7:20am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/11 "2022-03-06T07:20:14Z")

</div>

You’ve completely changed the _getText_ function that @muneer provided. In his, he checks for the position of the “&” character but in yours, you’re checking for the position of the start text and then subtracting two for some reason. That isn’t going to work in part because if sets the end position **before** the start position.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [March 6, 2022, 7:30am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/12 "2022-03-06T07:30:48Z")

</div>

Please **remix** my demo project and if possible make your own minimal project that reproduce the problem and share it here so we can see what went wrong in your project.

I can see the last parameter is shown in your screen so why the others do not show?

> [@tatiang](#):
>
> he checks for the position of the “&” character but in yours, you’re checking for the position of the start text and then subtracting two for some reason.

I keep updating my code so @tatiang has the latest (I recommend to remix to get the last updated project). I checked in a number of ways to ensure it works properly.

---

<div class="post-metadata">

**Author:** ![thomas.jacob2012x](https://avatars.discourse-cdn.com/v4/letter/t/4bbf92/32.png) [@thomas.jacob2012x](https://community.thunkable.com/u/thomas.jacob2012x)\
**Post date:** [March 7, 2022, 11:15am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/13 "2022-03-07T11:15:57Z")

</div>

[https://x.thunkable.com/copy/cae5efaa3edcd9063312b54e970f9626](https://x.thunkable.com/copy/cae5efaa3edcd9063312b54e970f9626)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [March 7, 2022, 11:45am UTC](https://community.thunkable.com/t/scan-paying-application/1767777/14 "2022-03-07T11:45:56Z")

</div>

This is your mistake

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/8/a88551b6f17f908e9dac11f04db6e0d809f2dc54.png)

Correct it and you should see the info printed in screen.

---

<div class="post-metadata">

**Author:** ![thomas.jacob2012x](https://avatars.discourse-cdn.com/v4/letter/t/4bbf92/32.png) [@thomas.jacob2012x](https://community.thunkable.com/u/thomas.jacob2012x)\
**Post date:** [March 7, 2022, 12:12pm UTC](https://community.thunkable.com/t/scan-paying-application/1767777/15 "2022-03-07T12:12:55Z")

</div>

wow, its working now. One last question: so can I use these label value to GET to the merchant API

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [March 7, 2022, 12:15pm UTC](https://community.thunkable.com/t/scan-paying-application/1767777/16 "2022-03-07T12:15:32Z")

</div>

> [@thomas.jacob2012x](#):
>
> can I use these label value to GET to the merchant API

If any of these values are required in the `API GET` call then you can of course use them.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [June 5, 2022, 12:16pm UTC](https://community.thunkable.com/t/scan-paying-application/1767777/17 "2022-06-05T12:16:04Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
