Instamojo payment gateway in a flutter app

150 views Asked by At

So I'm trying to integrate instamojo payment gateway in a flutter app, I'm using instamojo package from pub.dev, payment initialization for test mode is working correctly but, now I want to integrate it in live mode but I'm unable to understand documentation.

I'm suceessfully able to generate OrderId, but passing order Id in

class InstamojoScreen extends StatefulWidget {
  final CreateOrderBody? body;
  final String? orderCreationUrl;
  final bool? isLive;
  final String name;
  final String orderId;

  const InstamojoScreen(
      {Key? key,
      this.body,
      this.orderCreationUrl,
      this.isLive = true,
      required this.name,
      required this.orderId})
      : super(key: key);

  @override
  _InstamojoScreenState createState() => _InstamojoScreenState();
}

class _InstamojoScreenState extends State<InstamojoScreen>
    implements InstamojoPaymentStatusListener {
  @override
  initState() {
    super.initState();
    print("init state");
  }

  @override
  Widget build(BuildContext context) {
    print('instamojo ${widget.orderId}');
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
    ]);
    return Scaffold(
      appBar: AppBar(
        title: const Text('Instamojo Flutter'),
      ),
      body: SafeArea(
        child: Instamojo(
          isConvenienceFeesApplied: false,
          listener: this,
          environment: Environment.PRODUCTION,
          apiCallType: ApiCallType.startPayment(orderId: widget.orderId),
          stylingDetails: StylingDetails(
            buttonStyle: ButtonStyling(
                buttonColor: Colors.amber,
                buttonTextStyle: const TextStyle(
                  color: Colors.black,
                )),
            listItemStyle: ListItemStyle(
                borderColor: Colors.grey,
                textStyle: const TextStyle(color: Colors.black, fontSize: 18),
                subTextStyle:
                    const TextStyle(color: Colors.grey, fontSize: 14)),
            loaderColor: Colors.amber,
            inputFieldTextStyle: InputFieldTextStyle(
                textStyle: const TextStyle(color: Colors.black, fontSize: 18),
                hintTextStyle:
                    const TextStyle(color: Colors.grey, fontSize: 14),
                labelTextStyle:
                    const TextStyle(color: Colors.grey, fontSize: 14)),
            alertStyle: AlertStyle(
              headingTextStyle:
                  const TextStyle(color: Colors.black, fontSize: 14),
              messageTextStyle:
                  const TextStyle(color: Colors.black, fontSize: 12),
              positiveButtonTextStyle:
                  const TextStyle(color: Colors.redAccent, fontSize: 10),
              negativeButtonTextStyle:
                  const TextStyle(color: Colors.amber, fontSize: 10),
            ),
          ),
        ),
      ),
    );
  }

  @override
  void paymentStatus({Map<String, String>? status}) {
    print("444444");
    print(status);
  }
}

results in ERROR "Failed to start payment" "longUrl" with orderId is opening correctly in web browsers but not in instamojo widget.

I want to make it work in test mode also

0

There are 0 answers