Reputation: 31
I am developing a Flutter mobile application with a payment Screen. I must use an internet payment gateway (provided by the bank's IPG page). After customer presses the PAYMENT button on the gateway web page, control must come back to the the Flutter App PaymentResultScreen. I call the bank URL using WebView. code on WebView:
static String testHtmlString = '''
<form action="https://www.mybank.com/eng/payments" method="post">
<input type="hidden" name="merchant_id" value="2481000974560100">
<input type="hidden" name="merchant_key" value="4sl4o153ihep1m7sdf6f0c5h781ad84j">
<input type="hidden" name="return_url" value="https://www.example.com/result">
<input type="hidden" name="cancel_url" value="https://www.example.com/cancel">
<input type="hidden" name="notify_url" value="https://www.example.com/notify">
<input type="hidden" name="amount" value="100.00">
<input type="hidden" name="item_name" value="Test Product">
<input type="submit" value="PAY NOW">
</form>
''';
Problem/s:
N.B Still new to flutter.
I have tired the html package
Upvotes: 1
Views: 85
Reputation: 4550
You can put any URL you want. Let's use what you have in your example (it does not matter if this URL exists since we will catch the request to go to it and do something else)
onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith('https://www.example.com/result')) {
Navigator.pushNamed(context, '/PaymentResultPage');
}
if (request.url.startsWith('https://www.example.com/cancel')) {
Navigator.pushNamed(context, '/PaymentCancelPage');
}
return NavigationDecision.navigate;
},
Upvotes: 0