Invoke external app via webview

When a customer initiates a payment on the merchant's mobile app, they will be redirected to the acquirer's app or a fast payment app to complete the transaction. This process involves app-to-app redirection from the merchant's mobile app to the acquirer's or fast payment app. To enable this redirection, the app scheme must be registered in advance. Please refer to the external app scheme (App URL Scheme) list and methodology for further details.

To launch an external application within a WebView, please set call_from_app to Y. After the payment is completed, include the merchant's app scheme in call_from_scheme to enable redirection back to the merchant's app.

External app scheme list

Redirection to external third-party applications, such as ISP apps, local acquirer apps, local fast payment apps, and cross-border fast payment apps, will be enabled within a WebView.

Local credit card and fast payment

Acquirer App scheme
ISP(BC/Kookmin) ispmobile://
KB Kookmin Card kb-acp://, newliiv://, kbbank://, liivbank://
Lotte Card lotteappcard://
Samsung Card mpocket.online.ansimclick://, monimopay://, monimopayauth://
Shinhan Card shinhan-sr-ansimclick://, com.shinhan.smartcaremgr://
Hyundai Card hdcardappcardansimclick://
Nonghyup Card nhallonepayansimclick://
Hana Card cloudpay://
Citibank Card citimobileapp://
Woori Card com.wooricard.wcard:// NewSmartPib://

Local fast payment

Acquirer App scheme
Naverpay naversearchthirdlogin://
Kakaopay kakaotalk://
Toss pay supertoss://
PAYCO payco://
Smile pay smilepayapp://

Cross-border fast payment

Acquirer App scheme
Linepay line://
Alipay+ alipays://
Wechat weixin://

IOS

After registering the external app scheme for launch within a WebView, ensure that the necessary code is implemented to execute the app scheme.

1. Configuration of the merchant's app URL scheme.

Please register the URL scheme in the merchant's app. Before invoking the Eximbay payment page, enter the merchant app's URL scheme as the value for the call_from_scheme field to initiate the JS SDK.

2. External app(3rd party app) URL Scheme registration.

Please add LSApplicationQueriesSchemes to the Info.plist file. The payment method's app scheme should be included in the following array format.

                    
//Info.plist
<key>LSApplicationQueriesSchemes</key>
<array>
  <!-- Local payment --> 
  <string> ispmobile </string>  <!--ISP Mobile-->
  <string> lotteappcard </string>  <!--Lotte App Card--> 
  <string> online.ansimclick </string>  <!--Samsung App Card-->
  <string> monimopay </string>  <!--Samsung monimo-->
  <string> shinhan sr ansimclick </string>  <!--Shinhan App Card-->
  <string> com.shinhan.smartcaremgr </string>  <!--Shinhan Super SOL-->
  <string> hdcardappcardansimclick </string>  <!--Hyundai App Card-->
  <string> nhallonepayansimclick </string>  <!--Nonghyup All-in-one pay-->
  <string> cloudpay </string>  <!--Hana App Card-->
  <string> citimobileapp </string>  <!--Citi App Card-->
  <string> scom.wooricard.wcard </string>  <!--Woori WON Card app-->
  <string> NewSmartPib </string>  <!--Woori WON App-->
  <string> kakaotalk </string>  <!--Kakaopay-->
  <string> payco </string>  <!--Payco-->
  <string> smilepayapp </string>  <!--Smile pay-->
  <string> supertoss </string>  <!--Toss pay-->
  <string> naversearchthirdlog in </string>  <!-- Naverpay-->

  <!-- Cross-border payment--> 
  <string> line </string>  <!--LINEPAY--> 
  <string> alipays </string>  <!--Alipay+-->
  <string> weixin </string>  <!--Wechat-->
</array>
                    
                  

3. Network Security Exception Configuration.

To allow HTTPS requests received via WebView and bypass security restrictions, please configure App Transport Security (ATS) as follows.

                    
<key>NSAppTransportSecurity</key> 
<dict> 
<key>NSAllowsArbitraryLoadsInWebContent</key> 
<true/> 
<key>NSAllowsArbitraryLoads</key>
<true/> 
</dict>
                    
                  

Android

Sample Code for Adding an App Scheme

To enable callback to the external application on Android, it is necessary to implement the logic for calling back the app for the acquirer and payment service provider.

Java
                      
