Skip to content

Failed to update session #1

@keanallen

Description

@keanallen

Failed to update session when making a payment in Live mode. But in test mode, it successfully process the payment.

 @override
  void initState() {
    super.initState();

    MFSDK.init(myFatoorahLiveToken, MFCountry.QATAR, MFEnvironment.LIVE);

    initiateSession();
  }


  void initiateSession() {

    MFSDK.initiateSession(null, (MFResult<MFInitiateSessionResponse> result) {

      if (result.isSuccess()) {
        // This for embedded payment view
        return mfPaymentCardView.load(result.response!);

      } else {

        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(content: Text("Failed session: ${result.error!.message}")),
          // result.error!.message = failed to update session
        );
 
      }
    });
  }



  void payWithEmbeddedPayment() {



    var request = MFExecutePaymentRequest.constructor(
      double.parse(widget.amount.toString()),
    );

    mfPaymentCardView.pay(request, MFAPILanguage.EN,
        (String invoiceId, MFResult<MFPaymentStatusResponse> result) {
      if (result.isSuccess()) {
        ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
            content:
                Text('Success!: The payment was confirmed successfully!')));

        setState(() {
        ...
        });
      } else {
   .....
      }
    });
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions