Skip to content

Adyen .net API Library v32.1.3

Choose a tag to compare

@galesky-a galesky-a released this 10 Feb 15:06
e216d5a

What's Changed

We've significantly improved how the Adyen .NET library handles enum values to ensure your applications remain stable when we add new enum values to our APIs.

Technical Implementation

  • Null Return Strategy: Unknown enum values now return null instead of throwing exceptions

Forward Compatibility

Before this release, if the API returned an enum value your SDK didn't recognize, your application would crash with a JsonSerializationException. Now:

  • Unknown valuesnull (application continues running)
  • Known values → Proper enum (existing behavior preserved)
  • Null valuesnull

📝 Example Scenario

// API returns new enum value "NewPaymentMethod" that your SDK version doesn't know about
var json = @"{ ""paymentMethod"": { ""type"": ""NewPaymentMethod"" } }";

// Before v32.1.3: Would throw JsonSerializationException
// After v32.1.3: Returns null, application continues
var paymentRequest = JsonOperation.Deserialize<PaymentRequest>(json);
// paymentRequest.PaymentMethod.Type will be null

🔍 What This Means for You

  • No Breaking Changes: Existing code continues to work unchanged
  • Resilient Applications: Your apps won't crash when we add new payment methods, risk profiles, or other enum values
  • Graceful Degradation: You can check for null values and implement fallback logic
  • Future-Proof: Upgrade to newer API versions without immediate SDK updates

💡 Best Practice

When working with nullable enum properties, add null checks:

if (paymentRequest.Channel != null)
{
    // Process known channel
    ProcessChannel(paymentRequest.Channel.Value);
}
else
{
    // Handle unknown or null channel
    LogUnknownChannel();
}

This enhancement ensures your integration remains stable as we continuously expand our API capabilities.

Other Changes 🖇️

Full Changelog: v32.1.2...v32.1.3