When getting error from API, it seems that response now contains nested object and SDK fails to serialize it:
An unhandled exception has occurred while executing the request.
System.ArgumentException: Sorry, something went wrong when trying to process the request. If this problem persists, contact us at support@chargebee.com.
type: internal_error,
http_status_code: 500,
error_code: internal_error,
content: {"message":"Subscription cannot be updated as we are not able to collect INR 29.00 from your card on file. Error message: (amount_too_small) Amount must convert to at least 50 cents. \u20b929.00 converts to approximately $0.35.","type":"payment","api_error_code":"payment_processing_failed","error_cause":{"id":"gateway.transaction_processing.amount_invalid","customer_message":"The authorized amount is set to zero, unreadable, or exceeds the allowable amount. Please verify the amount and format it correctly before attempting the transaction again.","merchant_message":"We were unable to process your transaction because the authorized amount is set to zero, unreadable, or exceeds the allowable amount. Please verify the amount and format it correctly before attempting the transaction again."},"error_code":"payment_error_during_update","error_msg":"Subscription cannot be updated as we are not able to collect INR 29.00 from your card on file. Error message: (amount_too_small) Amount must convert to at least 50 cents. \u20b929.00 converts to approximately $0.35.","http_status_code":400}
---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: {. Path 'error_cause', line 1, position 306.
at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at ChargeBee.Api.ApiUtil.HandleException(HttpResponseMessage response)
--- End of inner exception stack trace ---
at ChargeBee.Api.ApiUtil.HandleException(HttpResponseMessage response)
at ChargeBee.Api.ApiUtil.GetEntityResultAsync(String url, Params parameters, Dictionary`2 headers, ApiConfig env, HttpMethod meth, Boolean supportsFilter)
Steps to reproduce
Create subscription with plan_unit_price less than minimum allowed by payment gateway (e.g. 29 INR with Stripe)
Increase plan quantity by one with end_of_term==false
Update Subscription
Observe JsonReaderException trhown
Expected Behavior
PaymentException is thrown
Code Snippets (if applicable)
result = await ChargeBee.Models.Subscription.Update(subscription.ExternalSubscriptionId)
.AddUnitCount(newUnitCount)
.Prorate(true)
.EndOfTerm(false)
.RequestAsync();
Description of the Bug
When getting error from API, it seems that response now contains nested object and SDK fails to serialize it:
Steps to reproduce
plan_unit_price
less than minimum allowed by payment gateway (e.g. 29 INR with Stripe)end_of_term==false
Expected Behavior
PaymentException is thrown
Code Snippets (if applicable)
Operating System
Windows 11
Language version
.NET 8.0
Library version
v3.24.0
Additional context
No response