Local payment

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (!URLUtil.isNetworkUrl(url) && !URLUti l.isJavaScriptUrl(url)) {
        final Uri uri;
        Intent intent = null;
        
        try {
                uri = Uri.parse(url);
                intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);

        } catch (Exception e){
            return false;
        }

        if ("intent".equals(uri.getScheme())) {
                try {
                        Log.d("LOG", "intent startActivity");
                        startActivity(intent);
                        return true;
                } catch (ActivityNotFoundExce ption e) {
                        final String packageName = intent.getPackage();
                        Log.d("LOG", "ActivityNotFoundException packageName :" + packageName);
                        if (!TextUtils.isEmpty(packageName)) {
                        startActivity(new Intent(Intent.ACTION_VIEW,
                        Uri.parse("market://details?id=" + packageName)));
                        return true;
                        }
                }
            } else if ("supertoss".equals(uri.getScheme())) {//TOSS
                      try {
                            Log.d("LOG", "TOSS startActivity");
                            startActivity(new Intent(Intent.ACTION_VIEW, uri));
                            return true;
                      } catch (ActivityNotFoundException e)
                              Log.d("LOG", "Activi tyNotFoundException TOSS");
                              startActivity( new Intent (Intent.ACTION_VIEW,
                      Uri.parse("market://details?id=viva.republica.toss")));
                                return true;
                            } catch (Exception e) {
                                return false;
                            }
                      } else if("nidlogin".equals(uri.getScheme())) {//NAVERPAY
                              try {
                                      Log.d("LOG", "NAVERPAY startActivity");
                                      startActivity(new Intent(Intent.ACTION_VIEW, uri));
                                      return true;
                              } catch (ActivityNotFoundException e) {
                                        Log.d("LOG", "ActivityNotFoundException NAVERPAY");
                                        startActivity(new Intent(Intent.ACTION_VIEW,
                      Uri.parse("market://details?id=com.nhn.android.search")));
                                        return true;
                                    }
                                    catch (Exception e) {
                                    return false;
                                    }
                        } else {
                                  try {
                                        Log.d("LOG", "else startActivity");
                                        startActivity(new Intent(Intent.ACTION_VIEW, uri));
                                        return true;
                                  } catch (ActivityNotFoundException e) {
                                            final String packageName = intent.getPackage();
                                            Log.d("LOG", "4091_else startActivity ActivityNotFoundException 
                        packageName :" + packageName);
                                            if (!TextUtils.isEmpty(pack ageName)) {
                                            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="
                        + packageName)));
                                          return true;
                                          }
                                      } catch (Exception e) {
                                                return false;
                                      }
                              }
                      }
                      return false;
                }
                      
                  
Java
                                
          Cross-border payment
          
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            
              if (!URLUtil.isNetworkUrl(url) && !URLUtil.isJavaScriptUrl(url)) {
                    final Uri uri;
                    Intent intent = null;
                    
                    try {
                          uri = Uri.parse(url);
                          intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
                    
                      } catch (Exception e) {
                            return false;
                    }
                    
                    if ("intent".equals(uri.getScheme())) {
                          try {
                                Log.d("LOG", "intent startActivity");
                                startActivity(intent);
                                return true;
                            } catch (ActivityNotFoundException e) {
                                      final String packageName = intent.getPackage();
                                      Log.d("LOG", "ActivityNotFoundException packageName :" + packageName);
                                      if (!TextUtils.isEmpty(packageName)) {
                                              startActivity(new Intent(Intent.ACTION_VIEW,
                                              Uri.parse("market://details?id=" + packageName)));
                                              return true;
                                              }

                            } else if ("alipays".equals(uri.getScheme())) { //Alipay+
                                        try {
                                              Log.d("LOG", "alipays startA ctivity");
                                              startActivity(new Intent(Intent.ACTION_VIEW, uri));
                                              return true;
                                        } catch (ActivityNotFoundException e) {
                                              Log.d("LOG", "ActivityNotFoundException alipays");
                                              startActivity(new Intent(Intent.ACTION_VIEW,
                                              Uri.parse("market://details?id=com.eg.android.AlipayGphone")));
                                              return true;
                                        
                                        } catch (Exception e) {
                                              return false;
                                        }

                            } else if ("line".equals(uri.getScheme())) { //LINEPAY
                                        try {
                                              Log.d("LOG", "line startActivity");
                                              startActivity(new Intent(Intent.ACTION_VIEW, uri));
                                              return true;
                                        } catch (ActivityNotFoundException e) {
                                              Log.d("LOG", "ActivityNo tFoundException line");
                                              startActivity(new Intent(Intent.ACTION_VIEW,
                                              Uri.parse("market://details?id=jp.naver.line.android")));
                                              return true;
                                        } catch (Exception e) {
                                              return false;
                                        }
                              } else if ("weixin".equals(uri.getScheme())) { //Wechat
                                        try {
                                              Log.d("LOG", "weixin startActivity");
                                              startActivity(new Intent(Intent.ACTION_VIEW, uri));
                                              return true;
                                        } catch (ActivityNotFoundException e) {
                                              Log.d("LOG", "ActivityNo tFoundException weixin");
                                              startActivity(new Intent(Intent.ACTION_VIEW,
                                              Uri.parse("market://details?id=com.tencent.mm")));
                                              return true;
                                        } catch (Exception e) {
                                              return false;
                                        }

                              } else {
                                        try {
                                            Log.d("LOG", "else startActivity");
                                            startActivity(new Intent(Intent.ACTION_VIEW, uri));
                                            return true;
                                        } catch (ActivityNotFoundException e) {
                                            final String packageName = intent.getPacka ge();
                                            Log.d("LOG", "4091_else startActivity ActivityNotFoundException packageName :" + packageName);
                                            
                                            if (!TextUtils.isEmpty(packageName)) {
                                                  startActivity(new Intent(Intent.ACTION_VIEW,
                                                  Uri.parse("market://details?id=" + packageName)));
                                                  return true;
                                              }
                                          } catch (Exception e) {
                                              return false;
                                          }
                                }
                        }
                        return false;
                }                                
                                
                                          
                            

