fetch method

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

Fetches a customer given Customer ID

@param customerId - The unique identifier of the customer.

Implementation

Future<Response<RazorpayCustomer>> fetch({
  required String customerId,
  void Function(RazorpayApiException?, Response<RazorpayCustomer>?)? callback,
}) async {
  if (customerId.isEmpty) {
    throw ArgumentError('customerId is required');
  }
  return api.get<RazorpayCustomer>(
    {'url': '/customers/$customerId'},
    fromJsonFactory: RazorpayCustomer.fromJson,
    callback: callback,
  );
}