fetch method

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

Fetch a paymentLink given paymentLink ID

@param paymentLinkId - The unique identifier of the paymentlink.

Implementation

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