Skip to content

Add Stripe-Request-Trigger header#2172

Draft
xavdid-stripe wants to merge 6 commits intomasterfrom
DEVSDK-3012
Draft

Add Stripe-Request-Trigger header#2172
xavdid-stripe wants to merge 6 commits intomasterfrom
DEVSDK-3012

Conversation

@xavdid-stripe
Copy link
Member

@xavdid-stripe xavdid-stripe commented Mar 5, 2026

Why?

We're working on surfacing more information to users around what their integration does when handling events. The first step of this is to tie subsequent API requests to the act of event processing. This PR adds a header to do just that.

What?

  • add prepare recipe to justfile to aid automation
  • generate Stripe-Request-Trigger header in event helpers
  • add builder methods
  • add tests

See Also

String clientId,
String idempotencyKey,
String stripeContext,
String stripeRequestTrigger,
Copy link
Member Author

Choose a reason for hiding this comment

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

it's flagging this (correctly, I think) as a breaking change because the signature has changed.

Is there a better way to roll this out or do we just wait for the major?

Copy link
Contributor

Choose a reason for hiding this comment

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

The good news is the next major is EOM. The bad news is this was poorly designed so there is no way to avoid it being breaking. Java objects with builders should always have a private constructor for exactly this reason (and because the ergonomics of multiple input String's in a row is 🤢 ). While you're making a breaking change anyway, I'd go ahead and recommend making this constructor private.

Copy link
Member Author

@xavdid-stripe xavdid-stripe Mar 5, 2026

Choose a reason for hiding this comment

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

Good news! RawRequestOptions supports supplying additionalHeaders. So we'll be able to make this change non-breakingly and then i'll leave a TODO + ticket to fix the public constructor for the major.

Copy link
Member Author

Choose a reason for hiding this comment

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

spoke too soon 🙈 RequestOptions' constructor is protected, so it has the same problem. We'll just hold this header out of java for now and add it in a week or two.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeesh, yeah protected is no good. We should update that to private too 😅

@xavdid-stripe xavdid-stripe marked this pull request as ready for review March 5, 2026 00:33
@xavdid-stripe xavdid-stripe requested a review from a team as a code owner March 5, 2026 00:33
@xavdid-stripe xavdid-stripe requested review from mbroshi-stripe and prathmesh-stripe and removed request for a team and prathmesh-stripe March 5, 2026 00:33
String clientId,
String idempotencyKey,
String stripeContext,
String stripeRequestTrigger,
Copy link
Contributor

Choose a reason for hiding this comment

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

The good news is the next major is EOM. The bad news is this was poorly designed so there is no way to avoid it being breaking. Java objects with builders should always have a private constructor for exactly this reason (and because the ergonomics of multiple input String's in a row is 🤢 ). While you're making a breaking change anyway, I'd go ahead and recommend making this constructor private.

@xavdid-stripe xavdid-stripe marked this pull request as draft March 5, 2026 21:34
@xavdid-stripe
Copy link
Member Author

Going to hold on this PR for ~ 2 weeks until we can make breaking changes. Work tracked in DEVSDK-3018

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.

2 participants