Skip to content

Commit 20d0655

Browse files
Merge upstream and update generated code for v2442 and baff58c9d515cdd5f5c3231d101989d588788c6f
2 parents e29c632 + 0fe7205 commit 20d0655

359 files changed

Lines changed: 7174 additions & 295 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CODEGEN_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cd4bf5c733abad0866909d0fcb66d936b11a5fd9
1+
baff58c9d515cdd5f5c3231d101989d588788c6f

OPENAPI_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2393
1+
v2442

src/Examples/V2/EventNotificationHandlerEndpoint.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace Examples.V2
33
#pragma warning disable SA1101 // Prefix local calls with this
44

55
using System;
6+
using System.Collections.Generic;
67
using System.IO;
78
using System.Threading.Tasks;
89
using Microsoft.AspNetCore.Mvc;
@@ -16,6 +17,7 @@ namespace Examples.V2
1617
/// - write a fallback callback to handle unrecognized event notifications
1718
/// - create a StripeClient called client
1819
/// - Initialize an EventNotificationHandler with the client, webhook secret, and fallback callback
20+
/// - register a PreHandle callback that deduplicates events by id before any callback runs
1921
/// - register a specific handler for the "v1.billing.meter.no_meter_found" event notification type
2022
/// - use handler.handle() to process the received notification webhook body.
2123
/// </summary>
@@ -31,17 +33,38 @@ public class EventNotificationHandlerEndpoint : ControllerBase
3133
// this handler skips verification. Callbacks are registered separately from the one above.
3234
private readonly StripeEventNotificationHandlerWithoutVerification unverifiedHandler;
3335

36+
// Webhooks can be delivered more than once, so we track ids we've already
37+
// processed. In production, back this with something durable and shared
38+
// across processes (e.g. Redis or a database table) instead of an in-memory HashSet.
39+
private readonly HashSet<string> processedEventIds = new HashSet<string>();
40+
3441
public EventNotificationHandlerEndpoint()
3542
{
3643
client = new StripeClient(Environment.GetEnvironmentVariable("STRIPE_API_KEY"));
3744
handler = client.NotificationHandler(Environment.GetEnvironmentVariable("WEBHOOK_SECRET") ?? string.Empty, FallbackCallback);
3845
unverifiedHandler = client.NotificationHandlerWithoutVerification(FallbackCallback);
3946

40-
// register handlers
47+
// PreHandle runs after Handle parses the payload but before any callback fires.
48+
// Cancelling skips both the registered handler and the fallback for this event.
49+
handler.PreHandle += SkipAlreadyProcessedEvents;
50+
unverifiedHandler.PreHandle += SkipAlreadyProcessedEvents;
51+
52+
// can be anywhere in your codebase
4153
handler.V1BillingMeterErrorReportTriggered += HandleBillingMeterErrorReportTriggeredEventNotification;
4254
unverifiedHandler.V1BillingMeterErrorReportTriggered += HandleBillingMeterErrorReportTriggeredEventNotification;
4355
}
4456

