fetch method

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

Fetches an order given Order ID

@param orderId - The unique identifier of the order

Implementation

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