midpay 1.1.7 copy "midpay: ^1.1.7" to clipboard
midpay: ^1.1.7 copied to clipboard

An unofficial midtrans payment plugin for flutter, Midtrans is one of the biggest payment gateway provider in indonesia

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();

  //test payment
  _testPayment() {
    //for android auto sandbox when debug and production when release
    midpay.init("CLIENT KEY", "BASE_URL", environment: Environment.sandbox);
    midpay.setFinishCallback(_callback);
    var midtransCustomer = MidtransCustomer(
        'Zaki', 'Mubarok', 'kakzaki@gmail.com', '085704703691');
    List<MidtransItem> listitems = [];
    var midtransItems = MidtransItem('IDXXX', 50000, 2, 'Charger');
    listitems.add(midtransItems);
    var midtransTransaction = MidtransTransaction(
        100000, midtransCustomer, listitems,
        skipCustomer: true);
    midpay
        .makePayment(midtransTransaction)
        .catchError((err) => print("ERROR $err"));
  }

  //calback
  Future<void> _callback(TransactionFinished finished) async {
    print("Finish $finished");
    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: ElevatedButton(
            child: Text("Payment"),
            onPressed: () => _testPayment(),
          ),
        ),
      ),
    );
  }
}
22
likes
150
points
314
downloads

Publisher

verified publisherkakzaki.dev

Weekly Downloads

An unofficial midtrans payment plugin for flutter, Midtrans is one of the biggest payment gateway provider in indonesia

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

CPL-1.0 (license)

Dependencies

flutter

More

Packages that depend on midpay