doWebPayment method

void doWebPayment(
  1. dynamic arguments
)

WEB REDIRECTION

Implementation

void doWebPayment(dynamic arguments) {
  var window = html.window;
  var document = window.document;

  var session = arguments["session"] as dynamic;

  String environment = session["environment"] as String;
  String paymentSessionId = session["payment_session_id"] as String;

  var script = document.createElement("SCRIPT") as ScriptElement;
  if(environment == "SANDBOX") {
    script.src =
    "https://sdk.cashfree.com/js/flutter/2.0.0/cashfree.sandbox.js ";
  } else {
    script.src =
    "https://sdk.cashfree.com/js/flutter/2.0.0/cashfree.prod.js";
  }
  script.onLoad.first.then((value) {
    var c = Cashfree(paymentSessionId);
    c.redirect();
  });
  document.querySelector("body")?.children.add(script);
}