gotoPayment method

void gotoPayment(
  1. BuildContext buildContext
)

Implementation

void gotoPayment(BuildContext buildContext) {
  PaymentRequest paymentRequest = PaymentRequest();
  paymentRequest.razorPayKey = 'rzp_test_0C3jDAtSm7tfuZ';
  paymentRequest.amountToPay = 1;
  paymentRequest.userPhoneNo = '1111111111';
  paymentRequest.userName = 'test user';
  paymentRequest.myCompanyName = 'myOrg';
  paymentRequest.userEmail = 'test@gmail.com';
  Navigator.push(
      buildContext,
      MaterialPageRoute(
          builder: (_) => DoPayment(
                paymentRequest: paymentRequest,
              ))).then((response) {
    if (response != null) {
      PaymentResponse paymentResponse = PaymentResponse();
      paymentResponse = response;
      if (paymentResponse.isPaymentSuccess) {
        showDialog(
            context: buildContext,
            builder: (BuildContext context) {
              return const AlertDialog(
                content: Text('Payment Success'),
              );
            });
      } else {
        showDialog(
            context: buildContext,
            builder: (BuildContext context) {
              return const AlertDialog(
                content: Text('Payment Failed'),
              );
            });
      }
    }
  });
}