cancel method

Future<Response<RazorpayPaymentLink>> cancel({
  1. required String paymentLinkId,
  2. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayPaymentLink>?
    )?,
})

Cancel a payment link

@param paymentLinkId - The unique identifier of the paymentlink.

Implementation

Future<Response<RazorpayPaymentLink>> cancel({
  required String paymentLinkId,
  void Function(RazorpayApiException?, Response<RazorpayPaymentLink>?)?
      callback,
}) async {
  if (paymentLinkId.isEmpty) {
    throw ArgumentError(MISSING_ID_ERROR);
  }
  final url = '$BASE_URL/$paymentLinkId/cancel';
  return api.post<RazorpayPaymentLink>(
    {'url': url},
    fromJsonFactory: RazorpayPaymentLink.fromJson,
    callback: callback,
  );
}