midpay 0.0.1-dev.1 copy "midpay: ^0.0.1-dev.1" to clipboard
midpay: ^0.0.1-dev.1 copied to clipboard

outdated

An unofficial midtrans payment plugin for flutter.

example/lib/main.dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:midpay/midpay.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final midpay = Midpay();
  @override
  void initState() {
    super.initState();
    midpay.init("SB-Mid-client-9Uuc57SxiDzsZstV", "https://market.dorun.id/public/",environment: Environment.sanbox);
    midpay.setFinishCallback(_callback);
  }

  _makePayment() {

    midpay
        .makePayment(
          MidtransTransaction(
              100000,
              MidtransCustomer(
                  "Zaki", "Mubarok", "kakzakis@gmail.com", "085704703691"),
              [
                MidtransItem(
                  "IDXXX",
                  50000,
                  2,
                  "Charger",
                )
              ],
              skipCustomer: true,
              customField1: "ANYCUSTOMFIELD"),
        )
        .catchError((err) => print("ERROR $err"));
  }

  Future<void> _callback(TransactionFinished finished) async {

    return Future.value(null);
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Midpay Plugin example app'),
        ),
        body: new Center(
          child: RaisedButton(
                  child: Text("Payment"),
                  onPressed: () => _makePayment(),
                ),
        ),
      ),
    );
  }
}
22
likes
0
pub points
94%
popularity

Publisher

verified publisherkakzaki.dev

An unofficial midtrans payment plugin for flutter.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on midpay