createCharge method
Future<Map>
createCharge(
- String token,
- String amount,
- String currencyCode,
- String reason,
- String reference,
- String requestId,
- String source,
override
Implementation
@override
Future<Map> createCharge(String token, String amount, String currencyCode,
String reason, String reference, String requestId, String source) async {
final String baseUrl = await getBaseUrl;
var url = Uri.parse("$baseUrl/api/v1/charges/create");
var bodyData = {
"amount": amount,
"currency": currencyCode,
"reason": reason,
"reference": reference,
"request_id": requestId,
"source": source
};
var jsonBody = jsonEncode(bodyData);
var response = await http.post(
url,
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer $token"
},
body: jsonBody,
);
var data = jsonDecode(response.body);
return data;
}