fetch method

Future<RazorpayPlan> fetch({
  1. required String planId,
})

Fetches a plan given Plan ID

@param planId - The unique identifier of the plan

Implementation

Future<RazorpayPlan> fetch({
  required String planId,
}) async {
  if (planId.isEmpty) {
    throw ArgumentError(MISSING_ID_ERROR);
  }
  final url = '$BASE_URL/$planId';
  return api.get<RazorpayPlan>(
    {'url': url},
    fromJsonFactory: RazorpayPlan.fromJson,
  ).then((response) => response.data!);
}