Flutter Razorpay 插件

用于在 Android 和 iOS 上集成 Razorpay 的 Flutter 插件。

安装

在 pubspec.yaml 中添加此内容

  razorpay_plugin: ^0.0.2

使用方法

import 'package:razorpay_plugin/razorpay_plugin.dart';
  startPayment() async {
    Map<String, dynamic> options = new Map();
    options.putIfAbsent("name", () => "Razorpay T-Shirt");
    options.putIfAbsent("image", () => "https://www.73lines.com/web/image/12427");
    options.putIfAbsent("description", () => "This is a real transaction");
    options.putIfAbsent("amount", () => "100");
    options.putIfAbsent("email", () => "[email protected]");
    options.putIfAbsent("contact", () => "9988776655");
    //Must be a valid HTML color.
    options.putIfAbsent("theme", () => "#FF0000");
    options.putIfAbsent("api_key", () => "API_KEY_HERE");
    Map<dynamic,dynamic> paymentResponse = new Map();
    paymentResponse = await Razorpay.showPaymentForm(options);
    print("response $paymentResponse");
  }

响应

 {"code": 0, "message": "payment cancelled by user"}

或者

 {"code": 1, "message": "rpz_asdw23axd223s"}

如果支付成功,消息将包含来自 razorpay 的 payment_id。

演示应用

GitHub

https://github.com/dynamitechetan/razorpay_flutter