Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fca6e44
Update generated code for v2032 and
stripe-openapi[bot] Oct 2, 2025
35e04f5
Update generated code for v2034 and
stripe-openapi[bot] Oct 2, 2025
331208f
Update generated code for v2040 and
stripe-openapi[bot] Oct 6, 2025
c5dcb80
Update generated code for v2041 and
stripe-openapi[bot] Oct 6, 2025
90e5bd9
Improve event notification example (#2082)
xavdid-stripe Oct 6, 2025
39545b7
Merge upstream and update generated code for v2041 and
stripe-openapi[bot] Oct 6, 2025
2d7905d
Update generated code for v2042 and
stripe-openapi[bot] Oct 6, 2025
9d328db
Update generated code for v2042 and
stripe-openapi[bot] Oct 6, 2025
8a403ac
Update generated code for v2043 and
stripe-openapi[bot] Oct 7, 2025
977ea09
Update generated code for v2045 and
stripe-openapi[bot] Oct 7, 2025
e3817d8
Update generated code for v2046 and
stripe-openapi[bot] Oct 7, 2025
b90d427
Update generated code for v2048 and
stripe-openapi[bot] Oct 8, 2025
74080e8
Update generated code for v2049 and
stripe-openapi[bot] Oct 9, 2025
a32e9d1
Update generated code for v2051 and
stripe-openapi[bot] Oct 9, 2025
4cd5755
Update generated code for v2054 and
stripe-openapi[bot] Oct 9, 2025
5137f0c
Update generated code for v2055 and
stripe-openapi[bot] Oct 10, 2025
58e21fd
Update generated code for v2056 and
stripe-openapi[bot] Oct 10, 2025
b479cdc
Update generated code for v2057 and
stripe-openapi[bot] Oct 10, 2025
f94bd20
Update generated code for v2062 and
stripe-openapi[bot] Oct 13, 2025
6593711
Update generated code for v2065 and
stripe-openapi[bot] Oct 13, 2025
3eb6fee
Update generated code for v2066 and
stripe-openapi[bot] Oct 13, 2025
0e66b3e
Update generated code for v2073 and
stripe-openapi[bot] Oct 15, 2025
259c4d4
Update generated code for v2075 and
stripe-openapi[bot] Oct 15, 2025
707ed05
Update generated code for v2076 and
stripe-openapi[bot] Oct 16, 2025
37c5037
Update generated code for v2077 and
stripe-openapi[bot] Oct 16, 2025
56fdc00
Update generated code for v2082 and
stripe-openapi[bot] Oct 17, 2025
a39efc6
Update generated code for v2083 and
stripe-openapi[bot] Oct 17, 2025
8250aac
Update generated code for v2086 and
stripe-openapi[bot] Oct 17, 2025
6f5a34c
Update generated code for v2088 and
stripe-openapi[bot] Oct 18, 2025
0bbec98
Update generated code for v2091 and
stripe-openapi[bot] Oct 20, 2025
2d00fac
Update generated code for v2092 and
stripe-openapi[bot] Oct 21, 2025
7d3adaa
Update generated code for v2094 and
stripe-openapi[bot] Oct 22, 2025
f6a0c7f
Update generated code for v2095 and
stripe-openapi[bot] Oct 22, 2025
070277e
Update generated code for v2096 and
stripe-openapi[bot] Oct 22, 2025
56d5f49
Update generated code for v2099 and
stripe-openapi[bot] Oct 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion API_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0de52cdca31a7c51c6d11187fc88ab23ea3a1c5b
577fcb57736b925392ea563c0284df9002c75ac9
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2031
v2099

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,22 @@
import com.stripe.model.v2.core.Event.RelatedObject;
import com.stripe.model.v2.moneymanagement.Transaction;
import lombok.Getter;
import lombok.Setter;

@Getter
public final class V2MoneyManagementTransactionCreatedEvent extends Event {
/** Data for the v2.money_management.transaction.created event. */
@SerializedName("data")
V2MoneyManagementTransactionCreatedEvent.EventData data;

@Getter
@Setter
public static final class EventData {
/** Id of the v1 Transaction corresponding to this Transaction. */
@SerializedName("v1_id")
String v1Id;
}

@SerializedName("related_object")

/** Object containing the reference to API resource relevant to the event. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.stripe.events.V1BillingMeterErrorReportTriggeredEventNotification;
import com.stripe.exception.StripeException;
import com.stripe.model.billing.Meter;
import com.stripe.model.v2.core.Event;
import com.stripe.model.v2.core.EventNotification;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
Expand Down Expand Up @@ -67,33 +66,39 @@ public void handle(HttpExchange exchange) throws IOException {
String sigHeader = exchange.getRequestHeaders().getFirst("Stripe-Signature");

try {
EventNotification eventNotif =
EventNotification notif =
client.parseEventNotification(webhookBody, sigHeader, WEBHOOK_SECRET);

// determine what sort of event you have
if (eventNotif instanceof V1BillingMeterErrorReportTriggeredEventNotification) {
if (notif instanceof V1BillingMeterErrorReportTriggeredEventNotification) {
V1BillingMeterErrorReportTriggeredEventNotification eventNotification =
(V1BillingMeterErrorReportTriggeredEventNotification) eventNotif;
(V1BillingMeterErrorReportTriggeredEventNotification) notif;

// after casting, can fetch the related object (which is correctly typed)
Meter meter = eventNotification.fetchRelatedObject();
System.out.println(meter.getId());
// there's basic info about the related object in the notification
System.out.println(
"Meter w/ id " + eventNotification.getRelatedObject().getId() + " had a problem");

// or you can fetch the full object form the API for more details
Meter meter = eventNotification.fetchRelatedObject();
StringBuilder sb = new StringBuilder();
sb.append("Meter ")
.append(meter.getDisplayName())
.append(" (")
.append(meter.getId())
.append(") had a problem");
System.out.println(sb.toString());

// And you can always fetch the full event:
V1BillingMeterErrorReportTriggeredEvent event = eventNotification.fetchEvent();
System.out.println(event.getData().getDeveloperMessageSummary());

// add additional logic
}
// ... check other event types you know about
else if (eventNotif instanceof UnknownEventNotification) {
UnknownEventNotification unknownEvent = (UnknownEventNotification) eventNotif;
System.out.println("Received unknown event: " + unknownEvent.getId());
// can keep matching on the "type" field
// other helper methods still work, but you'll have to handle types yourself
System.out.println("More info: " + event.getData().getDeveloperMessageSummary());
} else if (notif instanceof UnknownEventNotification) {
// Events that were introduced after this SDK version release are
// represented as `UnknownEventNotification`s.
// They're valid, the SDK just doesn't have corresponding classes for them.
// You must match on the "type" property instead.
UnknownEventNotification unknownEvent = (UnknownEventNotification) notif;
if (unknownEvent.getType().equals("some.new.event")) {
Event event = unknownEvent.fetchEvent();
System.out.println(event.getReason());
// handle
// you can still `.fetchEvent()` and `.fetchRelatedObject()`, but the latter may
// return `null` if that event type doesn't have a related object.
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/** Error returned when user tries to cancel an OutboundPayment that was already canceled. */
public final class AlreadyCanceledException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/** The resource already exists. */
public final class AlreadyExistsException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/** Returned when the bank account cannot be added due to previous suspicious activity. */
public final class BlockedByStripeException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/**
* Returned when the PayoutMethodBankAccount object is controlled by the Stripe Dashboard, and
* cannot be archived.
*/
public final class ControlledByDashboardException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/** The user attempts to create an outbound flow from a closed Financial Account. */
public final class FeatureNotEnabledException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
public final class FinancialAccountNotOpenException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/**
* Error returned when the balance of provided financial account and balance type in the
* OutboundPayment/OutboundTransfer request does not have enough funds.
*/
public final class InsufficientFundsException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import com.stripe.net.StripeResponseGetter;
import lombok.Getter;

/** Information about the error that occurred. */
/**
* Returned in cases where the bank account provided is not valid (wrong format of account number or
* a routing number that does not correspond to a banking institution).
*/
public final class InvalidPaymentMethodException extends ApiException {
private static final long serialVersionUID = 2L;
@Getter String invalidParam;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/** Returned in cases where the ID provided doesn't correspond to a valid payout method. */
public final class InvalidPayoutMethodException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/** Error thrown if a user tries to close an account that has non-zero balances. */
public final class NonZeroBalanceException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/** Error returned when user tries to cancel an OutboundPayment that is not cancelable. */
public final class NotCancelableException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/** Returned when attempting to update an archived card. */
public final class QuotaExceededException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/**
* Error returned when the user enables notifications in the OutboundPayment request, but an email
* is not set up on the recipient account.
*/
public final class RecipientNotNotifiableException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.stripe.model.StripeObject;
import com.stripe.net.StripeResponseGetter;

/** Information about the error that occurred. */
/** The temporary session token has expired. */
public final class TemporarySessionExpiredException extends ApiException {
private static final long serialVersionUID = 2L;

Expand Down
Loading
Loading