getCardBin method

Future<Response> getCardBin(
  1. CFSession session,
  2. String bin
)

Implementation

Future<http.Response> getCardBin(CFSession session, String bin) async {
  var url = "api.cashfree.com";
  if(session.getEnvironmentEnum() == CFEnvironment.SANDBOX) {
    url = "sandbox.cashfree.com";
  }
  var uri = Uri.https(url, '/pg/sdk/js/${session.getPaymentSessionId()}/cardBin');
  var response = await http.post(uri, body: jsonEncode({
    "card_number": bin,
  }), headers: {
    "Content-Type": "application/json"
  });
  return response;
}