I want to put credit card number in a field and on clicking a button to retrieve its token. I don't find much information but the thing that I found is:
https://developer.moneris.com/Documentation/NA/E-Commerce%20Solutions/Hosted%20Solutions/Hosted%20Tokenization
I tried with it but still can't make it work. If I put this whole code in webview html part it will call the function on the first screen render. If I try to get the functions out of the webview and use them I can't take the specific iframe with document.getElementById('monerisFrame').contentWindow;
Any thoughts how can I accomplish my task?
You can use Moneris Apis to communicate in React Native :
We can create XML Post Request and connect with the Moneris server with your API Token and Store Id
Follow this blog :
https://medium.com/me/stats/post/7129b5a8b4a2
Related
i want to send an ID that i get from a database to another screen and i've seen how to do it on google but people only use hook components and i'm new to react native so i don't really understand how to do it.
You can send data from one screen to another using navigation params. Here is example: https://reactnavigation.org/docs/params/.
I have encountered a situation where I need to display a Dropdown and want the options to dynamically fetch from an API and load on clicking the caret (maybe show a loader by the time the API response comes through). The experience I am looking for is something in the following lines -
Loading (fetching options from API)
Display options after successful response
The documentation didn't give any API surface through which this can be possible.
Is it possible to achieve this with the current APIs that are in place for this control component?
Good point to start is to use BasePicker Component from Pickers.
import { BasePicker } from 'office-ui-fabric-react/lib/Pickers'
Inside BasePicker you have a methods which you can use to make a "lazy" behavior. For example, when you click on component then make a call to API and populate items list.
What is inside BasePicker take a look here or from official documentation.
Codepen example
I am creating an application to order food online and I want to perform a functionality where the user does not have to scroll or do any action to see reflected on the screen of their device that their order has changed status.
Example: The user enters to see the status of their order and being there on that screen that the user can see how the status of the order is updated without having to scroll.
I don't know if I should use listeners or some way with async and wait
I am using react native with hooks, react navigation 5, axios for API call
Do you know how I could do this? how can I find more information on this.
I appreciate any help you can give me.
There are two ways you can solve this.
Polling - you can create some interval, say 1 second, for axios to refetch the data you need. Wrapping your axios call with setInterval() https://www.w3schools.com/jsref/met_win_setinterval.asp, is one form of this.
Web Sockets - you can create a web socket that maintains a constant connection to your app and server, so when updates happen it is automatically reflected in the UI. You can check out WebSocket support in React Native here: https://reactnative.dev/docs/network.html#websocket-support
If anyone can please help me with how to retrieve the navigation menu with REST and Graphql API.
If no API is available, then how can I write a custom Navigation API?
We need to get the below data with API. see screenshot
Use this in query. it worked for me. Remember to replace "main-menu" with the header code of your site.
{
menu(handle:"main-menu"){
items{
id
tags
title
}
}
}
currently, there is no API endpoint that would allow you to access the navigation. However, seeing that the navigation in your screenshot mainly contains collections, probably it would be a good starting point for you to read those? This can actually be done via this call:
GET /admin/api/2020-01/collection_listings.json
You can find more info here:
https://shopify.dev/docs/admin-api/rest/reference/sales-channels/collectionlisting#index-2020-01
Hope this helps,
Roman
I have a webapp built on Laravel that is to be displayed on a mobile app (both android and ios, which are being built using React Native) via WebView.
I managed to use evollu/react-native-fcm to generate the token.
My question is: what is the proper way to send this token to the WebView, so my webapp can relate it to a user and store it on the database?
My first idea was to pass it along to the URL being called by the WebView as a GET parameter, but the parameter always come blank on the other side, probably because the token is requested asynchronously and when the webview is called it didn't come yet.
What can I do?
Either as a url parameter or via postMessage. In both ways you have to wait until the token is available. So load the page or render the webview when the token is available. Or you pass the token via postMessage immediately after the token was received.
The postMessage method is the recommended way, because you can load the page and wait for the token at the same time.
I managed to delay the rendering until the token was ready by using an if on the render method that would not return the webview if a state "loading" is true; then in the function that gets the token I used setState to change the value of loading to false.