Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2023
v2026
20 changes: 19 additions & 1 deletion src/main/java/com/stripe/model/Invoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -2319,6 +2319,10 @@ public void setAccountObject(Account expandableObject) {
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Parent extends StripeObject {
/** Details about the billing cadence that generated this invoice. */
@SerializedName("billing_cadence_details")
BillingCadenceDetails billingCadenceDetails;

/** Details about the quote that generated this invoice. */
@SerializedName("quote_details")
QuoteDetails quoteDetails;
Expand All @@ -2330,11 +2334,25 @@ public static class Parent extends StripeObject {
/**
* The type of parent that generated this invoice
*
* <p>One of {@code quote_details}, or {@code subscription_details}.
* <p>One of {@code billing_cadence_details}, {@code quote_details}, or {@code
* subscription_details}.
*/
@SerializedName("type")
String type;

/**
* For more details about BillingCadenceDetails, please refer to the <a
* href="https://docs.stripe.com/api">API Reference.</a>
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class BillingCadenceDetails extends StripeObject {
/** The billing cadence that generated this invoice. */
@SerializedName("billing_cadence")
String billingCadence;
}

/**
* For more details about QuoteDetails, please refer to the <a
* href="https://docs.stripe.com/api">API Reference.</a>
Expand Down
20 changes: 19 additions & 1 deletion src/main/java/com/stripe/model/QuotePreviewInvoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,10 @@ public void setAccountObject(Account expandableObject) {
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Parent extends StripeObject {
/** Details about the billing cadence that generated this invoice. */
@SerializedName("billing_cadence_details")
BillingCadenceDetails billingCadenceDetails;

/** Details about the quote that generated this invoice. */
@SerializedName("quote_details")
QuoteDetails quoteDetails;
Expand All @@ -1198,11 +1202,25 @@ public static class Parent extends StripeObject {
/**
* The type of parent that generated this invoice
*
* <p>One of {@code quote_details}, or {@code subscription_details}.
* <p>One of {@code billing_cadence_details}, {@code quote_details}, or {@code
* subscription_details}.
*/
@SerializedName("type")
String type;

/**
* For more details about BillingCadenceDetails, please refer to the <a
* href="https://docs.stripe.com/api">API Reference.</a>
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class BillingCadenceDetails extends StripeObject {
/** The billing cadence that generated this invoice. */
@SerializedName("billing_cadence")
String billingCadence;
}

/**
* For more details about QuoteDetails, please refer to the <a
* href="https://docs.stripe.com/api">API Reference.</a>
Expand Down
62 changes: 62 additions & 0 deletions src/main/java/com/stripe/model/Subscription.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.stripe.net.BaseAddress;
import com.stripe.net.RequestOptions;
import com.stripe.net.StripeResponseGetter;
import com.stripe.param.SubscriptionAttachCadenceParams;
import com.stripe.param.SubscriptionCancelParams;
import com.stripe.param.SubscriptionCreateParams;
import com.stripe.param.SubscriptionListParams;
Expand Down Expand Up @@ -53,6 +54,15 @@ public class Subscription extends ApiResource implements HasId, MetadataStore<Su
@SerializedName("automatic_tax")
AutomaticTax automaticTax;

/**
* The Billing Cadence which controls the timing of recurring invoice generation for this
* subscription.If unset, the subscription will bill according to its own configured schedule and
* create its own invoices.If set, this subscription will be billed by the cadence instead,
* potentially sharing invoices with the other subscriptions linked to that Cadence.
*/
@SerializedName("billing_cadence")
String billingCadence;

/**
* The reference point that aligns future <a
* href="https://stripe.com/docs/subscriptions/billing-cycle">billing cycle</a> dates. It sets the
Expand Down Expand Up @@ -593,6 +603,58 @@ public void setDiscountObjects(List<Discount> objs) {
: null;
}

/**
* Attach a Billing Cadence to an existing subscription. When attached, the subscription is billed
* by the Billing Cadence, potentially sharing invoices with the other subscriptions linked to the
* Billing Cadence.
*/
public Subscription attachCadence(Map<String, Object> params) throws StripeException {
return attachCadence(params, (RequestOptions) null);
}

/**
* Attach a Billing Cadence to an existing subscription. When attached, the subscription is billed
* by the Billing Cadence, potentially sharing invoices with the other subscriptions linked to the
* Billing Cadence.
*/
public Subscription attachCadence(Map<String, Object> params, RequestOptions options)
throws StripeException {
String path =
String.format("/v1/subscriptions/%s/attach_cadence", ApiResource.urlEncodeId(this.getId()));
ApiRequest request =
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
return getResponseGetter().request(request, Subscription.class);
}

/**
* Attach a Billing Cadence to an existing subscription. When attached, the subscription is billed
* by the Billing Cadence, potentially sharing invoices with the other subscriptions linked to the
* Billing Cadence.
*/
public Subscription attachCadence(SubscriptionAttachCadenceParams params) throws StripeException {
return attachCadence(params, (RequestOptions) null);
}

/**
* Attach a Billing Cadence to an existing subscription. When attached, the subscription is billed
* by the Billing Cadence, potentially sharing invoices with the other subscriptions linked to the
* Billing Cadence.
*/
public Subscription attachCadence(SubscriptionAttachCadenceParams params, RequestOptions options)
throws StripeException {
String path =
String.format("/v1/subscriptions/%s/attach_cadence", ApiResource.urlEncodeId(this.getId()));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options);
return getResponseGetter().request(request, Subscription.class);
}

/**
* Cancels a customer’s subscription immediately. The customer won’t be charged again for the
* subscription. After it’s canceled, you can no longer update the subscription or its <a
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public class InvoiceCreatePreviewParams extends ApiRequestParams {
@SerializedName("automatic_tax")
AutomaticTax automaticTax;

/**
* The identifier of the billing cadence for which you’d like to retrieve the upcoming
* invoice.Cannot be provided when {@code subscription}, {@code schedule}, {@code
* subscription_details} or {@code schedule_details} are provided.
*/
@SerializedName("billing_cadence")
String billingCadence;

/**
* The currency to preview this invoice in. Defaults to that of {@code customer} if not specified.
*/
Expand Down Expand Up @@ -131,6 +139,7 @@ public class InvoiceCreatePreviewParams extends ApiRequestParams {

private InvoiceCreatePreviewParams(
AutomaticTax automaticTax,
String billingCadence,
String currency,
String customer,
String customerAccount,
Expand All @@ -147,6 +156,7 @@ private InvoiceCreatePreviewParams(
String subscription,
SubscriptionDetails subscriptionDetails) {
this.automaticTax = automaticTax;
this.billingCadence = billingCadence;
this.currency = currency;
this.customer = customer;
this.customerAccount = customerAccount;
Expand All @@ -171,6 +181,8 @@ public static Builder builder() {
public static class Builder {
private AutomaticTax automaticTax;

private String billingCadence;

private String currency;

private String customer;
Expand Down Expand Up @@ -205,6 +217,7 @@ public static class Builder {
public InvoiceCreatePreviewParams build() {
return new InvoiceCreatePreviewParams(
this.automaticTax,
this.billingCadence,
this.currency,
this.customer,
this.customerAccount,
Expand All @@ -228,6 +241,16 @@ public Builder setAutomaticTax(InvoiceCreatePreviewParams.AutomaticTax automatic
return this;
}

/**
* The identifier of the billing cadence for which you’d like to retrieve the upcoming
* invoice.Cannot be provided when {@code subscription}, {@code schedule}, {@code
* subscription_details} or {@code schedule_details} are provided.
*/
public Builder setBillingCadence(String billingCadence) {
this.billingCadence = billingCadence;
return this;
}

/**
* The currency to preview this invoice in. Defaults to that of {@code customer} if not
* specified.
Expand Down
127 changes: 127 additions & 0 deletions src/main/java/com/stripe/param/SubscriptionAttachCadenceParams.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// File generated from our OpenAPI spec
package com.stripe.param;

import com.google.gson.annotations.SerializedName;
import com.stripe.net.ApiRequestParams;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;

@Getter
@EqualsAndHashCode(callSuper = false)
public class SubscriptionAttachCadenceParams extends ApiRequestParams {
/**
* <strong>Required.</strong> The Billing Cadence which controls the timing of recurring invoice
* generation for this subscription. If unset, the subscription will bill according to its own
* configured schedule and create its own invoices. If set, this subscription will be billed by
* the cadence instead, potentially sharing invoices with the other subscriptions linked to that
* Cadence.
*/
@SerializedName("billing_cadence")
String billingCadence;

/** Specifies which fields in the response should be expanded. */
@SerializedName("expand")
List<String> expand;

/**
* Map of extra parameters for custom features not available in this client library. The content
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
* param object. Effectively, this map is flattened to its parent instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map<String, Object> extraParams;

private SubscriptionAttachCadenceParams(
String billingCadence, List<String> expand, Map<String, Object> extraParams) {
this.billingCadence = billingCadence;
this.expand = expand;
this.extraParams = extraParams;
}

public static Builder builder() {
return new Builder();
}

public static class Builder {
private String billingCadence;

private List<String> expand;

private Map<String, Object> extraParams;

/** Finalize and obtain parameter instance from this builder. */
public SubscriptionAttachCadenceParams build() {
return new SubscriptionAttachCadenceParams(
this.billingCadence, this.expand, this.extraParams);
}

/**
* <strong>Required.</strong> The Billing Cadence which controls the timing of recurring invoice
* generation for this subscription. If unset, the subscription will bill according to its own
* configured schedule and create its own invoices. If set, this subscription will be billed by
* the cadence instead, potentially sharing invoices with the other subscriptions linked to that
* Cadence.
*/
public Builder setBillingCadence(String billingCadence) {
this.billingCadence = billingCadence;
return this;
}

/**
* Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* SubscriptionAttachCadenceParams#expand} for the field documentation.
*/
public Builder addExpand(String element) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.add(element);
return this;
}

/**
* Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* SubscriptionAttachCadenceParams#expand} for the field documentation.
*/
public Builder addAllExpand(List<String> elements) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.addAll(elements);
return this;
}

/**
* Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
* call, and subsequent calls add additional key/value pairs to the original map. See {@link
* SubscriptionAttachCadenceParams#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}

/**
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
* See {@link SubscriptionAttachCadenceParams#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map<String, Object> map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
}
}
Loading