fetch method

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

Fetch an item given Item ID

@param itemId - The unique identifier of the item.

Implementation

Future<Response<RazorpayItem>> fetch({
  required String itemId,
  void Function(RazorpayApiException?, Response<RazorpayItem>?)? callback,
}) async {
  if (itemId.isEmpty) {
    throw ArgumentError('`item_id` is mandatory');
  }
  return api.get<RazorpayItem>(
    {'url': '/items/$itemId'},
    fromJsonFactory: RazorpayItem.fromJson,
    callback: callback,
  );
}