deleteOffer method
Future<Response<RazorpaySubscription> >
deleteOffer({
- required String subscriptionId,
- required String offerId,
- void callback(
- RazorpayApiException?,
- 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,
);
}