Reputation: 25527
I am doing an e-commerce application using react native. We need to integrate a payment gateway which doesn't seems to have an sdk for react native(ADCB). How should I approach to this problem?
Can I proceed with Custom Tabs ? If so, how can I close the custom tab after the payment has been done?
url = 'https://www.example.com/newsagepay/newtest.php?&customerSage='+isuerID+'&checkSage=1';
CustomTabs.openURL(url,{ toolbarColor: '#607D8B',enableUrlBarHiding: true, showPageTitle: true, enableDefaultShare: true,
animations: ANIMATIONS_SLIDE}).then((launched: boolean) => {
console.log(`Launched custom tabs: ${launched}`);
}).catch(err => {
console.error(err)
});
Upvotes: 2
Views: 2451
Reputation: 873
I would like to suggest you <WebView />
and you can use a property of webView called onNavigationStateChange={}
pass on a function to it. Monitor the URL of the webview
and handle it according to success or failure.
for example. suppose payment successes URL is http://payment.sucess
<WebView
onNavigationStateChange={(webViewState)=>{
console.log(webViewState.url)
if(webViewState.url==="http://payment.sucess"){
//navigate or close webview
}}
javaScriptEnabled = {true}
domStorageEnabled = {true}
/>
Upvotes: 7