cancel method

Future<MolliePaymentResponse> cancel(
  1. String paymentId
)

Some payment methods are cancellable for an amount of time, usually until the next day. Or as long as the payment status is open. Payments may be canceled manually from the Dashboard, or automatically by using this endpoint. The isCancelable property on the Payment object will indicate if the payment can be canceled.

Implementation

Future<MolliePaymentResponse> cancel(String paymentId) async {
  var res = await http.delete(
    Uri.parse("$_apiEndpoint/$paymentId"),
    headers: _headers,
  );

  dynamic data = json.decode(res.body);

  return MolliePaymentResponse.build(data);
}