Alipay+ exception

To enable callback to Alipay+, please include the following parameters in the WebView configuration field.

                    
//Enable javascript 
webSettings.setJavaScriptEnabled(true); 

//Enable scaling 
webSettings.setSupportZoom(true); 

//Enable scaling controls (buttons) 
webSettings.setBuiltInZoomControls(true); 

//2 cache mode for WebView (web and WAP). Load no cache here. 
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); 

//Allow JavaScript to open new windows. (false by default) 
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); 

//Allow JavaScript to load the local cache. 
webSettings.setDomStorageEnabled(true); 

//WAP cache size (No need to manually set) 

//webSettings.setAppCacheMaxSize(1024 * 1024 * 8); 

//WAP cache path 
String absolutePath = getApplicationContext().getCacheDir().getAbsolutePath(); 

//WAP cache size 
webSettings.setAppCachePath(absolutePath); 

//Whether allow WebView to access files (true by default) 
webSettings.setAllowFileAccess(true); 

//Enable to save WAP cache 
webSettings.setAppCacheEnabled(true); 

//When using overview mode, if the the page width exceeds WebView dispaly, scale the page to adapt to the WebView (false by default) 
webSettings.setLoadWithOverviewMode(true); 

// support for the viewport HTML meta tag 
webSettings.setUseWideViewPort(true);
                    
                  

WeChat H5

To enable the callback to the Eximbay payment page within an app for WeChat H5 payment, it is necessary to include https://secureapi.eximbay.com as the referrer in the header for Android. Without the referrer, the payment page cannot be initiated within the WeChat app. Please refer to the sample code below for implementation.

                              
      mWebView.setWebViewClient(new WebViewClient() {
          @SuppressLint("LongLogTag")
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
              Log.d("LOG", "shouldOverrideUrlLoading url : " + url);
              Log.d("LOG", "URLUtil.isNetworkUrl(url) : " + URLUtil.isNetworkUrl(url) + ", URLUtil.isJavaScriptUrl(url) : " + URLUtil.isJavaScriptUrl(url));
              
              if (!URLUtil.isNetworkUrl(url) && !URLUtil.isJavaScriptUrl(url)) {
                  final Uri uri;
                  Intent intent = null;
                  try {
                        uri = Uri.parse(url);
                        intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
                      
                      } catch (Exception e) {
                          return false;
                      }
                      if ("weixin".equals(uri.getScheme())) {
                            try {
                                  Log.d("LOG", "weixin startActivity");
                                  intent = new Intent(Intent.ACTION_VIEW, uri);
                                  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                  // use startActivity function redirect to wallet app
                                  startActivity(intent);
                                  return true;
                                
                                } catch (ActivityNotFoundException e) {
                                  startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.tencent.mm")));
                                  return true;
                                
                                } catch (Exception e) {
                                  return false;
                                }
                        }
                  } else if (url.startsWith("https://wx.tenpay.com")) {
                      Map extraHeaders = new HashMap();
                      extraHeaders.put("Referer", "https://secureapi.eximbay.com");
                      view.loadUrl(url, extraHeaders);
                      return true;
                  } else {
                      view.loadUrl(url);
                      return false;
                  }
                    return false;
                     
              }
          });