deleteAllowedPayer method

Future<Response<DeleteAllowedPayerResponse>> deleteAllowedPayer({
  1. required String virtualAccountId,
  2. required String allowedPayerId,
  3. void callback(
    1. RazorpayApiException?,
    2. Response<DeleteAllowedPayerResponse>?
    )?,
})

Delete an Allowed Payer Account (TPV)

@param virtualAccountId - The unique identifier of the virtual account @param allowedPayerId - The ID of the allowed payer entry to delete.

Implementation

Future<Response<DeleteAllowedPayerResponse>> deleteAllowedPayer({
  // Use specific empty model
  required String virtualAccountId,
  required String allowedPayerId,
  void Function(RazorpayApiException?, Response<DeleteAllowedPayerResponse>?)?
      callback,
}) async {
  if (virtualAccountId.isEmpty) {
    throw ArgumentError(ID_REQUIRED_MSG);
  }
  if (allowedPayerId.isEmpty) {
    throw ArgumentError('allowedPayerId is mandatory');
  }
  // JS API returns null, map to empty response model
  return api.delete<DeleteAllowedPayerResponse>(
    {'url': '$BASE_URL/$virtualAccountId/allowed_payers/$allowedPayerId'},
    fromJsonFactory: DeleteAllowedPayerResponse.fromJson,
    callback: callback,
  );
}