The order object

An Order captures the details of what a customer wishes to pay for, but is at the same time acting as a state machine that goes through the process of collecting an authorization for creating payments. It is recommended to create exactly one Smartpay Order for each order or customer session in your system.

The Order transitions through multiple statuses throughout its lifetime to perform authorization flows and ultimately creates one or more payments.

Attributes
idstring
Unique identifier for the object
<dt><span className="label">object</span><span className="type">string, value is "order"</span></dt>
<dd>A string representing the object’s type. Objects of the same type share the same value.</dd>

<dt><span className="label">amount</span><span className="type">integer</span></dt>
<dd>The amount intended to be collected through one or more Payments linked to this order. A positive integer in the smallest currency unit (e.g. 100 cents to charge $1.00 or 100 to charge $100).</dd>

<dt><span className="label">createdAt</span><span className="type">timestamp</span></dt>
<dd>Time at which the object was created. Measured in milliseconds since the Unix epoch.</dd>

<dt><span className="label">currency</span><span className="type">string</span></dt>
<dd>Three-letter ISO currency code, in lowercase. Must be a supported currency.</dd>

<dt><span className="label">description</span><span className="type">string</span></dt>
<dd>An arbitrary - ideally descriptive - long form explanation of the Order, meant to be displayed to the customer.</dd>

<dt><span className="label">expiresAt</span><span className="type">timestamp</span></dt>
<dd>Time at which the Order expires beyond which (additional) capture of the Order is impossible. This timestamp is only set after successful authorization of the order. Measured in milliseconds since the Unix epoch.</dd>

<dt><span className="label">lineItems</span><span className="type">list of string</span></dt>
<dd>The IDs of the line items the customer wishes to order.</dd>

<dt><span className="label">metadata</span><span className="type">object</span></dt>
<dd>Set of <a target="_self" href="/reference/metadata">key-value pairs</a> that you can attach to the Order object.</dd>

<dt><span className="label">payments</span><span className="type">list of string</span></dt>
<dd>The IDs of the payments created for this order.</dd>

<dt><span className="label">status</span><span className="type">string</span></dt>
<dd>The status of an order.
  <div className="values-list-container">
    <div className="values-list-header">Possible enum values</div>
    <ul className="values-list">
      <li className="values-list-item">
        <span className="values-list-item-value"><code>requires_authorization</code></span>
        <p className="values-list-item-description">When the order is created and requires an authorization outcome.</p>
      </li>
      <li className="values-list-item">
        <span className="values-list-item-value"><code>rejected</code></span>
        <p className="values-list-item-description">When the authorization of the order evaluated into rejection.</p>
      </li>
      <li className="values-list-item">
        <span className="values-list-item-value"><code>requires_capture</code></span>
        <p className="values-list-item-description">When the authorization of the order is accepted, and there is a remaining amount for payment creation.</p>
      </li>
      <li className="values-list-item">
        <span className="values-list-item-value"><code>succeeded</code></span>
        <p className="values-list-item-description">When the authorization of the order is accepted, and there is a remaining amount for payment creation.</p>
      </li>
      <li className="values-list-item">
        <span className="values-list-item-value"><code>canceled</code></span>
        <p className="values-list-item-description">When the authorization of the order is accepted, and there is a remaining amount for payment creation.</p>
      </li>
    </ul>
  </div>
</dd>

<dt><span className="label">reference</span><span className="type">string</span></dt>
<dd>A - ideally unique - string to reference the Order (e.g. a customer ID, a cart ID, etc.) which can be used to reconcile the Session with your internal systems.</dd>

<dt><span className="label">test</span><span className="type">boolean</span></dt>
<dd>A flag with a value <code>false</code> if the object exists in live mode or <code>true</code> if the object exists in test mode.</dd>

<dt><span className="label">updatedAt</span><span className="type">timestamp</span></dt>
<dd>Time at which the object was last updated. Measured in milliseconds since the Unix epoch.</dd>