Webpay Payment Gateway Integration in Mobile Application
Webpay is a Belarusian payment gateway, one of the main ones for payments on Belarus market. Works with Belarusian rubles, supports Visa, Mastercard, Belkart cards and ERIP. No native mobile SDK — integration is implemented via WebView with payment form or via server API with tokenization.
Main Flow: WebView with Payment Form
Most common approach. Server forms POST request to Webpay, gets payment form URL, client opens it in WebView.
Request parameters:
POST https://payment.webpay.by/
wsb_storeid=your_store_id
&wsb_order_num=ORDER-1234
&wsb_currency_id=BYN
&wsb_version=2
&wsb_language_id=russian
&wsb_total=15.00
&wsb_return_url=yourapp://payment/success
&wsb_cancel_return_url=yourapp://payment/cancel
&wsb_notify_url=https://your-server.com/webpay/notify
&wsb_signature=md5_signature
Signature wsb_signature = MD5(wsb_seed + wsb_storeid + wsb_order_num + wsb_currency_id + wsb_total + wsb_include_service + secret_phrase).
// Android: open WebView
class PaymentWebViewActivity : AppCompatActivity() {
private lateinit var webView: WebView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
webView = WebView(this)
webView.settings.javaScriptEnabled = true
webView.settings.domStorageEnabled = true
webView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean {
val url = request.url.toString()
// Intercept deeplink return
if (url.startsWith("yourapp://payment/")) {
handlePaymentReturn(url)
return true
}
return false
}
}
// POST form via data URI
val postData = buildPostData()
webView.postUrl("https://payment.webpay.by/", postData.toByteArray())
}
private fun handlePaymentReturn(url: String) {
val uri = Uri.parse(url)
when (uri.host) {
"payment" -> when (uri.path) {
"/success" -> {
// Verify payment status on server
verifyPaymentStatus(uri.getQueryParameter("wsb_order_num"))
}
"/cancel" -> finish()
}
}
}
}
// iOS: WKWebView
import WebKit
class PaymentWebViewController: UIViewController, WKNavigationDelegate {
private var webView: WKWebView!
func loadPaymentForm(postParams: [String: String]) {
webView = WKWebView(frame: view.bounds)
webView.navigationDelegate = self
view.addSubview(webView)
var components = URLComponents(string: "https://payment.webpay.by/")!
components.queryItems = postParams.map { URLQueryItem(name: $0.key, value: $0.value) }
var request = URLRequest(url: URL(string: "https://payment.webpay.by/")!)
request.httpMethod = "POST"
request.httpBody = components.percentEncodedQuery?.data(using: .utf8)
webView.load(request)
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction,
decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if let url = navigationAction.request.url?.absoluteString,
url.hasPrefix("yourapp://payment/") {
handleReturn(url: url)
decisionHandler(.cancel)
return
}
decisionHandler(.allow)
}
}
Notification: wsb_notify_url
Webpay sends POST request to wsb_notify_url with transaction result. This is main confirmation mechanism — deeplink wsb_return_url is unreliable (user could close app).
Notification parameters include wsb_order_num, wsb_be_order_num (Webpay transaction ID), and wsb_result (0 = success, 1 = failure). Must verify notification signature:
MD5(wsb_seed + wsb_storeid + wsb_order_num + wsb_be_order_num + wsb_currency_id + wsb_total + secret_phrase)
Belkart: Special Notes
Belkart is processed same as Visa/Mastercard, but Webpay supports it only with appropriate contract with bank-acquirer. In test environment Belkart cards available via test credentials from Webpay documentation.
Work Scope
- Server generation of parameters and signature for Webpay
- WebView implementation with deeplink-return interception
- Server handler for
wsb_notify_urlwith signature verification - Testing in Webpay test environment
- Error and timeout scenario handling
Timeline
2–3 days. Cost calculated individually.







