collectCardpayment method

Future<String> collectCardpayment(
  1. String url,
  2. Map<String, String>? cardPaymentRequest
)

Implementation

Future<String> collectCardpayment(
    String url, Map<String, String>? cardPaymentRequest) async {
  final response = await httpClient.post(Uri.parse(url),
      body: cardPaymentRequest,
      headers: {"Content-Type": "application/x-www-form-urlencoded"},
      encoding: Encoding.getByName("utf-8"));

  if (response.statusCode != 200) {
    throw Exception('error creating order');
  }
  final json = jsonDecode(response.body);
  if (kDebugMode) {
    print(json);
  }
  return response.body;
}