WebUPI is designed to allow web applications to interact seamlessly with UPI enabled applications. This guide is intended to help UPI providers implement the WebUPI API.
1. WebUPI.enable()
The first step in the implementation process is to establish a method to enable the WebUPI provider. This method should prompt the user for permission to use the WebUPI capabilities. After that, you are free to implement any of the other API methods.
Method
asyncfunctionenable():void;
Example
try {if(typeofwindow.webUPI !=='undefined') {awaitwindow.webUPI.enable(); }}catch(error) {// User denied permission or cancelledconsole.log(error);}
Join us in revolutionizing online payments with WebUPI!
2. WebUPI.sendPayment()
This method enables the user to send a payment. The web application provides a UPI URI for the payment.
interfaceSendPaymentArgs { upiUri:string; // the UPI URI you'd like the user to pay. callback_url?:string; // webhook url to send status response upon payment.}
All methods should throw an error when the operation cannot be completed. This allows applications to handle failures gracefully.
Please note that this is a high-level guide and specific implementation details may vary depending on the specific requirements of the UPI provider. Always refer to the official UPI documentation and ensure compliance with all relevant regulations and guidelines.