All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stripe.model.Discount Maven / Gradle / Ivy

There is a newer version: 28.1.0-beta.3
Show newest version
// File generated from our OpenAPI spec
package com.stripe.model;

import com.google.gson.annotations.SerializedName;
import com.stripe.net.ApiResource;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

/**
 * A discount represents the actual application of a coupon or promotion code. It contains information
 * about when the discount began, when it will end, and what it is applied to.
 *
 * 

Related guide: Applying * discounts to subscriptions */ @Getter @Setter @EqualsAndHashCode(callSuper = false) public class Discount extends StripeObject implements HasId { /** * The Checkout session that this coupon is applied to, if it is applied to a particular session * in payment mode. Will not be present for subscription mode. */ @SerializedName("checkout_session") String checkoutSession; /** * A coupon contains information about a percent-off or amount-off discount you might want to * apply to a customer. Coupons may be applied to subscriptions, invoices, checkout sessions, quotes, and more. Coupons do not work with * conventional one-off charges or payment intents. */ @SerializedName("coupon") Coupon coupon; /** The ID of the customer associated with this discount. */ @SerializedName("customer") @Getter(lombok.AccessLevel.NONE) @Setter(lombok.AccessLevel.NONE) ExpandableField customer; /** Always true for a deleted object. */ @SerializedName("deleted") Boolean deleted; /** * If the coupon has a duration of {@code repeating}, the date that this discount will end. If the * coupon has a duration of {@code once} or {@code forever}, this attribute will be null. */ @SerializedName("end") Long end; /** * The ID of the discount object. Discounts cannot be fetched by ID. Use {@code * expand[]=discounts} in API calls to expand discount IDs in an array. */ @Getter(onMethod_ = {@Override}) @SerializedName("id") String id; /** * The invoice that the discount's coupon was applied to, if it was applied directly to a * particular invoice. */ @SerializedName("invoice") String invoice; /** * The invoice item {@code id} (or invoice line item {@code id} for invoice line items of * type='subscription') that the discount's coupon was applied to, if it was applied directly to a * particular invoice item or invoice line item. */ @SerializedName("invoice_item") String invoiceItem; /** * String representing the object's type. Objects of the same type share the same value. * *

Equal to {@code discount}. */ @SerializedName("object") String object; /** The promotion code applied to create this discount. */ @SerializedName("promotion_code") @Getter(lombok.AccessLevel.NONE) @Setter(lombok.AccessLevel.NONE) ExpandableField promotionCode; /** Date that the coupon was applied. */ @SerializedName("start") Long start; /** * The subscription that this coupon is applied to, if it is applied to a particular subscription. */ @SerializedName("subscription") String subscription; /** * The subscription item that this coupon is applied to, if it is applied to a particular * subscription item. */ @SerializedName("subscription_item") String subscriptionItem; /** Get ID of expandable {@code customer} object. */ public String getCustomer() { return (this.customer != null) ? this.customer.getId() : null; } public void setCustomer(String id) { this.customer = ApiResource.setExpandableFieldId(id, this.customer); } /** Get expanded {@code customer}. */ public Customer getCustomerObject() { return (this.customer != null) ? this.customer.getExpanded() : null; } public void setCustomerObject(Customer expandableObject) { this.customer = new ExpandableField(expandableObject.getId(), expandableObject); } /** Get ID of expandable {@code promotionCode} object. */ public String getPromotionCode() { return (this.promotionCode != null) ? this.promotionCode.getId() : null; } public void setPromotionCode(String id) { this.promotionCode = ApiResource.setExpandableFieldId(id, this.promotionCode); } /** Get expanded {@code promotionCode}. */ public PromotionCode getPromotionCodeObject() { return (this.promotionCode != null) ? this.promotionCode.getExpanded() : null; } public void setPromotionCodeObject(PromotionCode expandableObject) { this.promotionCode = new ExpandableField(expandableObject.getId(), expandableObject); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy