cancelPaymentIntent method
Implementation
@override
Future<Map> cancelPaymentIntent(String token, String paymentIntentId,
String? cancellationReason, String requestId) async {
final baseUrl = await getBaseUrl;
var url =
Uri.parse("$baseUrl/api/v1/pa/payment_intents/$paymentIntentId/cancel");
var bodyData = {
"cancellation_reason": cancellationReason ?? "No Reason Provided",
"request_id": requestId
};
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;
}