Skip to content

Conversation

@xavdid-stripe
Copy link
Member

@xavdid-stripe xavdid-stripe commented Sep 25, 2025

Why?

As the stripe-context header is evolving, we want to give better tools for creating and managing contexts. This PR adds a new class, StripeContext. It can be used anywhere the context option is supplied and gets serialized to a string when making requests. It's also found on the EventNotification.context property.

What?

  • add StripeContext class
  • allow it to be supplied for RequestOptions.context; serialize it into strings
  • add tests

Changelog

  • Add the StripeContext class. Previously, you could set the stripe context only as a string via StripeClientBuilder .setStripeContext(). The same method can now take an instance of the StripeContext class as well
  • ⚠️ Change EventNotification (formerly known as ThinEvent)'s context property from string to StripeContext

@xavdid-stripe xavdid-stripe marked this pull request as ready for review September 25, 2025 07:42
@xavdid-stripe xavdid-stripe requested a review from a team as a code owner September 25, 2025 07:42
@xavdid-stripe xavdid-stripe requested review from mbroshi-stripe and removed request for a team September 25, 2025 07:42
@xavdid-stripe xavdid-stripe enabled auto-merge (squash) September 25, 2025 07:42
Copy link
Contributor

@mbroshi-stripe mbroshi-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall feedback is that I'd keep a single representation of StripeContext that does the right thing when it comes to serialization/deserialization rather than switching between object and string representations internally.

@xavdid-stripe
Copy link
Member Author

ok, should be all set!

Copy link
Contributor

@mbroshi-stripe mbroshi-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for incorporating the feedback!

@xavdid-stripe xavdid-stripe merged commit c8dc171 into master Sep 26, 2025
12 of 13 checks passed
@xavdid-stripe xavdid-stripe deleted the DEVSDK-2767-2 branch September 26, 2025 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants