PayproPaypro
  • ๐Ÿ‡ฎ๐Ÿ‡ฉ Indonesia
  • ๐Ÿ‡ต๐Ÿ‡ฐ Pakistan
  • ๐Ÿ‡ป๐Ÿ‡ณ Vietnam
  • ๐Ÿ‡ต๐Ÿ‡ญ Philippines
  • ๐Ÿ‡ฐ๐Ÿ‡ช Kenya
  • ๐Ÿ‡ช๐Ÿ‡ฌ Egypt
  • ๐Ÿ‡ง๐Ÿ‡ท Brazil
  • ๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico
  • ๐Ÿ‡ฎ๐Ÿ‡ฉ Indonesia
  • ๐Ÿ‡ต๐Ÿ‡ฐ Pakistan
  • ๐Ÿ‡ป๐Ÿ‡ณ Vietnam
  • ๐Ÿ‡ต๐Ÿ‡ญ Philippines
  • ๐Ÿ‡ฐ๐Ÿ‡ช Kenya
  • ๐Ÿ‡ช๐Ÿ‡ฌ Egypt
  • ๐Ÿ‡ง๐Ÿ‡ท Brazil
  • ๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico
  • Kenya

    • Overview
    • Error Code
    • Payment API
    • Payment Casher
    • Payout API
    • Payment Query API
    • Payout Query API
    • Mpesa Query API
    • Payment Notify API
    • Balance Inquiry API

Payment Casher

    Tips

    • All requests are Post requests, and the data format is json
    Brief Description
    • None
    Request URL
    • /api/payinConsole
    Request Method
    • POST
    Header
    headerRequiredTypeDescription
    merchantNoYesstringNone
    Body
    ParameterRequiredTypeDescription
    signYesstringExcept for the sign field, all remaining fields should be sorted alphabetically by their first letter, combined into key1=value1key2=value2, and encrypted using the app secret as salt via MD5. The final sign value should be in lowercase.
    timestampYeslongTimestamp (1715941383720)
    amountYesstringAmount ๏ผˆThe minimum amount is recommended to be greater than KSH.50, and only integers are supported๏ผ‰
    remarkNostringRemark, this field will be returned as-is
    tradeNoYesstringTransaction number (uniqueness recommended: year, month, day, hour, minute, second + random number)
    notifyUrlYesstringAsynchronous callback URL
    Request Parameter Example
    {
      "sign": "000000",
      "timestamp": "1715941383720",
      "amount": "3",
      "remark": "000000",
      "tradeNo": "00000001",
      "notifyUrl": "https://google.com"
    }
    
    
    Response Result
    ParameterRequiredTypeDescription
    msgYesstringRequest result (when returning success, it only indicates that the request was successful and cannot be used for merchant-side logic judgment)
    codeYesstringRequest response code (when returning 0000, it only indicates that the request was successful and cannot be used for merchant-side logic judgment). For specific error codes, please refer to the business error code enumeration.
    timestampYesstringTransaction time
    successYesstringTransaction result
    dataYesObjectReturn object
    data.serialNumberYesstringResult ID returned by paypro, unique
    data.statusYesstringRequest result, merchants can use this for logic processing. When the result is 0000, it indicates a successful transaction; 0015 indicates processing; all other codes indicate errors and can be treated as failures.
    data.payUrlYesstringAggregate payment link
    data.remarkYesstringRequest return content (returned as-is)
    Successful Response Example
    {
        "msg": "success",
        "code": "0000",
        "timestamp": 1719829837779,
        "success": true,
        "data": {
            "serialNumber": "5286e98841194687a95d25b5f3be346d",
            "status": "0015",
    		"payUrl": "https://xxxxx.com/5286e98841194687a95d25b5f3be346d",
            "remark": ""
        }
    }
    
    

    Jump out of the subsequent logic of "webview"๏ผˆgoBackFlag=1๏ผ‰

    When the user completes the payment, the following interface appears at the paypro cash register: When the user clicks [GO BACK], the message will be pushed to the business party, who will need to handle it on their own.

    ParameterRequiredTypeDescription
    tradeNoYesstringTransaction Number
    resultYesstringRequest response code (when returning 0000, it only indicates that the request was successful and cannot be used for merchant-side logic judgment). For specific error codes, please refer to the business error code enumeration.
    {
        "tradeNo": "accc0000000001",
    	"result": "0000",
    }
    
    

    Processing of several environments (for reference only)

    • Android
    package com.example.myapplication;  
      
    import android.os.Bundle;  
    import android.webkit.JavascriptInterface;  
    import android.webkit.WebView;  
    import android.webkit.WebViewClient;  
      
    import androidx.appcompat.app.AppCompatActivity;  
      
    public class MainActivity extends AppCompatActivity {  
      
      
        private WebView webView;  
      
        @Override  
        protected void onCreate(Bundle savedInstanceState) {  
            super.onCreate(savedInstanceState);  
            setContentView(R.layout.activity\_main);  
      
            webView = findViewById(R.id.webView);  
            webView.getSettings().setJavaScriptEnabled(true);  
      
            // setup WebViewClient  
            webView.setWebViewClient(new WebViewClient() {  
                @Override  
                public void onPageFinished(WebView view, String url) {  
                    // inject JavaScript code  
                    webView.evaluateJavascript(  
                            "window.postMessage = function(message) { postMessageHandler.postMessage(message); };",  
                            null  
                    );  
                }  
            });  
      
            // add JavaScript interface  
            webView.addJavascriptInterface(new WebAppInterface(), "postMessageHandler");  
      
            // load URL  
            webView.loadUrl("http://192.168.50.244:3000/pay/abcd");  
        }  
      
        // JavaScript interface  
        public class WebAppInterface {  
            @JavascriptInterface  
            public void postMessage(String message) {  
                // receive JavaScript message  
                System.out.println("Received message from JavaScript: " \+ message);  
            }  
        }  
    }
    
    
    • IOS
    import SwiftUI  
    import WebKit  
    struct WebView: UIViewRepresentable {  
        let url: URL  
        let messageHandlerName: String  
      
        func makeUIView(context: Context) -> WKWebView {  
            // ้…็ฝฎ WebView        let webView = WKWebView()  
            webView.navigationDelegate = context.coordinator  
              
            let userContentController = WKUserContentController()  
            userContentController.add(context.coordinator, name: messageHandlerName)  
              
            let configuration = WKWebViewConfiguration()  
            configuration.userContentController = userContentController  
              
            // ๅˆ›ๅปบๅนถ่ฟ”ๅ›ž WKWebView        let webViewWithConfig = WKWebView(frame: .zero, configuration: configuration)  
            webViewWithConfig.navigationDelegate = context.coordinator  
            return webViewWithConfig  
        }  
      
        func updateUIView(\_ webView: WKWebView, context: Context) {  
            let request = URLRequest(url: url)  
            webView.load(request)  
        }  
      
        func makeCoordinator() -> Coordinator {  
            Coordinator(self)  
        }  
      
        class Coordinator: NSObject, WKNavigationDelegate, WKScriptMessageHandler {  
            var parent: WebView  
      
            init(\_ parent: WebView) {  
                self.parent = parent  
            }  
      
            func webView(\_ webView: WKWebView, didFinish navigation: WKNavigation!) {  
                // ๆณจๅ…ฅ JavaScript ไปฃ็   
                let js = """  
                window.postMessage = function(message) {                window.webkit.messageHandlers.\\(parent.messageHandlerName).postMessage(message);  
                };            """  
                webView.evaluateJavaScript(js, completionHandler: nil)  
            }  
      
            // ๆŽฅๆ”ถๆฅ่‡ช JavaScript ็š„ๆถˆๆฏ  
            func userContentController(\_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {  
                if message.name == parent.messageHandlerName {  
                    if let messageBody = message.body as? String {  
                        print("Received message from JavaScript: \\(messageBody)")  
                    }  
                }  
            }  
        }  
    }  
    struct ContentView: View {  
        var body: some View {  
            WebView(url: URL(string: "http://192.168.50.244:3000/test")!, messageHandlerName: "postMessageHandler")  
                .edgesIgnoringSafeArea(.all)  
        }  
    }
    
    • IFRAME
    <!DOCTYPE html\>  
    <html>  
    <head>  
        <title>Parent Page</title>  
    </head>  
    <body>  
        <h1>Parent Page</h1>  
        <iframe id\="childFrame" src\="http://example.com" style\="width: 100%; height: 300px;"\></iframe>  
        <button onclick\="sendMessageToChild()"\>Send Message to Child</button>  
      
        <script>        function sendMessageToChild() {  
                const childFrame = document.getElementById('childFrame').contentWindow;  
                childFrame.postMessage('Hello from Parent', '\*'); // '\*'        }  
      
              
            window.addEventListener('message', function(event) {  
                if (event.origin !== 'http://example.com') {   
                    return;  
                }  
                console.log('Message from child:', event.data);  
            });  
        </script>  
    </body>  
    </html>
    
    Last Updated:
    Contributors: wsc
    Prev
    Payment API
    Next
    Payout API