deleteOffer method

Future<Response<RazorpaySubscription>> deleteOffer({
  1. required String subscriptionId,
  2. required String offerId,
  3. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpaySubscription>?
    )?,
})

Delete an Offer Linked to a Subscription

@param subscriptionId - The unique identifier of the Subscription. @param offerId - The unique identifier of the offer to remove.

Implementation

Future<Response<RazorpaySubscription>> deleteOffer({
  // Assuming it returns the updated subscription
  required String subscriptionId,
  required String offerId,
  void Function(RazorpayApiException?, Response<RazorpaySubscription>?)?
      callback,
}) async {
  if (subscriptionId.isEmpty) {
    throw ArgumentError(MISSING_ID_ERROR);
  }
  if (offerId.isEmpty) {
    throw ArgumentError('offerId is mandatory');
  }
  final url =
      '$BASE_URL/$subscriptionId/$offerId'; // Check endpoint structure
  return api.delete<RazorpaySubscription>(
    // Assuming it returns updated subscription
    {'url': url},
    fromJsonFactory:
        RazorpaySubscription.fromJson, // Adjust if response is different
    callback: callback,
  );
}