initializePayment method
Executes network call to initiate transactions
Implementation
Future<InitPaymentResponse?> initializePayment(publicKey) async {
InitPaymentResponse? initPaymentResponse = InitPaymentResponse();
final url = "${Utils.getBaseUrl(isTest)}/${Utils.initializePayment}";
final response = await http.post(Uri.parse(url),
headers: {
"Authorization" : "Bearer $publicKey",
"Content-Type" : "application/json"
},
body: toString()
);
final responseBody = jsonDecode(response.body);
initPaymentResponse = InitPaymentResponse.fromJson(responseBody);
return initPaymentResponse;
}