Create Transaction

All information for testing has been provided in your sandbox account. If you don't have an account yet, just quickly sign up here.

Testing Server:

https://sandbox.payway.com.kh/api/{merchant_api_name}/

Production Server:

https://payway.ababank.com/api/{merchant_api_name}/

Parameters:

Parameter NameTypeMandatoryDescription
tran_idstring[20]yesUnique tran_id (number and character only)
amount decimalYesformat (0.00)
items stringNoyesbase64_encode(json_encode(array item))
Example: item[x][name], item[x][quantity], item[x][price] - x is the item number, starting with 0 and increasing by one for each item that is added.
hashstringYesencrypt "merchant_id+tran_id+amount+items(optional), key" with hash_hmac sha512 after that convert the output using Base64. merchant_id and key - ABA Bank will be provided when client sign contract.
firstnamestringYes 
lastnamestringYes 
phone stringYes 
email stringYes 
return_url stringNobase64_encode(url) – push back notification url
continue_success_url stringNostring url – the URL Host has to be registered in Merchant profile. Otherwise, PayWay will reject the request.
return_params stringNostring or json string
phone_country_code stringNostring country code

Recommendation and Noticed:

  • The merchant has to validate the amount in server side, to ensure that it’s the correct amount, before sending a request to PayWay.
  • Testing API URL will skip 3D secure page.

Response JSON-object:

1. status (int)

Possible value:

Status CodeMessage
0Success (payment popup checkout form will display)
1Invalid hash
2Invalid tran_id
3Invalid amount
4Duplicate tran_id
11Other - server side error

2. description (string) - description of the status

Code Snippet:

public static final String ABA_HOST = "ababank.com";
public static final String ABA_SCHEME = "abamobilebank";

final WebView webView = (WebView) findViewById(R.id.webview);
WebSettings ws = webView.getSettings();
ws.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient(){

@Override
@TargetApi(26)
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {

final String url = request.getUrl().toString();
final String host = request.getUrl().getHost();
final String scheme = request.getUrl().getScheme();
if (isPaywayDeeplink(host, scheme)) {
     openDeeplink(url);
     return false;
}

view.loadUrl(url);
     return true;
}

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {

     final Uri uri = Uri.parse(url);
     final String host = uri.getHost();
     final String scheme = uri.getScheme();

     if (isPaywayDeeplink(host, scheme)) {
         openDeeplink(url);
         return false;
    }

     webView.loadUrl(url);
     return true;

}
});

private boolean isPaywayDeeplink(String host, String scheme) {
    return host.equalsIgnoreCase(ABA_HOST) && scheme.equalsIgnoreCase(ABA_SCHEME);
}

private void openDeeplink(String url){
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    startActivity(intent);
}

(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *) request navigationType:(UIWebViewNavigationType)navigationType {
   // your existing code
   // Determine if we want the system to handle it (Deeplink).
   NSURL *url = request.URL;
   if ([url.scheme.lowercaseString isEqualToString:@"abamobilebank"]) {
      if ([[UIApplication sharedApplication] canOpenURL:url]) {
          [[UIApplication sharedApplication] openURL:url];
          return NO;
      }
   }
   return YES;
}