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.
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.
Hi, Thanks for the reply.
After scanning I’ll be receiving a url to initiate the payment.
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.
Expecting a help on this.
Okay, so the url in the screenshot is the one you scanned, correct?
And what part of it do you need for the API?
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.
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 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.
@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.
the url structure remains the same, but idk whats gone wrong.
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
origin which was not in the original text. You will need to extract what you need from the URI.
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.
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.
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?
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.
This is your mistake
Correct it and you should see the info printed in screen.
wow, its working now. One last question: so 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.