How can I integrate a PayPal payment gateway in flutter framework. I tried with web view but not get success. What is the best way for it.
First I tried with access token and RSET API, but there is problem that no user login for payment. My code is below and this code run with Tryit Editor successfully
import 'package:flutter/material.dart';
import'package:flutter_webview_plugin/flutter_webview_plugin.dart';
class PayPalPayment extends StatefulWidget {
@override
_PayPalPaymentState createState() => _PayPalPaymentState();
}
class _PayPalPaymentState extends State<PayPalPayment> {
String test = "Test Charge";
int amount = 100;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: WebviewScaffold(
url: new Uri.dataFromString('''
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>
<body>
<script
src="https://www.paypal.com/sdk/js?client-id=SB_CLIENT_ID">
</script>
<script>paypal.Buttons().render('body');</script>
</body>
</html>
''', mimeType: 'text/html').toString(), ),
);
}
}
SB_CLIENT_ID = My client id