Class Order

All Implemented Interfaces:
HasId, MetadataStore<Order>, StripeObjectInterface

public class Order extends ApiResource implements HasId, MetadataStore<Order>
An Order describes a purchase being made by a customer, including the products & quantities being purchased, the order status, the payment information, and the billing/shipping details.

Related guide: Orders overview

  • Constructor Details

    • Order

      public Order()
  • Method Details

    • getApplication

      public String getApplication()
      Get ID of expandable application object.
    • setApplication

      public void setApplication(String id)
    • getApplicationObject

      public Application getApplicationObject()
      Get expanded application.
    • setApplicationObject

      public void setApplicationObject(Application expandableObject)
    • getCustomer

      public String getCustomer()
      Get ID of expandable customer object.
    • setCustomer

      public void setCustomer(String id)
    • getCustomerObject

      public Customer getCustomerObject()
      Get expanded customer.
    • setCustomerObject

      public void setCustomerObject(Customer expandableObject)
    • getDiscounts

      public List<String> getDiscounts()
      Get IDs of expandable discounts object list.
    • setDiscounts

      public void setDiscounts(List<String> ids)
    • getDiscountObjects

      public List<Discount> getDiscountObjects()
      Get expanded discounts.
    • setDiscountObjects

      public void setDiscountObjects(List<Discount> objs)
    • cancel

      public Order cancel() throws StripeException
      Cancels the order as well as the payment intent if one is attached.
      Throws:
      StripeException
    • cancel

      public Order cancel(RequestOptions options) throws StripeException
      Cancels the order as well as the payment intent if one is attached.
      Throws:
      StripeException
    • cancel

      public Order cancel(Map<String,Object> params) throws StripeException
      Cancels the order as well as the payment intent if one is attached.
      Throws:
      StripeException
    • cancel

      public Order cancel(Map<String,Object> params, RequestOptions options) throws StripeException
      Cancels the order as well as the payment intent if one is attached.
      Throws:
      StripeException
    • cancel

      public Order cancel(OrderCancelParams params) throws StripeException
      Cancels the order as well as the payment intent if one is attached.
      Throws:
      StripeException
    • cancel

      public Order cancel(OrderCancelParams params, RequestOptions options) throws StripeException
      Cancels the order as well as the payment intent if one is attached.
      Throws:
      StripeException
    • create

      public static Order create(Map<String,Object> params) throws StripeException
      Creates a new open order object.
      Throws:
      StripeException
    • create

      public static Order create(Map<String,Object> params, RequestOptions options) throws StripeException
      Creates a new open order object.
      Throws:
      StripeException
    • create

      public static Order create(OrderCreateParams params) throws StripeException
      Creates a new open order object.
      Throws:
      StripeException
    • create

      public static Order create(OrderCreateParams params, RequestOptions options) throws StripeException
      Creates a new open order object.
      Throws:
      StripeException
    • list

      public static OrderCollection list(Map<String,Object> params) throws StripeException
      Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
      Throws:
      StripeException
    • list

      public static OrderCollection list(Map<String,Object> params, RequestOptions options) throws StripeException
      Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
      Throws:
      StripeException
    • list

      public static OrderCollection list(OrderListParams params) throws StripeException
      Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
      Throws:
      StripeException
    • list

      public static OrderCollection list(OrderListParams params, RequestOptions options) throws StripeException
      Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems() throws StripeException
      When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems(Map<String,Object> params) throws StripeException
      When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems(Map<String,Object> params, RequestOptions options) throws StripeException
      When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems(OrderListLineItemsParams params) throws StripeException
      When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • listLineItems

      public LineItemCollection listLineItems(OrderListLineItemsParams params, RequestOptions options) throws StripeException
      When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
      Throws:
      StripeException
    • reopen

      public Order reopen() throws StripeException
      Reopens a submitted order.
      Throws:
      StripeException
    • reopen

      public Order reopen(RequestOptions options) throws StripeException
      Reopens a submitted order.
      Throws:
      StripeException
    • reopen

      public Order reopen(Map<String,Object> params) throws StripeException
      Reopens a submitted order.
      Throws:
      StripeException
    • reopen

      public Order reopen(Map<String,Object> params, RequestOptions options) throws StripeException
      Reopens a submitted order.
      Throws:
      StripeException
    • reopen

      public Order reopen(OrderReopenParams params) throws StripeException
      Reopens a submitted order.
      Throws:
      StripeException
    • reopen

      public Order reopen(OrderReopenParams params, RequestOptions options) throws StripeException
      Reopens a submitted order.
      Throws:
      StripeException
    • retrieve

      public static Order retrieve(String id) throws StripeException
      Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information.
      Throws:
      StripeException
    • retrieve

      public static Order retrieve(String id, RequestOptions options) throws StripeException
      Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information.
      Throws:
      StripeException
    • retrieve

      public static Order retrieve(String id, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information.
      Throws:
      StripeException
    • retrieve

      public static Order retrieve(String id, OrderRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, and Stripe will return the corresponding order information.
      Throws:
      StripeException
    • submit

      public Order submit(Map<String,Object> params) throws StripeException
      Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the reopen method is called.
      Throws:
      StripeException
    • submit

      public Order submit(Map<String,Object> params, RequestOptions options) throws StripeException
      Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the reopen method is called.
      Throws:
      StripeException
    • submit

      public Order submit(OrderSubmitParams params) throws StripeException
      Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the reopen method is called.
      Throws:
      StripeException
    • submit

      public Order submit(OrderSubmitParams params, RequestOptions options) throws StripeException
      Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the reopen method is called.
      Throws:
      StripeException
    • update

      public Order update(Map<String,Object> params) throws StripeException
      Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Specified by:
      update in interface MetadataStore<Order>
      Throws:
      StripeException
    • update

      public Order update(Map<String,Object> params, RequestOptions options) throws StripeException
      Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Specified by:
      update in interface MetadataStore<Order>
      Throws:
      StripeException
    • update

      public Order update(OrderUpdateParams params) throws StripeException
      Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Throws:
      StripeException
    • update

      public Order update(OrderUpdateParams params, RequestOptions options) throws StripeException
      Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Throws:
      StripeException
    • getAmountRemaining

      public Long getAmountRemaining()
    • getAmountSubtotal

      public Long getAmountSubtotal()
      Order cost before any discounts or taxes are applied. A positive integer representing the subtotal of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency).
    • getAmountTotal

      public Long getAmountTotal()
      Total order cost after discounts and taxes are applied. A positive integer representing the cost of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). To submit an order, the total must be either 0 or at least $0.50 USD or equivalent in charge currency.
    • getAutomaticTax

      public Order.AutomaticTax getAutomaticTax()
    • getBillingDetails

      public Order.BillingDetails getBillingDetails()
      Customer billing details associated with the order.
    • getClientSecret

      public String getClientSecret()
      The client secret of this Order. Used for client-side retrieval using a publishable key.

      The client secret can be used to complete a payment for an Order from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.

      Refer to our docs for creating and processing an order to learn about how client_secret should be handled.

    • getCreated

      public Long getCreated()
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • getCredits

      public List<Order.Credit> getCredits()
      The credits applied to the Order. At most 10 credits can be applied to an Order.
    • getCurrency

      public String getCurrency()
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • getDescription

      public String getDescription()
      An arbitrary string attached to the object. Often useful for displaying to users.
    • getIpAddress

      public String getIpAddress()
      A recent IP address of the purchaser used for tax reporting and tax location inference.
    • getLineItems

      public LineItemCollection getLineItems()
      A list of line items the customer is ordering. Each line item includes information about the product, the quantity, and the resulting cost. There is a maximum of 100 line items.
    • getLivemode

      public Boolean getLivemode()
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • getObject

      public String getObject()
      String representing the object's type. Objects of the same type share the same value.

      Equal to order.

    • getPayment

      public Order.Payment getPayment()
    • getShippingCost

      public Order.ShippingCost getShippingCost()
      The details of the customer cost of shipping, including the customer chosen ShippingRate.
    • getShippingDetails

      public Order.ShippingDetails getShippingDetails()
      Customer shipping information associated with the order.
    • getStatus

      public String getStatus()
      The overall status of the order.

      One of canceled, complete, open, processing, or submitted.

    • getTaxDetails

      public Order.TaxDetails getTaxDetails()
    • getTotalDetails

      public Order.TotalDetails getTotalDetails()
    • setAmountRemaining

      public void setAmountRemaining(Long amountRemaining)
    • setAmountSubtotal

      public void setAmountSubtotal(Long amountSubtotal)
      Order cost before any discounts or taxes are applied. A positive integer representing the subtotal of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency).
    • setAmountTotal

      public void setAmountTotal(Long amountTotal)
      Total order cost after discounts and taxes are applied. A positive integer representing the cost of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). To submit an order, the total must be either 0 or at least $0.50 USD or equivalent in charge currency.
    • setAutomaticTax

      public void setAutomaticTax(Order.AutomaticTax automaticTax)
    • setBillingDetails

      public void setBillingDetails(Order.BillingDetails billingDetails)
      Customer billing details associated with the order.
    • setClientSecret

      public void setClientSecret(String clientSecret)
      The client secret of this Order. Used for client-side retrieval using a publishable key.

      The client secret can be used to complete a payment for an Order from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.

      Refer to our docs for creating and processing an order to learn about how client_secret should be handled.

    • setCreated

      public void setCreated(Long created)
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • setCredits

      public void setCredits(List<Order.Credit> credits)
      The credits applied to the Order. At most 10 credits can be applied to an Order.
    • setCurrency

      public void setCurrency(String currency)
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • setDescription

      public void setDescription(String description)
      An arbitrary string attached to the object. Often useful for displaying to users.
    • setId

      public void setId(String id)
      Unique identifier for the object.
    • setIpAddress

      public void setIpAddress(String ipAddress)
      A recent IP address of the purchaser used for tax reporting and tax location inference.
    • setLineItems

      public void setLineItems(LineItemCollection lineItems)
      A list of line items the customer is ordering. Each line item includes information about the product, the quantity, and the resulting cost. There is a maximum of 100 line items.
    • setLivemode

      public void setLivemode(Boolean livemode)
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • setMetadata

      public void setMetadata(Map<String,String> metadata)
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    • setObject

      public void setObject(String object)
      String representing the object's type. Objects of the same type share the same value.

      Equal to order.

    • setPayment

      public void setPayment(Order.Payment payment)
    • setShippingCost

      public void setShippingCost(Order.ShippingCost shippingCost)
      The details of the customer cost of shipping, including the customer chosen ShippingRate.
    • setShippingDetails

      public void setShippingDetails(Order.ShippingDetails shippingDetails)
      Customer shipping information associated with the order.
    • setStatus

      public void setStatus(String status)
      The overall status of the order.

      One of canceled, complete, open, processing, or submitted.

    • setTaxDetails

      public void setTaxDetails(Order.TaxDetails taxDetails)
    • setTotalDetails

      public void setTotalDetails(Order.TotalDetails totalDetails)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getId

      public String getId()
      Unique identifier for the object.
      Specified by:
      getId in interface HasId
    • getMetadata

      public Map<String,String> getMetadata()
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
      Specified by:
      getMetadata in interface MetadataStore<Order>