57+
/// <summary>
58+
/// Runs before any registered callback. Setting <c>e.Cancel</c> here skips handling
59+
/// entirely for this delivery, which is useful for deduplicating webhooks.
60+
/// </summary>
61+
private void SkipAlreadyProcessedEvents(object sender, Stripe.StripePreHandleEventNotificationEventArgs e)
62+
{
63+
// HashSet<T>.Add returns false if the item was already present, so this both records
64+
// the event and tells us whether we've seen it before in a single call.
65+
e.Cancel = !processedEventIds.Add(e.EventNotification.Id);
66+
}
67+
4568
private void HandleBillingMeterErrorReportTriggeredEventNotification(object sender, Stripe.StripeEventNotificationEventArgs<Stripe.Events.V1BillingMeterErrorReportTriggeredEventNotification> e)
4669
{
4770
var meter = e.EventNotification.FetchRelatedObject();

src/Stripe.net/Constants/ApiVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace Stripe
33
{
44
internal class ApiVersion
55
{
6-
public const string Current = "2026-07-29.preview";
6+
public const string Current = "2026-08-26.preview";
77
public const string CurrentMajor = "";
88
}
99
}

src/Stripe.net/Entities/AccountSessions/AccountSessionComponents.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public class AccountSessionComponents : StripeEntity<AccountSessionComponents>
7676
[STJS.JsonPropertyName("payment_disputes")]
7777
public AccountSessionComponentsPaymentDisputes PaymentDisputes { get; set; }
7878

79+
[JsonProperty("payment_method_settings")]
80+
[STJS.JsonPropertyName("payment_method_settings")]
81+
public AccountSessionComponentsPaymentMethodSettings PaymentMethodSettings { get; set; }
82+
7983
[JsonProperty("payments")]
8084
[STJS.JsonPropertyName("payments")]
8185
public AccountSessionComponentsPayments Payments { get; set; }
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// File generated from our OpenAPI spec
2+
namespace Stripe
3+
{
4+
using Newtonsoft.Json;
5+
using Stripe.Infrastructure;
6+
using STJS = System.Text.Json.Serialization;
7+
8+
[STJS.JsonConverter(typeof(STJStripeEntityConverter))]
9+
public class AccountSessionComponentsPaymentMethodSettings : StripeEntity<AccountSessionComponentsPaymentMethodSettings>
10+
{
11+
/// <summary>
12+
/// Whether the embedded component is enabled.
13+
/// </summary>
14+
[JsonProperty("enabled")]
15+
[STJS.JsonPropertyName("enabled")]
16+
public bool Enabled { get; set; }
17+
18+
[JsonProperty("features")]
19+
[STJS.JsonPropertyName("features")]
20+
public AccountSessionComponentsPaymentMethodSettingsFeatures Features { get; set; }
21+
}
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// File generated from our OpenAPI spec
2+
namespace Stripe
3+
{
4+
using Newtonsoft.Json;
5+
using Stripe.Infrastructure;
6+
using STJS = System.Text.Json.Serialization;
7+
8+
[STJS.JsonConverter(typeof(STJStripeEntityConverter))]
9+
public class AccountSessionComponentsPaymentMethodSettingsFeatures : StripeEntity<AccountSessionComponentsPaymentMethodSettingsFeatures>
10+
{
11+
/// <summary>
12+
/// Whether Stripe user authentication is disabled. This value can only be <c>true</c> for
13+
/// accounts where <c>controller.requirement_collection</c> is <c>application</c> for the
14+
/// account. This is <c>false</c> by default.
15+
/// </summary>
16+
[JsonProperty("disable_stripe_user_authentication")]
17+
[STJS.JsonPropertyName("disable_stripe_user_authentication")]
18+
public bool DisableStripeUserAuthentication { get; set; }
19+
}
20+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// File generated from our OpenAPI spec
2+
namespace Stripe.Billing
3+
{
4+
using Newtonsoft.Json;
5+
using Stripe.Infrastructure;
6+
using STJS = System.Text.Json.Serialization;
7+
8+
/// <summary>
9+
/// A resource for the feedback options model (for custom cancellation reasons).
10+
/// </summary>
11+
[STJS.JsonConverter(typeof(STJStripeEntityConverter))]
12+
public class FeedbackOption : StripeEntity<FeedbackOption>, IHasId, IHasObject
13+
{
14+
/// <summary>
15+
/// Unique identifier for the object.
16+
/// </summary>
17+
[JsonProperty("id")]
18+
[STJS.JsonPropertyName("id")]
19+
public string Id { get; set; }
20+
21+
/// <summary>
22+
/// String representing the object's type. Objects of the same type share the same value.
23+
/// </summary>
24+
[JsonProperty("object")]
25+
[STJS.JsonPropertyName("object")]
26+
public string Object { get; set; }
27+
28+
/// <summary>
29+
/// An arbitrary string attached to the object. Often useful for displaying to users.
30+
/// </summary>
31+
[JsonProperty("description")]
32+
[STJS.JsonPropertyName("description")]
33+
public string Description { get; set; }
34+
35+
/// <summary>
36+
/// If the object exists in live mode, the value is <c>true</c>. If the object exists in
37+
/// test mode, the value is <c>false</c>.
38+
/// </summary>
39+
[JsonProperty("livemode")]
40+
[STJS.JsonPropertyName("livemode")]
41+
public bool Livemode { get; set; }
42+
43+
/// <summary>
44+
/// The feedback option's status.
45+
/// One of: <c>active</c>, or <c>inactive</c>.
46+
/// </summary>
47+
[JsonProperty("status")]
48+
[STJS.JsonPropertyName("status")]
49+
public string Status { get; set; }
50+
51+
[JsonProperty("status_transitions")]
52+
[STJS.JsonPropertyName("status_transitions")]
53+
public FeedbackOptionStatusTransitions StatusTransitions { get; set; }
54+
}
55+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// File generated from our OpenAPI spec
2+
namespace Stripe.Billing
3+
{
4+
using System;
5+
using Newtonsoft.Json;
6+
using Stripe.Infrastructure;
7+
using STJS = System.Text.Json.Serialization;
8+
9+
[STJS.JsonConverter(typeof(STJStripeEntityConverter))]
10+
public class FeedbackOptionStatusTransitions : StripeEntity<FeedbackOptionStatusTransitions>
11+
{
12+
/// <summary>
13+
/// The time the feedback option was deactivated, if any. Measured in seconds since Unix
14+
/// epoch.
15+
/// </summary>
16+
[JsonProperty("deactivated_at")]
17+
[JsonConverter(typeof(UnixDateTimeConverter))]
18+
[STJS.JsonPropertyName("deactivated_at")]
19+
[STJS.JsonConverter(typeof(STJUnixDateTimeConverter))]
20+
public DateTime? DeactivatedAt { get; set; }
21+
}
22+
}

src/Stripe.net/Entities/BillingPortal/Configurations/ConfigurationFeaturesSubscriptionCancelCancellationReason.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace Stripe.BillingPortal
33
{
44
using System.Collections.Generic;
5+
using System.Linq;
56
using Newtonsoft.Json;
67
using Stripe.Infrastructure;
78
using STJS = System.Text.Json.Serialization;
@@ -16,6 +17,39 @@ public class ConfigurationFeaturesSubscriptionCancelCancellationReason : StripeE
1617
[STJS.JsonPropertyName("enabled")]
1718
public bool Enabled { get; set; }
1819

20+
#region Expandable FeedbackOptions
21+
22+
/// <summary>
23+
/// (IDs of the FeedbackOptions)
24+
/// The IDs of custom feedback options configured for this cancellation reason.
25+
/// </summary>
26+
[JsonIgnore]
27+
[STJS.JsonIgnore]
28+
public List<string> FeedbackOptionIds
29+
{
30+
get => this.InternalFeedbackOptions?.Select((x) => x.Id).ToList();
31+
set => this.InternalFeedbackOptions = SetExpandableArrayIds<Billing.FeedbackOption>(value);
32+
}
33+
34+
/// <summary>
35+
/// (Expanded)
36+
/// The IDs of custom feedback options configured for this cancellation reason.
37+
///
38+
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
39+
/// </summary>
40+
[JsonIgnore]
41+
[STJS.JsonIgnore]
42+
public List<Billing.FeedbackOption> FeedbackOptions
43+
{
44+
get => this.InternalFeedbackOptions?.Select((x) => x.ExpandedObject).ToList();
45+
set => this.InternalFeedbackOptions = SetExpandableArrayObjects(value);
46+
}
47+
48+
[JsonProperty("feedback_options", ItemConverterType = typeof(ExpandableFieldConverter<Billing.FeedbackOption>))]
49+
[STJS.JsonPropertyName("feedback_options")]
50+
internal List<ExpandableField<Billing.FeedbackOption>> InternalFeedbackOptions { get; set; }
51+
#endregion
52+
1953
/// <summary>
2054
/// Which cancellation reasons will be given as options to the customer.
2155
/// One of: <c>customer_service</c>, <c>low_quality</c>, <c>missing_features</c>,

0 commit comments

Comments
 (0)