delete method

Future<Response<RazorpayAccount>> delete({
  1. required String accountId,
  2. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayAccount>?
    )?,
})

Delete an account

@param accountId - The unique identifier of the account.

Implementation

Future<Response<RazorpayAccount>> delete({
  // Assuming returns account based on TS
  required String accountId,
  void Function(RazorpayApiException?, Response<RazorpayAccount>?)? callback,
}) async {
  if (accountId.isEmpty) {
    throw ArgumentError('accountId is required');
  }
  // Note: TS types suggest returning the account, JS is unclear. Using RazorpayAccount.
  // API might return empty body on success, adjust T if needed.
  return api.delete<RazorpayAccount>(
    {
      'version': 'v2',
      'url': '$BASE_URL/$accountId',
    },
    fromJsonFactory:
        RazorpayAccount.fromJson, // Adjust if response is different
    callback: callback,
  );
}