[英]Does anyone know how to create a paypal donate button using flutter?
我正在尝试使用 Flutter 创建一个具有 Paypal 捐赠按钮的应用程序,但 Paypal 只提供捐赠按钮的 html 代码,所以有人知道如何使用 Flutter 创建吗?
You could create your own button with a Container - decoration - radius
, a background color and so on (or just an image with a FlatButton
on top), but that is not recommended.您可以使用Container - decoration - radius
、背景颜色等(或只是顶部带有FlatButton
的图像)创建自己的按钮,但不建议这样做。 App Store Guidelines
prohibit any third party payment solutions. App Store Guidelines
禁止任何第三方支付解决方案。 So you could only use it in the Play Store with Android Apps.所以你只能在 Play 商店和 Android 应用程序中使用它。
Now what you can do is use In-App Purchases to handle such donations.现在您可以做的是使用应用内购买来处理此类捐赠。 There is an easy package here .有一个简单的包在这里。
Set everything like in the example and just call this to start a purchase flow:像示例中一样设置所有内容,然后调用它以启动购买流程:
List<IAPProduct> _productIds = [];
...
@override initState() {
super.initState();
init();
}
init() async {
IAPResponse response = await FlutterIap.fetchProducts(["com.example.testiap"]);
List<IAPProduct> productIds = response.products;
if (!mounted)
return;
setState(() {
_productIds = productIds;
});
}
Then call this, anywhere you like:然后在你喜欢的任何地方调用它:
FlutterIap.buy(_productIds.first.productIdentifier);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.