delete method

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

Delete a webhook (Only Partner context supported in JS?)

@param webhookId - The unique identifier of the webhook. @param accountId - The unique identifier of the partner account.

Implementation

Future<Response<RazorpayWebhookDeleteResponse>> delete({
  // JS returns [], use specific model
  required String webhookId,
  required String accountId, // Required for partner context
  void Function(
    RazorpayApiException?,
    Response<RazorpayWebhookDeleteResponse>?,
  )? callback,
}) async {
  if (webhookId.isEmpty) {
    throw ArgumentError('webhookId is required');
  }
  if (accountId.isEmpty) {
    throw ArgumentError(
      'accountId is required for deleting webhooks in partner context',
    );
  }
  return api.delete<RazorpayWebhookDeleteResponse>(
    {
      'version': 'v2',
      'url': '$BASE_URL/$accountId$WEBHOOKS_BASE/$webhookId',
    },
    fromJsonFactory: RazorpayWebhookDeleteResponse.fromJson,
    callback: callback,
  );
}