fetch method

Future<Response<RazorpayProduct>> fetch({
  1. required String accountId,
  2. required String productId,
  3. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayProduct>?
    )?,
})

Fetch a Product Configuration

@param accountId - The unique identifier of the account. @param productId - The unique identifier of a product.

Implementation

Future<Response<RazorpayProduct>> fetch({
  required String accountId,
  required String productId,
  void Function(RazorpayApiException?, Response<RazorpayProduct>?)? callback,
}) async {
  if (accountId.isEmpty) {
    throw ArgumentError('accountId is required');
  }
  if (productId.isEmpty) {
    throw ArgumentError('productId is required');
  }
  return api.get<RazorpayProduct>(
    {
      'version': 'v2',
      'url': '$BASE_URL/$accountId/products/$productId',
    },
    fromJsonFactory: RazorpayProduct.fromJson,
    callback: callback,
  );
}