getStatus method

Future<String> getStatus({
  1. required String uid,
  2. required String statusIndicator,
})

Provides the status of a specific payment by using uid and statusIndicator acquired when starting or completing the payment.

Implementation

Future<String> getStatus({required String uid, required String statusIndicator}) async {
  final Map<String, dynamic> requestData = {
    "uid": uid,
    "statusIndicator": statusIndicator
  };
  String endpoint = "${getEndpoint(environment)}/check-status";
  String json = jsonEncode(requestData);
  log("Sending request: $json");

  // Make request
  final response = await http.post(
    Uri.parse(endpoint),
    headers: <String, String>{
      'Content-Type': 'application/json',
    },
    body: json,
  );

  // Get response
  log("Response: ${response.body}");
  return response.body;
}