Backend API
An order is a request to purchase products from a store. Orders contain all the information needed to fulfill a purchase. Usually, customers create a cart to stage a purchase first and see it converted to an order when it's finalized. Besides being converted from a cart, it is possible to create an order directly.
Fields
id
objectIdUnique identifier for the order.
account_id
objectIdrequiredThe id of the customer's account. During checkout, customer accounts without a password are designated as guest=true.
account
AccountExpandable link to the customer's account.
account_credit_amount
currencyAmount of customer's account credit applied for initial payment, if applicable.
account_credit_applied
booleanIndicates the customer’s account credit is applied when submitting the order.
account_info_saved
booleanIndicates the customer chose to save shipping and billing information to their account when submitting the order.
account_logged_in
booleanIndicates the customer was logged into their account when placing the order.
authorized_payment
PaymentExpandable link to an authorized payment.
authorized_payment_id
stringautoThe id of an authorized payment. When "Require payment authorization" is enabled in payment settings, the order will be rejected if initial payment fails.
billing
objectThe customer's billing details. Defaults to account.billing. Updating billing will also update the corresponding account billing object.
billing.name
stringBilling full name. If first_name or last_name are updated, then name will be automatically updated as a combination of first/last.
billing.first_name
stringrequiredBilling first name. If name is updated, then first_name will be automatically updated as the first word of the name.
billing.last_name
stringrequiredBilling last name. If name is updated, then last_name will be automatically updated as the last words of the name.
billing.address1
stringBilling address line 1: street address/PO box/company name.
billing.address2
stringBilling address line 2: apartment/suite/unit/building.
billing.city
stringBilling city/district/suburb/town/village.
billing.state
stringBilling state/county/province/region.
billing.zip
stringBilling zip/postal code.
billing.country
stringTwo-letter ISO country code.
billing.phone
stringBilling phone number.
billing.method
stringMethod of payment. Can be card, account, amazon, paypal, or any one of the manual methods defined in payment settings.
billing.card
objectCredit card billing details used when billing.method=card.
card.token
stringrequiredToken generated by Swell Checkout or Stripe.js.
card.exp_month
intTwo-digit number representing the credit card expiration month.
card.exp_year
intFour-digit number representing the credit card expiration year.
card.brand
stringCredit card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown.
card.last4
stringLast four digits of the card number.
card.gateway
stringID of the payment gateway that should be used to process payments.
card.test
booleanIndicates this is a test card.
card.address_check
stringWhen used with a payment gateway that performs address checks and address1 was provided, can be pass, fail, unavailable, or unchecked.
card.zip_check
stringWhen used with a payment gateway that performs address checks and zip was provided, can be pass, fail, unavailable, or unchecked.
card.cvc_check
stringWhen used with a payment gateway that performs CVC code checks and cvc was provided, can be pass, fail, unavailable, or unchecked.
billing.default
booleanIndicates billing details represent the customer's default payment method.
billing.account_card_id
objectIdID of the customer's credit card on file, if applicable.
billing.account_card
account_cardExpandable link to the customer's credit card on file, if applicable.
billing.amazon
objectAmazon billing details used when billing.method=amazon.
amazon.access_token
stringAmazon access token provided when a customer authorizes payment in a storefront.
amazon.order_reference_id
stringAmazon order reference ID created when a customer initiates payment in a storefront.
amazon.checkout_session_id
stringbilling.paypal
objectPayPal billing details used when billing.method=paypal.
paypal.payer_id
stringPayPal payer ID provided when a customer authorizes payment in a storefront.
paypal.payment_id
stringPayPal payment ID created when a customer initiates payment in a storefront.
paypal.nonce
stringOne-time use reference element used to communicate payment information to a payment gateway.
paypal.authorization_id
stringPayPal authorization ID when a customer makes a payment using their PayPal account.
paypal.order_id
stringbilling.intent
objectStores the necessary information about the payment. This is typically the payment ID returned by the gateway after payment is initialized.
billing.affirm
objectAffirm billing details used when billing.method=affirm.
affirm.checkout_token
stringToken used to communicate payment information to the gateway.
billing.resolve
objectResolve billing details used when billing.method=resolve.
resolve.charge_id
stringCharge ID returned by the payment gateway for the payment.
billing.klarna
objectKlarna billing details used when billing.method=klarna.
klarna.source
stringPayment information returned by the gateway during payment initialization.
billing.ideal
objectIdeal billing details used when billing.method=ideal.
ideal.token
stringToken used to communicate payment information to the gateway.
billing.bancontact
objectBancontact billing details used when billing.method=bancontact.
bancontact.source
stringPayment information returned by the gateway during payment initialization.
billing.google
objectGoogle Pay billing details used when billing.method=google.
google.nonce
stringOne-time use reference element used to communicate payment information to a payment gateway.
google.gateway
stringGateway used to facilitate the transaction. For example, gateway=braintree.
billing.apple
objectApple Pay billing details used when billing.method=apple.
apple.nonce
stringOne-time use reference element used to communicate payment information to a payment gateway.
apple.gateway
stringGateway used to facilitate the transaction. For example, gateway=braintree.
billing.instructions
stringcancel_reason
stringA message describing the reason for cancelling the order, if applicable.
canceled
booleanIndicates the order was completely canceled.
cart
CartExpandable link to the cart.
cart_id
objectIdautoID of the cart that converted to this order, if applicable.
closed
booleanIndicates the order is closed.
comments
stringCustomer notes provided when placing the order, if any.
coupon
CouponExpandable link to the coupon applied to the order.
coupon_code
stringCoupon code applied to the order.
coupon_id
objectIdID of the coupon applied to the order.
credit_total
currencyTotal amount of additional credit applied to the order.
credits
Credit memoExpandable list of account credit transactions. Balance of these transactions is kept in balance.
currency
stringThree-letter ISO currency code in uppercase. Defaults to the store's base currency.
currency_rate
floatCurrency percentage used in calculating the fixed amount.
date_canceled
dateDate the order was canceled, if applicable.
date_created
dateautoDate and time the order was created.
date_payment_retry
dateWhen automated payment has failed, this is the date when the system will automatically retry.
date_period_end
dateautoPeriod end date applicable when the order was created from a subscription.
date_period_start
dateautoPeriod start date applicable when the order was created from a subscription.
date_scheduled
dateScheduled date for the order.
date_updated
dateautoDate and time the order was last updated.
date_webhook_first_failed
dateautoDate the order webhook first failed, if applicable. Value is unset after an order webhook is successfully returned for the record.
date_webhook_last_succeeded
dateDate the order webhook last succeeded, if applicable. Value is unset after an order webhook fails to return for the record.
delivered
booleanautoIndicates the order was completely fulfilled. Always true when delivery_marked=true, otherwise depends on the sum of shipments, giftcards, and subscriptions.
delivery_marked
booleanIndicates the order was marked as fulfilled, manually or automatically.
discount_total
currencyautoTotal discount amount.
discounts
array of objectList of discounts applied to the order.
id
stringUnique identifier for the object.
amount
currencyFixed discount amount.
type
stringType of discount. Can be coupon or promo-<id> referring to the source of the discount. Custom discounts don't require this value.
rule
objectObject describing the discount rule details. Custom discounts don't require this value.
display_currency
stringThree-letter ISO currency code representing the user's preferred display currency, if applicable.
display_locale
stringLocale code representing the user's preferred display locale, if applicable.
gift
booleanIndicates the order is intended as a gift for the recipient.
gift_message
stringOptional message to include with the order when shipping to the recipient.
giftcard_delivery
booleanIndicates the order has at least one line item with delivery=giftcard.
giftcard_total
currencyTotal payment amount applied to the order from giftcards.
giftcards
array of objectList of gift cards applied to the order.
id
objectIdUnique identifier for the object.
amount
currencyAmount of the gift card balance to spend for initial payment. If not specified, each gift cards will be spent in order until payment is completed.`
code
stringGift card code to apply. A validation error will be returned if the code is not valid.
code_formatted
stringFully formatted gift card code for display purposes.
last4
stringLast four digits of the gift card code.
giftcard
giftcardExpandable link to the gift card record.
grand_total
currencyautoGrand total including items, shipping and taxes.
guest
booleanIndicates the customer was not logged in when placing the order.
hold
booleanIndicates the order was placed on hold.
invoices
InvoiceExpandable link to the invoice the payment was applied to, if applicable.
item_discount
currencyautoTotal discount applied to line items.
item_quantity
intautoTotal quantity of all line items.
item_quantity_cancelable
intTotal quantity of cancelable items on the order.
item_quantity_canceled
intautoTotal quantity of line items canceled.
item_quantity_creditable
intTotal quantity of line items that can be credited.
item_quantity_credited
intTotal quantity of items credited on the order.
item_quantity_deliverable
intautoTotal quantity of line items that can be fulfilled.
item_quantity_delivered
intautoTotal quantity of line items that have been fulfilled.
item_quantity_giftcard_deliverable
intautoTotal quantity of line items that can be fulfilled by gift card. Applies when item.delivery=giftcard.
item_quantity_invoiceable
intTotal quantity of items eligible for invoicing on the order.
item_quantity_invoiced
intTotal quantity of items invoiced on the order.
item_quantity_returnable
intautoTotal quantity of line items that can still be returned.
item_quantity_returned
intautoTotal quantity of line items that have been returned.
item_quantity_shipment_deliverable
intautoTotal quantity of line items that can be fulfilled by shipment. Applies when item.delivery=shipment.
item_quantity_subscription_deliverable
intautoTotal quantity of line items that can be fulfilled by subscription. Applies when item.delivery=subscription.
item_shipment_weight
floatTotal shipping weight of all line items.
item_tax
currencyautoTotal taxes applied to line items.
item_tax_included
booleanIndicates line item prices include taxes.
items
array of objectList of line items describing the products ordered.
id
objectIdautoUnique identifier for the item.
bundle_items
array of objectList of items offered as a bundle. Defaults to product.bundle_items.
id
objectIdautoUnique identifier for the object.
product_id
objectIdrequiredID of the bundle item product.
delivery
enumMethod of delivery taken automatically from product.delivery.
Possible enum values:
options
array of objectItem options matching one or more of product.options. When adding to the order, you can specify either the option id or name (case-insensitive) to identify the option.
Subscription products have three special options that are used when fulfilling subscriptions. Use the option ID subscription_interval with a value of daily, weekly, monthly, yearly, and subscription_interval_count with an integer value used as a multiplier of the interval (defaults to 1), and subscription_trial_days to indicate the number of days the subscription should be in trial status after being created.
Gift card products have two special options that can be used when fulfilling gift cards by email. Use the option ID send_email and value as the recipient email address, and send_note as a custom message from the customer to the recipient sent by email.
id
stringUnique identifier for the object.
name
stringName of the product option. Populated automatically when adding an option by ID.
price
currencyAdditional price added onto the base price of the product.
shipment_weight
floatAdditional shipping weight added onto the base weight of the product.
value
stringName value of the product option. When adding to the order, specify either the product option value id or name (case-insensitive) to identify the value.
variant
booleanIndicates the option refers to a variant aspect.
value_id
objectIdID of the associated value.
product
productExpandable link to the bundle item product.
quantity
intQuantity of the bundle item being ordered. Defaults to 1.
quantity_canceled
intQuantity of the bundle item canceled before fulfillment, if applicable.
quantity_consumed
intQuantity of stock consumed by the bundle item, if applicable.
quantity_deliverable
intQuantity of the bundle item that can be fulfilled, if applicable.
quantity_delivered
intQuantity of the bundle item that has been fulfilled, if applicable.
quantity_giftcard_deliverable
intQuantity of the bundle item that can be fulfilled by a gift card. Applies when delivery=giftcard.
quantity_restocked
intQuantity of the bundle item that has been restocked after a return, if applicable.
quantity_returnable
intQuantity of the bundle item that can still be returned after fulfillment, if applicable.
quantity_returned
intTotal quantity of bundle items that have been returned.
quantity_shipment_deliverable
intQuantity of the bundle item that can be fulfilled by a shipment. Applies when delivery=shipment.
quantity_total
intTotal quantity of the bundle item to be fulfilled, calculated as item.quantity * bundle_item.quantity.
shipment_weight
floatShipping weight taken automatically from product.shipment_weight, if applicable.
stock_tracking
booleanIndicates whether the bundle item has stock tracking enabled.
variant_id
objectIdID of the bundle item variant.
variant
variantExpandable link to the bundle item variant.
quantity_cancelable
intQuantity of bundle items that are able to be canceled.
quantity_shipment_delivered
intQuantity of shipments that have been delivered.
product_name
stringThis field is a copy of the item's product.name.
delivery
enumMethod of delivery taken automatically from product.delivery.
Possible enum values:
description
stringDescription used for custom line items, when product is not defined.
discount_each
currencyTotal discount amount divided by quantity.
discount_total
currencyTotal discount applied to the item.
discounts
array of objectList of discounts applied to the item by coupons, promotions, or custom logic.
id
stringUnique identifier for the object. Refers to one of the IDs in the order discounts object.
amount
currencyFixed discount amount.
metadata
objectArbitrary item data, typically set in a checkout flow to store custom values. See Storefront API for details.
options
array of objectItem options matching one or more of product.options. When adding to the order, you can specify either the option id or name (case-insensitive) to identify the option.
Subscription products have three special options that are used when fulfilling subscriptions. Use the option ID subscription_interval with a value of daily, weekly, monthly, yearly, and subscription_interval_count with an integer value used as a multiplier of the interval (defaults to 1), and subscription_trial_days to indicate the number of days the subscription should be in trial status after being created.
Gift card products have two special options that can be used when fulfilling gift cards by email. Use the option ID send_email and value as the recipient email address, and send_note as a custom message from the customer to the recipient sent by email.
id
stringUnique identifier for the object.
name
stringName of the product option. Populated automatically when adding an option by ID.
price
currencyAdditional price added onto the base price of the product.
shipment_weight
floatAdditional shipping weight added onto the base weight of the product.
value
stringName value of the product option. When adding to the order, specify either the product option value id or name (case-insensitive) to identify the value.
variant
booleanIndicates the option refers to a variant aspect.
value_id
objectIdID of the associated value.
orig_price
currencyOriginal item price used internally to determine if the item price was overridden and should be automatically updated when item options are changed.
price
currencyPrice of the item. If a product price is reduced by a sale or price rule, this would be set to the reduced price automatically. Also, item price can be overridden when adding to an order. Line item prices don't change unless explicitly edited by a store admin.
price_total
currencyTotal price added to sub total by multiplying quantity and price.
product_id
objectIdID of the item product.
product
productExpandable link to the item product.
product_name
stringName of the product.
quantity
intQuantity of the item being ordered. Defaults to 1.
quantity_canceled
intQuantity of the item canceled before fulfillment, if applicable.
quantity_consumed
intQuantity of stock consumed by the item, if applicable.
quantity_deliverable
intQuantity of the item that can be fulfilled, if applicable.
quantity_delivered
intQuantity of the item that has been fulfilled, if applicable.
quantity_giftcard_deliverable
intQuantity of the item that can be fulfilled by a gift card. Applies when delivery=giftcard.
quantity_restocked
intQuantity of the item that has been restocked after a return, if applicable.
quantity_returnable
intQuantity of the item that can still be returned after fulfillment, if applicable.
quantity_returned
intQuantity of the item that has been returned after fulfillment, if applicable.
quantity_shipment_deliverable
intQuantity of the item that can be fulfilled by a shipment. Applies when delivery=shipment.
quantity_subscription_deliverable
intQuantity of the item that can be fulfilled by a subscription. Applies when delivery=subscription.
return_discount_total
currencyTotal discount total for returned items.
return_price_total
currencyTotal price of returned items.
return_tax_total
currencyTotal tax amount of returned items.
shipment_location
stringID of location from /settings/shipping/locations. If specified, shipping is calculated from this location. Otherwise, the store's default location will be used.
shipment_weight
floatShipping weight taken automatically from product.shipment_weight, if applicable.
stock_tracking
booleanIndicates whether the item has stock tracking enabled.
subscription_date_period_start
dateStart date for subscription period.
subscription_paid
booleanIndicates the item has been fulfilled as a subscription and marked as paid by reference to this order.
tax_each
currencyTotal tax amount divided by quantity.
tax_total
currencyTotal tax applied to the item.
taxes
array of objectList of tax rules applied to the item based on tax settings or custom logic.
id
stringUnique identifier for the object. Refers to one of the IDs in the order taxes object.
amount
currencyFixed tax amount.
variant_id
objectIdID of the item variant, if applicable.
variant
variantExpandable link to the item variant, if applicable.
quantity_cancelable
intQuantity of items that can be canceled.
quantity_credited
intAmount of items credited.
quantity_creditable
intQuantity of items eligible to be used with credit.
quantity_invoiceable
intQuantity of items eligible to be invoiced.
quantity_invoiced
intQuantity of invoiced items.
quantity_total
intTotal quantity of items.
quantity_subscription_delivered
intQuantity of subscriptions delivered.
purchase_option
objectPurchase option selected; standard for one-time purchases or subscription for a subscription plan.
purchase_option.id
objectIdID of the purchase option.
purchase_option.type
enumDesignates the type of purchase option: standard for one-time purchases, subscription for a subscription plan.
Possible enum values:
purchase_option.billing_schedule
objectBilling schedule for the subscription plan, if applicable.
billing_schedule.interval
enumBilling interval for the subscription plan. Can be monthly, weekly, daily, or yearly.
Possible enum values:
billing_schedule.interval_count
intMultiplier for the billing interval. For example, to make the subscription charge once every 2 weeks, set interval=weekly and interval_count=2.
billing_schedule.trial_days
intNumber of days the subscription trial period is for. An invoice will not be issued until trial has elapsed.
billing_schedule.limit
intSpecifies a limit to the number of billing cycles for the subscription plan. For example, "limit"=10 would stop billing the customer after the tenth billing cycle.
purchase_option.name
stringThe name of the purchase option.
purchase_option.order_schedule
objectThe schedule of a recurring order.
order_schedule.interval
enumFrequency of order generation for the subscription plan. Can be monthly, daily, weekly, or yearly.
Possible enum values:
order_schedule.interval_count
intMultiplier when combined with order interval. For example, to generate an order every two weeks, set interval=weekly and interval_count=2.
order_schedule.limit
intLimit to number of orders generated for the purchase option.
purchase_option.plan_description
stringThe plan description, if applicable.
purchase_option.plan_id
objectIdID of the subscription plan, if applicable.
purchase_option.plan_name
stringName of the subscription plan, if applicable.
purchase_option.price
currencyPrice of the purchase option.
metadata
objectArbitrary data, typically set in a checkout flow to store custom values. See Frontend API for details.
next
OrderIf next_id is set by the customer, next will link to the order with the given next_id.
next_id
objectIdThis never gets set by Swell. A customer must explicitly set this field to a particular order ID.
notes
stringInternal admin notes, not visible to the customer.
notifications
NotificationExpandable list of notifications sent on behalf of the order.
number
stringautoUnique incremental order number, assigned automatically using a format configured in general settings.
paid
booleanautoIndicates the order was paid in full. Always true when payment_marked=true, otherwise depends on the sum of payments.
parent
OrderExpandable link to the parent order.
parent_id
objectIdID of the parent order.
payment_balance
currencyautoBalance of payments. A negative number indicates payment is owed, a positive balance indicates a refund is due, and a zero balance indicates fully paid.
payment_error
stringA message describing the last payment error, if one occurred.
payment_marked
booleanIndicates the order was marked as paid, manually or automatically.
payment_retry_count
intThe number of times automatic payment has been attempted.
payment_retry_resolve
stringThe method used to resolve automatic payment when all retry attempts are exhausted. Can be blank (do nothing), canceled, or unpaid.
payment_total
currencySum of payments applied to the order, not including refunds.
payments
PaymentExpandable list of payments applied to the order.
pending_invoices
InvoiceExpandable list of invoices that haven't been fully paid.
prev
OrderIf prev_id is set by the customer, prev will link to the order with the given prev_id.
prev_id
objectIdThis never gets set by Swell. A customer must explicitly set this field to a particular order ID.
promotion_ids
array of child_scalarList of promotion IDs applied to the order.
promotions
PromotionExpandable list of promotions applied to the order.
refund_marked
booleanIndicates the order was marked as refunded, manually or automatically.
refund_total
currencySum of refunds on payments applied to the order.
refunded
booleanautoIndicates the order was fully refunded. Always true when refund_marked=true, otherwise depends on the sum of refunds.
refunds
RefundExpandable list of refunds applied to the order.
return_credit_tax
currencyTotal additional credit tax applied to the order from returns, if applicable
return_credit_total
currencyTotal additional credit amount applied to the order from returns.
return_item_tax
currencyautoTotal tax amount of items returned.
return_item_tax_included
currencyautoTotal tax included amount of items returned, separate from line item values.
return_item_total
currencyautoTotal amount of items returned, minus discounts.
return_total
currencyGrand total amount applied to the order from returns.
schedule
objectScheduling for recurring orders.
schedule.interval
enumrequiredRecurring order interval, if applicable. Can be monthly, daily, weekly, or yearly.
Possible enum values:
schedule.interval_count
intMultiplier for billing interval. For example, to make the subscription charge once every two weeks, set interval=weekly and interval_count=2.
shipment_delivery
booleanIndicates the order has at least one line item with delivery=shipment.
shipment_discount
currencyShipping discount applied by coupons, promotions, or custom logic.
shipment_price
currencyautoTotal shipping price before discounts.
shipment_rating
objectautoObject describing the shipping services and rates available for the order. Shipping country must be set before retrieving shipping rates.
shipment_rating.date_created
dateautoDate and time the object was created.
shipment_rating.errors
array of objectList of errors generated while retrieving rates, if any. When using third-party shipping services, any system errors will be listed here.
code
stringUnique code describing the error.
message
stringMessage describing the error.
shipment_rating.fingerprint
stringUnique fingerprint identifying the parameters used to calculate shipping rates. Rates should always be the same given the same parameters and shipping settings.
shipment_rating.services
array of objectList of shipping services and rates available.
id
stringUnique identifier for the object.
carrier
stringName of a third-party carrier offering the service, if applicable.
name
stringName of the shipping service.
price
currencyPrice of the shipping service.
pickup
booleanIndicates whether shipping service is local pick-up.
tax_code
stringApplicable tax code for shipment rating, if applicable.
shipment_tax
currencyShipping tax amount, if applicable.
shipment_tax_included
booleanIndicates shipping total includes taxes, if applicable.
shipment_tax_included_total
currencyautoTotal shipping price including taxes and discount. Allows for an alternate display style as normally shipment_total and tax_total are shown separately.
shipment_total
currencyautoTotal shipping price after discounts.
shipment_total_credited
currencyTotal shipping price for items credited on the order.
shipments
ShipmentExpandable list of shipments created from the order.
shipping
objectThe customer's shipping details. Defaults to account.shipping. Updating shipping will also update the corresponding account shipping object.
shipping.name
stringShipping full name. If first_name or last_name are updated, then name will be automatically updated as a combination of first/last.
shipping.first_name
stringShipping first name. If name is updated, then first_name will be automatically updated as the first word of the name.
shipping.last_name
stringrequiredShipping last name. If name is updated, then last_name will be automatically updated as the last words of the name.
shipping.address1
stringShipping address line 1: street address/PO box/company name.
shipping.address2
stringShipping address line 2: apartment/suite/unit/building.
shipping.city
stringrequiredShipping city/district/suburb/town/village.
shipping.state
stringShipping state/county/province/region.
shipping.zip
stringShipping zip/postal code.
shipping.country
stringTwo-letter ISO country code.
shipping.phone
stringShipping phone number.
shipping.service
stringID of a shipping service as configured in shipment settings. Normally, this would be applied after retrieving shipping rates by using one of the shipment_rating.services.id values.
shipping.service_name
stringName of the shipping service. Defaults to shipment_rating.services.name chosen by setting service.
shipping.price
currencyPrice of the shipping service. Defaults to shipment_rating.services.price chosen by setting service.
shipping.default
booleanIndicates shipping details represent the customer's default shipping address.
shipping.account_address_id
objectIdID of the customer's address on file.
shipping.account_address
account_addressExpandable link to the customer's address on file.
shipping.pickup
booleanIndicates whether shipping for local pick-up.
status
enumautoCurrent status of the order. Can be pending, draft, payment_pending, delivery_pending, hold, complete, or canceled.
Possible enum values:
sub_total
currencyautoSum of all line items before discounts, taxes and shipping.
subscription
SubscriptionExpandable link to the subscription that spawned the order, if applicable.
subscription_delivery
booleanrequiredIndicates the order has at least one line item with delivery=subscription.
subscription_id
objectIdautoID of the subscription that spawned the order, if applicable.
tax_included_total
currencyautoTotal of taxes applied separately from line items.
tax_total
currencyautoTotal tax amount applied to the order including line items and shipping.
taxes
array of objectList of taxes applied to the order.
id
stringUnique identifier for the object.
amount
currencyFixed tax amount.
name
stringName of the tax rule. For example "NY Sales Tax".
priority
intPriority indicates the order in which a tax rule was applied. Higher priority rules are added on top of other tax rules with a lower priority. Rules with the same priority are calculated excluding each other.
rate
floatTax percentage used in calculating the fixed amount.
shipping
booleanIndicates the tax applies to shipping.
taxes_fixed
booleanIndicates the order is tax-exempt. Taxes will not be calculated or applied when true.
test
booleanIndicates the order was made in test mode.
webhook_attempts_failed
intautoNumber of failed order webhook attempts, if applicable. Value is unset after an order webhook is successfully returned for the record.
webhook_response
stringautoText response of the last failed order webhook attempt, if applicable. Value is unset after an order webhook is successfully returned for the record.
webhook_status
intautoHTTP response status of the last failed order webhook attempt, if applicable. Value is unset after an order webhook is successfully returned for the record.
The order model
{
"cart_id": "62bc6389912a9800199ea43a",
"draft": false,
"test": true,
"items": [
{
"product_id": "628ba3c7499bba0019b1a961",
"quantity": 1,
"price": 25,
"purchase_option": {
"type": "standard",
"price": 25
},
"id": "62bc63892fafef0019eb2312",
"orig_price": 25,
"delivery": "shipment",
"shipment_weight": 0,
"price_total": 25,
"discount_total": 3.75,
"discount_each": 3.75,
"tax_total": 0,
"tax_each": 0,
"discounts": [
{
"id": "promo-62bc63e193cb7c0019423b6e-0",
"amount": 3.75
}
],
"product_name": "Mannimarco, King of Worms",
"quantity_total": 1,
"quantity_invoiceable": 1,
"quantity_creditable": 1,
"quantity_cancelable": 0,
"quantity_deliverable": 0,
"quantity_shipment_deliverable": 0,
"quantity_canceled": 0,
"quantity_delivered": 1,
"quantity_returnable": 1
},
{
"product_id": "628ba442499bba0019b1a96d",
"quantity": 1,
"price": 25,
"purchase_option": {
"type": "standard",
"price": 25
},
"id": "62bc639293cb7c0019423b5f",
"orig_price": 25,
"delivery": "shipment",
"shipment_weight": 0,
"price_total": 25,
"discount_total": 3.75,
"discount_each": 3.75,
"tax_total": 0,
"tax_each": 0,
"discounts": [
{
"id": "promo-62bc63e193cb7c0019423b6e-0",
"amount": 3.75
}
],
"product_name": "Calcinator Treatise",
"quantity_total": 1,
"quantity_invoiceable": 1,
"quantity_creditable": 1,
"quantity_cancelable": 0,
"quantity_deliverable": 0,
"quantity_shipment_deliverable": 0,
"quantity_canceled": 0,
"quantity_delivered": 1,
"quantity_returnable": 1
},
{
"product_id": "628ba6011869c10019b41f70",
"quantity": 1,
"price": 60,
"purchase_option": {
"type": "standard",
"price": 60
},
"id": "62bc639e629aa900197ff786",
"orig_price": 60,
"delivery": "shipment",
"shipment_weight": 0,
"price_total": 60,
"discount_total": 9,
"discount_each": 9,
"tax_total": 0,
"tax_each": 0,
"discounts": [
{
"id": "promo-62bc63e193cb7c0019423b6e-0",
"amount": 9
}
],
"product_name": "Mythic Dawn Commentaries I",
"quantity_total": 1,
"quantity_invoiceable": 1,
"quantity_creditable": 1,
"quantity_cancelable": 0,
"quantity_deliverable": 0,
"quantity_shipment_deliverable": 0,
"quantity_canceled": 0,
"quantity_delivered": 1,
"quantity_returnable": 1
},
{
"product_id": "628ba67a1869c10019b41f76",
"quantity": 1,
"price": 60,
"purchase_option": {
"type": "standard",
"price": 60
},
"id": "62bc63a293cb7c0019423b63",
"orig_price": 60,
"delivery": "shipment",
"shipment_weight": 0,
"price_total": 60,
"discount_total": 9,
"discount_each": 9,
"tax_total": 0,
"tax_each": 0,
"discounts": [
{
"id": "promo-62bc63e193cb7c0019423b6e-0",
"amount": 9
}
],
"product_name": "Mythic Dawn Commentaries II",
"quantity_total": 1,
"quantity_invoiceable": 1,
"quantity_creditable": 1,
"quantity_cancelable": 0,
"quantity_deliverable": 0,
"quantity_shipment_deliverable": 0,
"quantity_canceled": 0,
"quantity_delivered": 1,
"quantity_returnable": 1
},
{
"product_id": "628ba6b7499bba0019b1a9b2",
"quantity": 1,
"price": 60,
"purchase_option": {
"type": "standard",
"price": 60
},
"id": "62bc63a793cb7c0019423b66",
"orig_price": 60,
"delivery": "shipment",
"shipment_weight": 0,
"price_total": 60,
"discount_total": 9,
"discount_each": 9,
"tax_total": 0,
"tax_each": 0,
"discounts": [
{
"id": "promo-62bc63e193cb7c0019423b6e-0",
"amount": 9
}
],
"product_name": "Mythic Dawn Commentaries III",
"quantity_total": 1,
"quantity_invoiceable": 1,
"quantity_creditable": 1,
"quantity_cancelable": 0,
"quantity_deliverable": 0,
"quantity_shipment_deliverable": 0,
"quantity_canceled": 0,
"quantity_delivered": 1,
"quantity_returnable": 1
},
{
"product_id": "628ba701499bba0019b1a9bb",
"quantity": 1,
"price": 60,
"purchase_option": {
"type": "standard",
"price": 60
},
"id": "62bc63aa93cb7c0019423b69",
"orig_price": 60,
"delivery": "shipment",
"shipment_weight": 0,
"price_total": 60,
"discount_total": 9,
"discount_each": 9,
"tax_total": 0,
"tax_each": 0,
"discounts": [
{
"id": "promo-62bc63e193cb7c0019423b6e-0",
"amount": 9
}
],
"product_name": "Myuthic Dawn Commentaries IV",
"quantity_total": 1,
"quantity_invoiceable": 1,
"quantity_creditable": 1,
"quantity_cancelable": 0,
"quantity_deliverable": 0,
"quantity_shipment_deliverable": 0,
"quantity_canceled": 0,
"quantity_delivered": 1,
"quantity_returnable": 1
}
],
"billing": {
"card": {
"brand": "Visa",
"last4": "4242",
"exp_month": 3,
"exp_year": 2024,
"token": "card_XW3WxpzAmGBPGLFmxsLT1oZY",
"address_check": "unchecked",
"zip_check": "unchecked",
"cvc_check": "unchecked",
"fingerprint": "883f20e8bc00d0f9e1c42967b39a4f22",
"date_created": "2022-06-24T16:45:03.577Z"
},
"first_name": "Sheogorath",
"last_name": null,
"address1": "New Sheoth Palace",
"address2": null,
"city": "Shivering Isles",
"state": "TX",
"zip": "78757",
"country": "US",
"phone": null,
"company": null,
"account_card_id": null,
"method": "card",
"use_account": false,
"default": false,
"name": "Sheogorath"
},
"shipping": {
"service": "international",
"price": null,
"service_name": "International",
"first_name": "Sheogorath",
"last_name": null,
"company": "",
"address1": "New Sheoth Palace",
"address2": null,
"city": "Shivering Isles",
"zip": "78757",
"country": "US",
"state": "TX",
"phone": null,
"default": false,
"name": "Sheogorath"
},
"shipment_rating": {
"date_created": "2022-06-29T14:42:04.067Z",
"fingerprint": "bc218e4a538adbdffe60fbb91dd6063e",
"services": [
{
"id": "standard",
"name": "Standard Shipping",
"price": 5,
"description": "Standard shipping service"
},
{
"id": "express",
"name": "Express Shipping",
"price": 15,
"description": "Express shipping service"
}
]
},
"shipment_discount": 0,
"schedule": null,
"coupon_code": null,
"coupon_id": null,
"discounts": [
{
"type": "promo-62bc63e193cb7c0019423b6e",
"rule": {
"value_type": "percent",
"value_percent": 15,
"total_min": 100,
"type": "total"
},
"amount": 43.5,
"id": "promo-62bc63e193cb7c0019423b6e-0"
}
],
"taxes": null,
"item_tax_included": null,
"shipment_tax": null,
"shipment_tax_included": null,
"promotion_ids": [
"62bc63e193cb7c0019423b6e"
],
"account_id": "62991607782f3b0013cf17af",
"account_logged_in": null,
"account_info_saved": false,
"account_credit_applied": null,
"account_credit_amount": null,
"giftcards": null,
"currency": "USD",
"display_currency": null,
"display_locale": null,
"notes": "Do we deliver to the Shivering Isles?",
"comments": null,
"gift": null,
"gift_message": null,
"metadata": null,
"shipment_delivery": true,
"date_trial_end": null,
"sub_total": 290,
"shipment_price": 0,
"shipment_total": 0,
"item_tax": 0,
"tax_included_total": 0,
"item_discount": 43.5,
"discount_total": 43.5,
"grand_total": 246.5,
"item_quantity_returned": 0,
"return_item_total": 0,
"return_item_tax": 0,
"return_item_tax_included": 0,
"return_total": 0,
"payment_balance": 0,
"paid": true,
"refunded": false,
"item_quantity_delivered": 6,
"item_quantity_deliverable": 0,
"delivered": true,
"item_quantity": 6,
"item_quantity_canceled": 0,
"item_quantity_cancelable": 0,
"item_quantity_shipment_deliverable": 0,
"item_quantity_returnable": 6,
"item_quantity_invoiced": 0,
"item_quantity_invoiceable": 6,
"item_quantity_credited": 0,
"item_quantity_creditable": 6,
"item_shipment_weight": 0,
"shipment_tax_included_total": 0,
"tax_total": 0,
"giftcard_total": 0,
"guest": true,
"authorized_payment_id": "62bc642d912a9800199ea467",
"date_created": "2022-06-29T14:39:42.350Z",
"hold": false,
"closed": false,
"status": "complete",
"payment_total": 246.5,
"refund_total": 0,
"number": "100019",
"date_updated": "2022-06-29T14:42:04.247Z",
"payment_marked": true,
"auto_update_account_address": false,
"id": "62bc642d912a9800199ea465"
}
Create a new order. If you wish to generate your own unique ID for the record, it must use BSON ObjectID format for compatibility.
Arguments
account_id
objectIdrequiredID of the customer's account.
billing
objectThe customer's billing details. Defaults to account.billing. Updating billing will also update the corresponding account billing object.
billing.account_card_id
objectIdID of the customer's credit card on file, if applicable.
billing.account_card
account_cardExpandable link to the customer's credit card on file, if applicable.
billing.address1
stringBilling address line 1: street address/PO box/company name.
billing.address2
stringBilling address line 2: apartment/suite/unit/building.
billing.amazon
objectAmazon billing details used when billing.method=amazon.
amazon.access_token
stringAmazon access token provided when a customer authorizes payment in a storefront.
amazon.order_reference_id
stringAmazon order reference ID created when a customer initiates payment in a storefront.
amazon.checkout_session_id
stringbilling.card
objectCredit card billing details used when billing.method=card.
card.token
stringToken generated by Swell Checkout or Stripe.js.
card.exp_month
intTwo-digit number representing the credit card expiration month.
card.exp_year
intFour-digit number representing the credit card expiration year.
card.brand
stringCredit card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown.
card.last4
stringLast four digits of the card number.
card.gateway
stringID of the payment gateway that should be used to process payments.
card.test
booleanIndicates this is a test card.
card.address_check
stringWhen used with a payment gateway that performs address checks and address1 was provided, can be pass, fail, unavailable, or unchecked.
card.zip_check
stringWhen used with a payment gateway that performs address checks and zip was provided, can be pass, fail, unavailable, or unchecked.
card.cvc_check
stringWhen used with a payment gateway that performs CVC code checks and cvc was provided, can be pass, fail, unavailable, or unchecked.
billing.city
stringBilling city/district/suburb/town/village.
billing.country
stringTwo-letter ISO code country code.
billing.first_name
stringBilling first name. If name is updated, then first_name will be automatically updated as the first word of the name.
billing.last_name
stringBilling last name. If name is updated, then last_name will be automatically updated as the last words of the name.
billing.method
stringMethod of payment. Can be card, account, amazon, paypal, or any one of the manual methods defined in payment settings.
billing.name
stringBilling full name. If first_name or last_name are updated, then name will be automatically updated as a combination of first/last.
billing.paypal
objectPayPal billing details used when billing.method=paypal.
paypal.payer_id
stringPayPal payer ID provided when a customer authorizes payment in a storefront.
paypal.payment_id
stringPayPal payment ID created when a customer initiates payment in a storefront.
paypal.nonce
stringpaypal.authorization_id
stringpaypal.order_id
stringbilling.phone
stringBilling phone number.
billing.state
stringBilling state/county/province/region.
billing.zip
stringBilling zip/postal code.
billing.default
booleanIndicates billing details represent the customer's default payment method.
billing.intent
objectStores the necessary information about the payment. This is typically the payment ID returned by the gateway after payment is initialized.
billing.affirm
objectAffirm billing details used when billing.method=affirm.
affirm.checkout_token
stringToken used to communicate payment information to the gateway.
billing.resolve
objectResolve billing details used when billing.method=resolve.
resolve.charge_id
stringCharge ID returned by the payment gateway for the payment.
billing.klarna
objectKlarna billing details used when billing.method=klarna.
klarna.source
stringPayment information returned by the gateway during payment initialization.
billing.ideal
objectIdeal billing details used when billing.method=ideal.
ideal.token
stringToken used to communicate payment information to the gateway.
billing.bancontact
objectBancontact billing details used when billing.method=bancontact.
bancontact.source
stringPayment information returned by the gateway during payment initialization.
billing.google
objectGoogle Pay billing details used when billing.method=google.
google.nonce
stringOne-time use reference element used to communicate payment information to a payment gateway.
google.gateway
stringGateway used to facilitate the transaction. For example, Braintree.
billing.apple
objectApple Pay billing details used when billing.method=apple.
apple.nonce
stringOne-time use reference element used to communicate payment information to a payment gateway.
apple.gateway
stringGateway used to facilitate the transaction. For example, Braintree.
billing.instructions
stringcoupon_code
stringCoupon code applied to the order. See coupons for details.
items
array of objectList of line items describing the products ordered.
bundle_items
array of objectList of items offered as a bundle. Defaults to product.bundle_items.
product_id
objectIdrequiredID of the bundle item product.
product
productExpandable link to the bundle item product.
quantity
intQuantity of the bundle item being ordered. Defaults to 1.
shipment_weight
floatWeight to be used in shipping calculation, if applicable.
quantity_restocked
intQuantity of the bundle item that has been restocked after a return, if applicable.
quantity_returnable
intQuantity of the bundle item that can still be returned after fulfillment, if applicable.
variant_id
objectIdID of the bundle item variant.
variant
variantExpandable link to the bundle item product variant.
id
objectIdautoUnique identifier for the object.
delivery
enumMethod of delivery taken automatically from product.delivery.
Possible enum values:
options
array of objectItem options matching one or more of product.options. When adding to the order, you can specify either the option id or name (case-insensitive) to identify the option.
Gift card products have two special options that can be used when fulfilling gift cards by email. Use the option ID send_email and value as the recipient email address, and send_note as a custom message from the customer to the recipient sent by email.
id
stringUnique identifier for the object.
name
stringName of the product option. Populated automatically when adding an option by ID.
price
currencyAdditional price added onto the base price of the product.
shipment_weight
floatAdditional shipping weight added onto the base weight of the product.
value
stringName value of the product option. When adding to the order, specify either the product option value id or name (case-insensitive) to identify the value.
value_id
objectIdID of the associated value.
variant
booleanIndicates the option refers to a variant aspect.
quantity_canceled
intQuantity of the bundle item canceled before fulfillment, if applicable.
quantity_consumed
intQuantity of stock consumed by the bundle item, if applicable.
quantity_deliverable
intQuantity of the bundle item that can be fulfilled, if applicable.
quantity_delivered
intQuantity of the bundle item that has been fulfilled, if applicable.
quantity_giftcard_deliverable
intQuantity of the bundle item that can be fulfilled by a gift card. Applies when delivery=giftcard.
quantity_returned
intTotal quantity of bundle items that have been returned.
quantity_shipment_deliverable
intQuantity of the bundle item that can be fulfilled by a shipment. Applies when delivery=shipment.
quantity_total
intTotal quantity of the bundle item to be fulfilled, calculated as item.quantity * bundle_item.quantity.
stock_tracking
booleanIndicates whether the bundle item has stock tracking enabled.
quantity_cancelable
intQuantity of bundle items that are able to be canceled.
quantity_shipment_delivered
intQuantity of shipments that have been delivered.
product_name
stringThis field is a copy of the item's product.name.
description
stringDescription used for custom line items, when product is not defined.
discounts
array of objectList of discounts to apply to the item. Normally populated by applying a coupon or promotions.
id
stringrequiredUnique identifier for the object. Should refer to one of the IDs in the order discounts object.
amount
currencyrequiredFixed discount amount.
metadata
objectArbitrary item data, typically set in a checkout flow to store custom values. See Storefront API for details.
options
array of objectItem options matching one or more of product.options. When adding to the order, you can specify either the option id or name (case-insensitive) to identify the option.
Gift card products have two special options that can be used when fulfilling gift cards by email. Use the option ID send_email and value as the recipient email address, and send_note as a custom message from the customer to the recipient sent by email.
id
stringUnique identifier for the object.
name
stringName of the product option. Populated automatically when adding an option by ID.
price
currencyAdditional price added onto the base price of the product.
shipment_weight
floatAdditional shipping weight added onto the base weight of the product.
value
stringName value of the product option. When adding to the order, specify either the product option value id or name (case-insensitive) to identify the value.
value_id
objectIdID of the associated value.
variant
booleanIndicates the option refers to a variant aspect.
price
currencyPrice of the item. Override this value to set a custom price. Defaults to product price or sale price.
product_id
objectIdID of the item product.
quantity
intQuantity of the item being ordered. Defaults to 1.
quantity_restocked
intQuantity of the item that has been restocked after a return, if applicable.
quantity_returnable
intQuantity of the item that can still be returned after fulfillment, if applicable.
quantity_returned
intQuantity of the item that has been returned after fulfillment, if applicable.
shipment_weight
floatWeight to be used in shipping calculation, if applicable.
taxes
array of objectList of tax rules to apply to the item. Normally populated by tax settings.
id
stringrequiredUnique identifier for the object. Should refer to one of the IDs in the order taxes object.
amount
currencyrequiredFixed tax amount.
variant_id
objectIdID of the item variant, if applicable.
id
objectIdautoUnique identifier for the item.
delivery
enumMethod of delivery taken automatically from product.delivery.
Possible enum values:
discount_each
currencyTotal discount amount divided by quantity.
discount_total
currencyTotal discount applied to the item.
orig_price
currencyOriginal item price used internally to determine if the item price was overridden and should be automatically updated when item options are changed.
price_total
currencyTotal price added to sub total by multiplying quantity and price.
product
productExpandable link to the item product.
product_name
stringName of the product.
quantity_canceled
intQuantity of the item canceled before fulfillment, if applicable.
quantity_consumed
intQuantity of stock consumed by the item, if applicable.
quantity_deliverable
intQuantity of the item that can be fulfilled, if applicable.
quantity_delivered
intQuantity of the item that has been fulfilled, if applicable.
quantity_giftcard_deliverable
intQuantity of the item that can be fulfilled by a gift card. Applies when delivery=giftcard.
quantity_shipment_deliverable
intQuantity of the item that can be fulfilled by a shipment. Applies when delivery=shipment.
quantity_subscription_deliverable
intQuantity of the item that can be fulfilled by a subscription. Applies when delivery=subscription.
return_discount_total
currencyTotal discount total for returned items.
return_price_total
currencyTotal price of returned items.
return_tax_total
currencyTotal tax amount of returned items.
shipment_location
stringID of location from /settings/shipping/locations. If specified, shipping is calculated from this location. Otherwise, the store's default location will be used.
stock_tracking
booleanIndicates whether the item has stock tracking enabled.
subscription_date_period_start
dateStart date for subscription period.
subscription_paid
booleanIndicates the item has been fulfilled as a subscription and marked as paid by reference to this order.
tax_each
currencyTotal tax amount divided by quantity.
tax_total
currencyTotal tax applied to the item.
trial_price_total
currencyTotal of all trial prices on the order.
variant
variantExpandable link to the item variant, if applicable.
quantity_cancelable
intQuantity of items that can be canceled.
quantity_credited
intAmount of items credited.
quantity_creditable
intQuantity of items eligible to be used with credit.
quantity_invoiceable
intQuantity of items eligible to be invoiced.
quantity_invoiced
intQuantity of invoiced items.
quantity_total
intTotal quantity of items.
quantity_subscription_delivered
intQuantity of subscriptions delivered.
purchase_option
objectPurchase option selected; standard for one-time purchases or subscription for a subscription plan.
purchase_option.type
enumDesignates the type of purchase option: standard for one-time purchases, subscription for a subscription plan.
Possible enum values:
purchase_option.id
objectIdID of the purchase option.
purchase_option.name
stringThe name of the purchase option.
purchase_option.price
currencyPrice of the purchase option.
purchase_option.plan_id
objectIdID of the subscription plan, if applicable.
purchase_option.plan_name
stringName of the subscription plan, if applicable.
purchase_option.billing_schedule
objectBilling schedule for the subscription plan, if applicable.
billing_schedule.interval
enumBilling interval for the subscription plan. Can be monthly, weekly, daily, or yearly.
Possible enum values:
billing_schedule.interval_count
intMultiplier for the billing interval. For example, to make the subscription charge once every 2 weeks, set interval=weekly and interval_count=2.
billing_schedule.trial_days
intNumber of days the subscription trial period is for. An invoice will not be issued until trial has elapsed.
billing_schedule.limit
intSpecifies a limit to the number of billing cycles for the subscription plan. For example, "limit"=10 would stop billing the customer after the tenth billing cycle.
purchase_option.order_schedule
objectorder_schedule.interval
enumFrequency of order generation for the subscription plan. Can be monthly, daily, weekly, or yearly.
Possible enum values:
order_schedule.interval_count
intMultiplier when combined with order interval. For example, to generate an order every two weeks, set interval=weekly and interval_count=2.
order_schedule.limit
intLimit to number of orders generated for the purchase option.
purchase_option.plan_description
stringshipping
objectThe customer's shipping details. Defaults to account.shipping. Updating shipping will also update the corresponding account shipping object.
shipping.account_address_id
objectIdID of the customer's address on file.
shipping.account_address
account_addressExpandable link to the customer's address on file.
shipping.address1
stringShipping address line 1: street address/PO box/company name.
shipping.address2
stringShipping address line 2: apartment/suite/unit/building.
shipping.city
stringShipping city/district/suburb/town/village.
shipping.country
stringTwo-letter ISO country code.
shipping.default
booleanIndicates shipping details represent the customer's default shipping address.
shipping.first_name
stringShipping first name. If name is updated, then first_name will be automatically updated as the first word of the name.
shipping.last_name
stringShipping last name. If name is updated, then last_name will be automatically updated as the last words of the name.
shipping.name
stringShipping full name. If first_name or last_name are updated, then name will be automatically updated as a combination of first/last.
shipping.phone
stringShipping phone number.
shipping.price
currencyPrice of the shipping service. Defaults to shipment_rating.services.price chosen by setting service.
shipping.service
stringID of a shipping service as configured in shipment settings. Normally, this would be applied after retrieving shipping rates by using one of the shipment_rating.services.id values.
shipping.service_name
stringName of the shipping service. Defaults to shipment_rating.services.name chosen by setting service.
shipping.state
stringShipping state/county/province/region.
shipping.zip
stringShipping zip/postal code.
shipping.pickup
booleanIndicates whether shipping for local pick-up.
account_credit_amount
currencyAmount of customer's account credit applied for initial payment, if applicable.
account_info_saved
booleanIndicates the customer chose to save shipping and billing information to their account when submitting the order.
account_logged_in
booleanIndicates the customer was logged into their account when placing the order.
cancel_reason
stringA message describing the reason for cancelling the order, if applicable.
canceled
booleanIndicates the order was completely canceled.
comments
stringCustomer notes provided when placing the order, if any.
coupon_id
objectIdID of the coupon applied to the order.
date_canceled
dateDate the order was canceled, if applicable.
delivery_marked
booleanIndicates the order was marked as fulfilled, manually or automatically.
discounts
array of objectList of discounts applied to the order.
id
stringUnique identifier for the object.
amount
currencyFixed discount amount.
rule
objectObject describing the discount rule details. Custom discounts don't require this value.
type
stringType of discount. Can be coupon or promo-<id> referring to the source of the discount. Custom discounts don't require this value.
display_currency
stringThree-letter ISO currency code representing the user's preferred display currency, if applicable.
display_locale
stringLocale code representing the user's preferred display locale, if applicable.
gift_message
stringOptional message to include with the order when shipping to the recipient.
giftcards
array of objectList of gift cards applied to the order.
amount
currencyAmount of the gift card balance to spend on this order. Defaults to giftcard.balance.
code
stringSpecify a gift card code to apply to the order. If the code is not found or invalid, a validation error is returned. Case-insensitive.
id
objectIdUnique identifier for the object.
code_formatted
stringFully formatted gift card code for display purposes.
last4
stringLast four digits of the gift card code.
giftcard
giftcardExpandable link to the gift card record.
gift
booleanIndicates the order is intended as a gift for the recipient.
guest
booleanIndicates the customer was not logged in when placing the order.
hold
booleanIndicates the order was placed on hold.
item_tax_included
booleanIndicates line item prices include taxes.
metadata
objectArbitrary data, typically set in a checkout flow to store custom values. See Storefront API for details.
notes
stringInternal admin notes, not visible to the customer.
payment_marked
booleanIndicates the order was marked as paid, manually or automatically.
promotion_ids
array of child_scalarList of promotion IDs applied to the order.
shipment_discount
currencyShipping discount applied by coupons, promotions, or custom logic.
shipment_tax
currencyShipping tax amount, if applicable.
shipment_tax_included
booleanIndicates shipping total includes taxes, if applicable.
taxes
array of objectList of taxes applied to the order.
id
stringUnique identifier for the object.
amount
currencyFixed tax amount.
name
stringName of the tax rule. For example, "NY Sales Tax".
priority
intPriority indicates the order in which a tax rule was applied. Higher priority rules are added on top of other tax rules with a lower priority. Rules with the same priority are calculated excluding each other.
rate
floatTax percentage used in calculating the fixed amount.
shipping
booleanIndicates the tax applies to shipping.
account
AccountExpandable link to the customer's account.
authorized_payment_id
stringautoThe id of an authorized payment. When "Require payment authorization" is enabled in payment settings, the order will be rejected if initial payment fails.
authorized_payment
PaymentExpandable link to an authorized payment.
cart_id
objectIdautoID of the cart that converted to this order, if applicable.
cart
CartExpandable link to the cart.
coupon
CouponExpandable link to the coupon applied to the order.
credits
Credit memoExpandable list of account credit transactions. Balance of these transactions is kept in balance.
credit_total
currencyTotal amount of additional credit applied to the order.
currency
stringThree-letter ISO currency code in uppercase. Defaults to the store's base currency.
currency_rate
floatCurrency percentage used in calculating the fixed amount.
date_payment_retry
dateWhen automated payment has failed, this is the date when the system will automatically retry.
date_period_end
dateautoPeriod end date applicable when the order was created from a subscription.
date_period_start
dateautoPeriod start date applicable when the order was created from a subscription.
date_webhook_first_failed
dateautoDate the order webhook first failed, if applicable. Value is unset after an order webhook is successfully returned for the record.
delivered
booleanautoIndicates the order was completely fulfilled. Always true when delivery_marked=true, otherwise depends on the sum of shipments, giftcards, and subscriptions.
discount_total
currencyautoTotal discount amount.
giftcard_delivery
booleanIndicates the order has at least one line item with delivery=giftcard.
giftcard_total
currencyTotal payment amount applied to the order from giftcards.
grand_total
currencyautoGrand total including items, shipping and taxes.
invoices
InvoiceExpandable link to the invoice the payment was applied to, if applicable.
item_discount
currencyautoTotal discount applied to line items.
item_quantity
intautoTotal quantity of all line items.
item_quantity_cancelable
intTotal quantity of cancelable items on the order.
item_quantity_canceled
intautoTotal quantity of line items canceled.
item_quantity_creditable
intTotal quantity of line items that can be credited.
item_quantity_credited
intTotal quantity of items credited on the order.
item_quantity_deliverable
intautoTotal quantity of line items that can be fulfilled.
item_quantity_delivered
intautoTotal quantity of line items that have been fulfilled.
item_quantity_giftcard_deliverable
intautoTotal quantity of line items that can be fulfilled by gift card. Applies when item.delivery=giftcard.
item_quantity_invoiceable
intTotal quantity of items eligible for invoicing on the order.
item_quantity_invoiced
intTotal quantity of items invoiced on the order.
item_quantity_returnable
intautoTotal quantity of line items that can still be returned.
item_quantity_returned
intautoTotal quantity of line items that have been returned.
item_quantity_shipment_deliverable
intautoTotal quantity of line items that can be fulfilled by shipment. Applies when item.delivery=shipment.
item_quantity_subscription_deliverable
intautoTotal quantity of line items that can be fulfilled by subscription. Applies when item.delivery=subscription.
item_shipment_weight
floatTotal shipping weight of all line items.
item_tax
currencyautoTotal taxes applied to line items.
notifications
NotificationExpandable list of notifications sent on behalf of the order.
number
stringautoUnique incremental order number, assigned automatically using a format configured in general settings.
paid
booleanautoIndicates the order was paid in full. Always true when payment_marked=true, otherwise depends on the sum of payments.
parent
OrderExpandable link to the parent order.
parent_id
objectIdID of the parent order.
payments
PaymentExpandable list of payments applied to the order.
payment_balance
currencyautoBalance of payments. A negative number indicates payment is owed, a positive balance indicates a refund is due, and a zero balance indicates fully paid.
payment_error
stringA message describing the last payment error, if one occurred.
payment_retry_count
intThe number of times automatic payment has been attempted.
payment_retry_resolve
stringThe method used to resolve automatic payment when all retry attempts are exhausted. Can be blank (do nothing), canceled, or unpaid.
payment_total
currencySum of payments applied to the order, not including refunds.
pending_invoices
InvoiceExpandable list of invoices that haven't been fully paid.
promotions
PromotionExpandable list of promotions applied to the order.
refund_marked
booleanIndicates the order was marked as refunded, manually or automatically.
refund_total
currencySum of refunds on payments applied to the order.
refunded
booleanautoIndicates the order was fully refunded. Always true when refund_marked=true, otherwise depends on the sum of refunds.
refunds
RefundExpandable list of refunds applied to the order.
return_credit_tax
currencyTotal additional credit tax applied to the order from returns, if applicable
return_credit_total
currencyTotal additional credit amount applied to the order from returns.
return_item_tax
currencyautoTotal tax amount of items returned.
return_item_tax_included
currencyautoTotal tax included amount of items returned, separate from line item values.
return_item_total
currencyautoTotal amount of items returned, minus discounts.
return_total
currencyGrand total amount applied to the order from returns.
shipment_delivery
booleanIndicates the order has at least one line item with delivery=shipment.
shipment_price
currencyautoTotal shipping price before discounts.
shipment_rating
objectautoObject describing the shipping services and rates available for the order. Shipping country must be set before retrieving shipping rates.
shipment_rating.errors
array of objectList of errors generated while retrieving rates, if any. When using third-party shipping services, any system errors will be listed here.
code
stringUnique code describing the error.
message
stringMessage describing the error.
shipment_rating.fingerprint
stringUnique fingerprint identifying the parameters used to calculate shipping rates. Rates should always be the same given the same parameters and shipping settings.
shipment_rating.services
array of objectList of shipping services and rates available.
id
stringUnique identifier for the object.
carrier
stringName of a third-party carrier offering the service, if applicable.
name
stringName of the shipping service.
price
currencyPrice of the shipping service.
pickup
booleanIndicates whether shipping service is local pick-up.
tax_code
stringApplicable tax code for shipment rating, if applicable.
shipment_tax_included_total
currencyautoTotal shipping price including taxes and discount. Allows for an alternate display style as normally shipment_total and tax_total are shown separately.
shipment_total
currencyautoTotal shipping price after discounts.
shipments
ShipmentExpandable list of shipments created from the order.
status
enumautoCurrent status of the order. Can be pending, draft, payment_pending, delivery_pending, hold, complete, or canceled.
Possible enum values:
sub_total
currencyautoSum of all line items before discounts, taxes and shipping.
subscription_delivery
booleanIndicates the order has at least one line item with delivery=subscription.
subscription_id
objectIdautoID of the subscription that spawned the order, if applicable.
subscription
SubscriptionExpandable link to the subscription that spawned the order, if applicable.
tax_included_total
currencyautoTotal of taxes applied separately from line items.
tax_total
currencyautoTotal tax amount applied to the order including line items and shipping.
webhook_attempts_failed
intautoNumber of failed order webhook attempts, if applicable. Value is unset after an order webhook is successfully returned for the record.
webhook_response
stringautoText response of the last failed order webhook attempt, if applicable. Value is unset after an order webhook is successfully returned for the record.
webhook_status
intautoHTTP response status of the last failed order webhook attempt, if applicable. Value is unset after an order webhook is successfully returned for the record.
taxes_fixed
booleanIndicates the order is tax-exempt. Taxes will not be calculated or applied when true.
draft
booleanIndicates that the order is a draft. Draft orders can also be designated as a cart with draft=true (as tracked within the Swell dashboard).
See the cart model for details.
test
booleanIndicates the order was made in test mode.
closed
booleanIndicates the order is closed.
shipment_total_credited
currencyTotal shipping price for items credited on the order.
prev_id
objectIdThis never gets set by Swell. A customer must explicitly set this field to a particular order ID.
prev
OrderIf prev_id is set by the customer, prev will link to the order with the given prev_id.
next_id
objectIdThis never gets set by Swell. A customer must explicitly set this field to a particular order ID.
next
OrderIf next_id is set by the customer, next will link to the order with the given next_id.
account_credit_applied
booleanIndicates the customer’s account credit is applied when submitting the order.
date_webhook_last_succeeded
dateDate the order webhook last succeeded, if applicable. Value is unset after an order webhook fails to return for the record.
date_scheduled
dateScheduled date for the order.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.post('/orders', {
account_id: '5a9ea7ba3f95740a914267f1',
items: [
{
product_id: '5cad15bc9b14d1990724663a',
quantity: 2,
}
],
billing: {
...
},
shipping: {
...
},
coupon_code: 'FREESHIPPING',
});
Response
{
"id": "5cad15bc9b14d1990724663a",
"account_id": "5a9ea7ba3f95740a914267f1",
"billing": {...},
"shipping": {...},
"items": [
{
"id": "5a9ea7ba3f95740a914267f2",
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2,
"price": 9.99,
"price_total": 18.98,
"shipment_weight": 1.5,
...
}
],
"coupon_code": "FREESHIPPING",
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"delivered": false,
"discount_total": 0,
"grand_total": 18.98,
"item_quantity": 2,
"item_shipment_weight": 3.0,
"item_tax": 0,
"number": "100101",
"paid": false,
"payment_balance": -18.98,
"payment_total": 0,
"refund_total": 0,
"refunded": false,
"shipment_price": 0,
"shipment_total": 0,
"status": "payment_pending",
"sub_total": 0,
"tax_total": 0,
...
}
Retrieve an existing order using the ID that was returned when created.
Arguments
id
objectIdrequiredThe id of the order to retrieve.
expand
stringExpanding link fields and child collections is performed using the expand argument.
- For example, expand=account would return a related customer account if one exists.
When the field represents a collection, you can specify the query limit.
- For example, expand=variants:10 would return up to 10 records of the variants collection.
See expanding for more details.
fields
stringReturn only the specified fields in the result. For example fields=name,slug would return only the fields name and slug in the response. Supports nested object and array fields using dot-notation, for example, items.product_id. The category id is always returned.
include
stringInclude one or more arbitrary queries in the response, possibly related to the main query.
See including for more details.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.get('/orders/{id}', {
id: '5cad15bc9b14d1990724663a',
});
Response
{
"id": "5cad15bc9b14d1990724663a",
"account_id": "5a9ea7ba3f95740a914267f1",
"billing": {...},
"shipping": {...},
"items": [
{
"id": "5a9ea7ba3f95740a914267f2",
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2,
"price": 9.99,
"price_total": 18.98,
"shipment_weight": 1.5,
...
}
],
"coupon_code": "FREESHIPPING",
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"delivered": false,
"discount_total": 0,
"grand_total": 18.98,
"item_quantity": 2,
"item_shipment_weight": 3.0,
"item_tax": 0,
"number": "100101",
"paid": false,
"payment_balance": -18.98,
"payment_total": 0,
"refund_total": 0,
"refunded": false,
"shipment_price": 0,
"shipment_total": 0,
"status": "payment_pending",
"sub_total": 0,
"tax_total": 0,
...
}
Update an existing order using the ID that was returned when created. Updating performs a merge operation. To explicitly override values such as arrays, use the $set operator.
Arguments
account_id
objectIdrequiredID of the customer's account.
billing
objectThe customer's billing details. Defaults to account.billing. Updating billing will also update the corresponding account billing object.
billing.account_card_id
objectIdID of the customer's credit card on file, if applicable.
billing.account_card
account_cardExpandable link to the customer's credit card on file, if applicable.
billing.address1
stringBilling address line 1: street address/PO box/company name.
billing.address2
stringBilling address line 2: apartment/suite/unit/building.
billing.amazon
objectAmazon billing details used when billing.method=amazon.
amazon.access_token
stringAmazon access token provided when a customer authorizes payment in a storefront.
amazon.order_reference_id
stringAmazon order reference ID created when a customer initiates payment in a storefront.
amazon.checkout_session_id
stringbilling.card
objectCredit card billing details used when billing.method=card.
card.token
stringToken generated by Swell Checkout or Stripe.js.
card.exp_month
intTwo-digit number representing the credit card expiration month.
card.exp_year
intFour-digit number representing the credit card expiration year.
card.brand
stringCredit card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown.
card.last4
stringLast four digits of the card number.
card.gateway
stringID of the payment gateway that should be used to process payments.
card.test
booleanIndicates this is a test card.
card.address_check
stringWhen used with a payment gateway that performs address checks and address1 was provided, can be pass, fail, unavailable, or unchecked.
card.zip_check
stringWhen used with a payment gateway that performs address checks and zip was provided, can be pass, fail, unavailable, or unchecked.
card.cvc_check
stringWhen used with a payment gateway that performs CVC code checks and cvc was provided, can be pass, fail, unavailable, or unchecked.
billing.city
stringBilling city/district/suburb/town/village.
billing.country
stringTwo-letter ISO code country code.
billing.first_name
stringBilling first name. If name is updated, then first_name will be automatically updated as the first word of the name.
billing.last_name
stringBilling last name. If name is updated, then last_name will be automatically updated as the last words of the name.
billing.method
stringMethod of payment. Can be card, account, amazon, paypal, or any one of the manual methods defined in payment settings.
billing.name
stringBilling full name. If first_name or last_name are updated, then name will be automatically updated as a combination of first/last.
billing.paypal
objectPayPal billing details used when billing.method=paypal.
paypal.payer_id
stringPayPal payer ID provided when a customer authorizes payment in a storefront.
paypal.payment_id
stringPayPal payment ID created when a customer initiates payment in a storefront.
paypal.nonce
stringpaypal.authorization_id
stringpaypal.order_id
stringbilling.phone
stringBilling phone number.
billing.state
stringBilling state/county/province/region.
billing.zip
stringBilling zip/postal code.
billing.default
booleanIndicates billing details represent the customer's default payment method.
billing.intent
objectStores the necessary information about the payment. This is typically the payment ID returned by the gateway after payment is initialized.
billing.affirm
objectAffirm billing details used when billing.method=affirm.
affirm.checkout_token
stringToken used to communicate payment information to the gateway.
billing.resolve
objectResolve billing details used when billing.method=resolve.
resolve.charge_id
stringCharge ID returned by the payment gateway for the payment.
billing.klarna
objectKlarna billing details used when billing.method=klarna.
klarna.source
stringPayment information returned by the gateway during payment initialization.
billing.ideal
objectIdeal billing details used when billing.method=ideal.
ideal.token
stringToken used to communicate payment information to the gateway.
billing.bancontact
objectBancontact billing details used when billing.method=bancontact.
bancontact.source
stringPayment information returned by the gateway during payment initialization.
billing.google
objectGoogle Pay billing details used when billing.method=google.
google.nonce
stringOne-time use reference element used to communicate payment information to a payment gateway.
google.gateway
stringGateway used to facilitate the transaction. For example, Braintree.
billing.apple
objectApple Pay billing details used when billing.method=apple.
apple.nonce
stringOne-time use reference element used to communicate payment information to a payment gateway.
apple.gateway
stringGateway used to facilitate the transaction. For example, Braintree.
billing.instructions
stringcoupon_code
stringCoupon code applied to the order. See coupons for details.
items
array of objectList of line items describing the products ordered.
bundle_items
array of objectList of items offered as a bundle. Defaults to product.bundle_items.
product_id
objectIdrequiredID of the bundle item product.
product
productExpandable link to the bundle item product.
quantity
intQuantity of the bundle item being ordered. Defaults to 1.
shipment_weight
floatWeight to be used in shipping calculation, if applicable.
quantity_restocked
intQuantity of the bundle item that has been restocked after a return, if applicable.
quantity_returnable
intQuantity of the bundle item that can still be returned after fulfillment, if applicable.
variant_id
objectIdID of the bundle item variant.
variant
variantExpandable link to the bundle item product variant.
id
objectIdautoUnique identifier for the object.
delivery
enumMethod of delivery taken automatically from product.delivery.
Possible enum values:
options
array of objectItem options matching one or more of product.options. When adding to the order, you can specify either the option id or name (case-insensitive) to identify the option.
Gift card products have two special options that can be used when fulfilling gift cards by email. Use the option ID send_email and value as the recipient email address, and send_note as a custom message from the customer to the recipient sent by email.
id
stringUnique identifier for the object.
name
stringName of the product option. Populated automatically when adding an option by ID.
price
currencyAdditional price added onto the base price of the product.
shipment_weight
floatAdditional shipping weight added onto the base weight of the product.
value
stringName value of the product option. When adding to the order, specify either the product option value id or name (case-insensitive) to identify the value.
variant
booleanIndicates the option refers to a variant aspect.
value_id
objectIdquantity_canceled
intQuantity of the bundle item canceled before fulfillment, if applicable.
quantity_consumed
intQuantity of stock consumed by the bundle item, if applicable.
quantity_deliverable
intQuantity of the bundle item that can be fulfilled, if applicable.
quantity_delivered
intQuantity of the bundle item that has been fulfilled, if applicable.
quantity_giftcard_deliverable
intQuantity of the bundle item that can be fulfilled by a gift card. Applies when delivery=giftcard.
quantity_returned
intTotal quantity of bundle items that have been returned.
quantity_shipment_deliverable
intQuantity of the bundle item that can be fulfilled by a shipment. Applies when delivery=shipment.
quantity_total
intTotal quantity of the bundle item to be fulfilled, calculated as item.quantity * bundle_item.quantity.
stock_tracking
booleanIndicates whether the bundle item has stock tracking enabled.
quantity_cancelable
intQuantity of bundle items that are able to be canceled.
quantity_shipment_delivered
intQuantity of shipments that have been delivered.
product_name
stringThis field is a copy of the item's product.name.
description
stringDescription used for custom line items, when product is not defined.
discounts
array of objectList of discounts to apply to the item. Normally populated by applying a coupon or promotions.
id
stringrequiredUnique identifier for the object. Should refer to one of the IDs in the order discounts object.
amount
currencyrequiredFixed discount amount.
metadata
objectArbitrary item data, typically set in a checkout flow to store custom values. See Storefront API for details.
options
array of objectItem options matching one or more of product.options. When adding to the order, you can specify either the option id or name (case-insensitive) to identify the option.
Gift card products have two special options that can be used when fulfilling gift cards by email. Use the option ID send_email and value as the recipient email address, and send_note as a custom message from the customer to the recipient sent by email.
id
stringUnique identifier for the object.
name
stringName of the product option. Populated automatically when adding an option by ID.
price
currencyAdditional price added onto the base price of the product.
shipment_weight
floatAdditional shipping weight added onto the base weight of the product.
variant
booleanIndicates the option refers to a variant aspect.
value
stringName value of the product option. When adding to the order, specify either the product option value id or name (case-insensitive) to identify the value.
value_id
objectIdID associate to the value.
price
currencyPrice of the item. Override this value to set a custom price. Defaults to product price or sale price.
product_id
objectIdID of the item product.
quantity
intQuantity of the item being ordered. Defaults to 1.
quantity_restocked
intQuantity of the item that has been restocked after a return, if applicable.
quantity_returnable
intQuantity of the item that can still be returned after fulfillment, if applicable.
quantity_returned
intQuantity of the item that has been returned after fulfillment, if applicable.
shipment_weight
floatWeight to be used in shipping calculation, if applicable.
taxes
array of objectList of tax rules to apply to the item. Normally populated by tax settings.
id
stringrequiredUnique identifier for the object. Should refer to one of the IDs in the order taxes object.
amount
currencyrequiredFixed tax amount.
variant_id
objectIdID of the item variant, if applicable.
id
objectIdautoUnique identifier for the item.
delivery
enumMethod of delivery taken automatically from product.delivery.
Possible enum values:
discount_each
currencyTotal discount amount divided by quantity.
discount_total
currencyTotal discount applied to the item.
orig_price
currencyOriginal item price used internally to determine if the item price was overridden and should be automatically updated when item options are changed.
price_total
currencyTotal price added to sub total by multiplying quantity and price.
product
productExpandable link to the item product.
product_name
stringName of the product.
quantity_canceled
intQuantity of the item canceled before fulfillment, if applicable.
quantity_consumed
intQuantity of stock consumed by the item, if applicable.
quantity_deliverable
intQuantity of the item that can be fulfilled, if applicable.
quantity_delivered
intQuantity of the item that has been fulfilled, if applicable.
quantity_giftcard_deliverable
intQuantity of the item that can be fulfilled by a gift card. Applies when delivery=giftcard.
quantity_shipment_deliverable
intQuantity of the item that can be fulfilled by a shipment. Applies when delivery=shipment.
quantity_subscription_deliverable
intQuantity of the item that can be fulfilled by a subscription. Applies when delivery=subscription.
return_discount_total
currencyTotal discount total for returned items.
return_price_total
currencyTotal price of returned items.
return_tax_total
currencyTotal tax amount of returned items.
shipment_location
stringID of location from /settings/shipping/locations. If specified, shipping is calculated from this location. Otherwise, the store's default location will be used.
stock_tracking
booleanIndicates whether the item has stock tracking enabled.
subscription_date_period_start
dateStart date for subscription period.
subscription_paid
booleanIndicates the item has been fulfilled as a subscription and marked as paid by reference to this order.
tax_each
currencyTotal tax amount divided by quantity.
tax_total
currencyTotal tax applied to the item.
variant
variantExpandable link to the item variant, if applicable.
quantity_cancelable
intQuantity of items that can be canceled.
quantity_credited
intAmount of items credited.
quantity_creditable
intQuantity of items eligible to be used with credit.
quantity_invoiceable
intQuantity of items eligible to be invoiced.
quantity_invoiced
intQuantity of invoiced items.
quantity_total
intTotal quantity of items.
quantity_subscription_delivered
intQuantity of subscriptions delivered.
purchase_option
objectPurchase option selected; standard for one-time purchases or subscription for a subscription plan.
purchase_option.type
enumDesignates the type of purchase option: standard for one-time purchases, subscription for a subscription plan.
Possible enum values:
purchase_option.id
objectIdID of the purchase option.
purchase_option.name
stringThe name of the purchase option.
purchase_option.price
currencyPrice of the purchase option.
purchase_option.plan_id
objectIdID of the subscription plan, if applicable.
purchase_option.plan_name
stringName of the subscription plan, if applicable.
purchase_option.billing_schedule
objectBilling schedule for the subscription plan, if applicable.
billing_schedule.interval
enumBilling interval for the subscription plan. Can be monthly, weekly, daily, or yearly.
Possible enum values:
billing_schedule.interval_count
intMultiplier for the billing interval. For example, to make the subscription charge once every 2 weeks, set interval=weekly and interval_count=2.
billing_schedule.trial_days
intNumber of days the subscription trial period is for. An invoice will not be issued until trial has elapsed.
billing_schedule.limit
intSpecifies a limit to the number of billing cycles for the subscription plan. For example, "limit"=10 would stop billing the customer after the tenth billing cycle.
purchase_option.order_schedule
objectorder_schedule.interval
enumFrequency of order generation for the subscription plan. Can be monthly, daily, weekly, or yearly.
Possible enum values:
order_schedule.interval_count
intMultiplier when combined with order interval. For example, to generate an order every two weeks, set interval=weekly and interval_count=2.
order_schedule.limit
intLimit to number of orders generated for the purchase option.
purchase_option.plan_description
stringshipping
objectThe customer's shipping details. Defaults to account.shipping. Updating shipping will also update the corresponding account shipping object.
shipping.account_address_id
objectIdID of the customer's address on file.
shipping.account_address
account_addressExpandable link to the customer's address on file.
shipping.address1
stringShipping address line 1: street address/PO box/company name.
shipping.address2
stringShipping address line 2: apartment/suite/unit/building.
shipping.city
stringShipping city/district/suburb/town/village.
shipping.country
stringTwo-letter ISO country code.
shipping.default
booleanIndicates shipping details represent the customer's default shipping address.
shipping.first_name
stringShipping first name. If name is updated, then first_name will be automatically updated as the first word of the name.
shipping.last_name
stringShipping last name. If name is updated, then last_name will be automatically updated as the last words of the name.
shipping.name
stringShipping full name. If first_name or last_name are updated, then name will be automatically updated as a combination of first/last.
shipping.phone
stringShipping phone number.
shipping.price
currencyPrice of the shipping service. Defaults to shipment_rating.services.price chosen by setting service.
shipping.service
stringID of a shipping service as configured in shipment settings. Normally, this would be applied after retrieving shipping rates by using one of the shipment_rating.services.id values.
shipping.service_name
stringName of the shipping service. Defaults to shipment_rating.services.name chosen by setting service.
shipping.state
stringShipping state/county/province/region.
shipping.zip
stringShipping zip/postal code.
shipping.pickup
booleanIndicates whether shipping for local pick-up.
id
objectIdrequiredUnique identifier for the order.
account
AccountExpandable link to the customer's account.
account_credit_amount
currencyAmount of customer's account credit applied for initial payment, if applicable.
account_credit_applied
booleanIndicates the customer’s account credit is applied when submitting the order.
account_info_saved
booleanIndicates the customer chose to save shipping and billing information to their account when submitting the order.
account_logged_in
booleanIndicates the customer was logged into their account when placing the order.
authorized_payment
PaymentExpandable link to an authorized payment.
authorized_payment_id
stringautoThe id of an authorized payment. When "Require payment authorization" is enabled in payment settings, the order will be rejected if initial payment fails.
cancel_reason
stringA message describing the reason for cancelling the order, if applicable.
canceled
booleanIndicates the order was completely canceled.
cart
CartExpandable link to the cart.
cart_id
objectIdautoID of the cart that converted to this order, if applicable.
closed
booleanIndicates the order is closed.
comments
stringCustomer notes provided when placing the order, if any.
coupon
CouponExpandable link to the coupon applied to the order.
coupon_id
objectIdID of the coupon applied to the order.
credit_total
currencyTotal amount of additional credit applied to the order.
credits
Credit memoExpandable list of account credit transactions. Balance of these transactions is kept in balance.
currency
stringThree-letter ISO currency code in uppercase. Defaults to the store's base currency.
currency_rate
floatCurrency percentage used in calculating the fixed amount.
date_canceled
dateDate the order was canceled, if applicable.
date_payment_retry
dateWhen automated payment has failed, this is the date when the system will automatically retry.
date_period_end
dateautoPeriod end date applicable when the order was created from a subscription.
date_period_start
dateautoPeriod start date applicable when the order was created from a subscription.
date_scheduled
dateScheduled date for the order.
date_webhook_first_failed
dateautoDate the order webhook first failed, if applicable. Value is unset after an order webhook is successfully returned for the record.
date_webhook_last_succeeded
dateDate the order webhook last succeeded, if applicable. Value is unset after an order webhook fails to return for the record.
delivered
booleanautoIndicates the order was completely fulfilled. Always true when delivery_marked=true, otherwise depends on the sum of shipments, giftcards, and subscriptions.
delivery_marked
booleanIndicates the order was marked as fulfilled, manually or automatically.
discount_total
currencyautoTotal discount amount.
discounts
array of objectList of discounts applied to the order.
id
stringUnique identifier for the object.
amount
currencyFixed discount amount.
rule
objectObject describing the discount rule details. Custom discounts don't require this value.
type
stringType of discount. Can be coupon or promo-<id> referring to the source of the discount. Custom discounts don't require this value.
display_currency
stringThree-letter ISO currency code representing the user's preferred display currency, if applicable.
display_locale
stringLocale code representing the user's preferred display locale, if applicable.
draft
booleanIndicates that the order is a draft. Draft orders can also be designated as a cart with draft=true (as tracked within the Swell dashboard).
See the cart model for details.
gift
booleanIndicates the order is intended as a gift for the recipient.
gift_message
stringOptional message to include with the order when shipping to the recipient.
giftcard_delivery
booleanIndicates the order has at least one line item with delivery=giftcard.
giftcard_total
currencyTotal payment amount applied to the order from giftcards.
giftcards
array of objectList of gift cards applied to the order.
amount
currencyAmount of the gift card balance to spend on this order. Defaults to giftcard.balance.
code
stringSpecify a gift card code to apply to the order. If the code is not found or invalid, a validation error is returned. Case-insensitive.
id
objectIdUnique identifier for the object.
code_formatted
stringFully formatted gift card code for display purposes.
last4
stringLast four digits of the gift card code.
giftcard
giftcardExpandable link to the gift card record.
grand_total
currencyautoGrand total including items, shipping and taxes.
guest
booleanIndicates the customer was not logged in when placing the order.
hold
booleanIndicates the order was placed on hold.
invoices
InvoiceExpandable link to the invoice the payment was applied to, if applicable.
item_discount
currencyautoTotal discount applied to line items.
item_quantity
intautoTotal quantity of all line items.
item_quantity_cancelable
intTotal quantity of cancelable items on the order.
item_quantity_canceled
intautoTotal quantity of line items canceled.
item_quantity_creditable
intTotal quantity of line items that can be credited.
item_quantity_credited
intTotal quantity of items credited on the order.
item_quantity_deliverable
intautoTotal quantity of line items that can be fulfilled.
item_quantity_delivered
intautoTotal quantity of line items that have been fulfilled.
item_quantity_giftcard_deliverable
intautoTotal quantity of line items that can be fulfilled by gift card. Applies when item.delivery=giftcard.
item_quantity_invoiceable
intTotal quantity of items eligible for invoicing on the order.
item_quantity_invoiced
intTotal quantity of items invoiced on the order.
item_quantity_returnable
intautoTotal quantity of line items that can still be returned.
item_quantity_returned
intautoTotal quantity of line items that have been returned.
item_quantity_shipment_deliverable
intautoTotal quantity of line items that can be fulfilled by shipment. Applies when item.delivery=shipment.
item_quantity_subscription_deliverable
intautoTotal quantity of line items that can be fulfilled by subscription. Applies when item.delivery=subscription.
item_shipment_weight
floatTotal shipping weight of all line items.
item_tax
currencyautoTotal taxes applied to line items.
item_tax_included
booleanIndicates line item prices include taxes.
metadata
objectArbitrary data, typically set in a checkout flow to store custom values. See Storefront API for details.
next
OrderIf next_id is set by the customer, next will link to the order with the given next_id.
next_id
objectIdThis never gets set by Swell. A customer must explicitly set this field to a particular order ID.
notes
stringInternal admin notes, not visible to the customer.
notifications
NotificationExpandable list of notifications sent on behalf of the order.
number
stringautoUnique incremental order number, assigned automatically using a format configured in general settings.
paid
booleanautoIndicates the order was paid in full. Always true when payment_marked=true, otherwise depends on the sum of payments.
parent
OrderExpandable link to the parent order.
parent_id
objectIdID of the parent order.
payment_balance
currencyautoBalance of payments. A negative number indicates payment is owed, a positive balance indicates a refund is due, and a zero balance indicates fully paid.
payment_error
stringA message describing the last payment error, if one occurred.
payment_marked
booleanIndicates the order was marked as paid, manually or automatically.
payment_retry_count
intThe number of times automatic payment has been attempted.
payment_retry_resolve
stringThe method used to resolve automatic payment when all retry attempts are exhausted. Can be blank (do nothing), canceled, or unpaid.
payment_total
currencySum of payments applied to the order, not including refunds.
payments
PaymentExpandable list of payments applied to the order.
pending_invoices
InvoiceExpandable list of invoices that haven't been fully paid.
prev
OrderIf prev_id is set by the customer, prev will link to the order with the given prev_id.
prev_id
objectIdThis never gets set by Swell. A customer must explicitly set this field to a particular order ID.
promotion_ids
array of child_scalarList of promotion IDs applied to the order.
promotions
PromotionExpandable list of promotions applied to the order.
refund_marked
booleanSet true mark the order as fully refunded, regardless of refund records.
refund_total
currencySum of refunds on payments applied to the order.
refunded
booleanautoIndicates the order was fully refunded. Always true when refund_marked=true, otherwise depends on the sum of refunds.
refunds
RefundExpandable list of refunds applied to the order.
return_credit_tax
currencyTotal additional credit tax applied to the order from returns, if applicable
return_credit_total
currencyTotal additional credit amount applied to the order from returns.
return_item_tax
currencyautoTotal tax amount of items returned.
return_item_tax_included
currencyautoTotal tax included amount of items returned, separate from line item values.
return_item_total
currencyautoTotal amount of items returned, minus discounts.
return_total
currencyGrand total amount applied to the order from returns.
shipment_delivery
booleanIndicates the order has at least one line item with delivery=shipment.
shipment_discount
currencyShipping discount applied by coupons, promotions, or custom logic.
shipment_price
currencyautoTotal shipping price before discounts.
shipment_rating
objectautoObject describing the shipping services and rates available for the order. Shipping country must be set before retrieving shipping rates.
shipment_rating.errors
array of objectList of errors generated while retrieving rates, if any. When using third-party shipping services, any system errors will be listed here.
code
stringUnique code describing the error.
message
stringMessage describing the error.
shipment_rating.fingerprint
stringUnique fingerprint identifying the parameters used to calculate shipping rates. Rates should always be the same given the same parameters and shipping settings.
shipment_rating.services
array of objectList of shipping services and rates available.
id
stringUnique identifier for the object.
carrier
stringName of a third-party carrier offering the service, if applicable.
name
stringName of the shipping service.
price
currencyPrice of the shipping service.
pickup
booleanIndicates whether shipping service is local pick-up.
tax_code
stringApplicable tax code for shipment rating, if applicable.
shipment_tax
currencyShipping tax amount, if applicable.
shipment_tax_included
booleanIndicates shipping total includes taxes, if applicable.
shipment_tax_included_total
currencyautoTotal shipping price including taxes and discount. Allows for an alternate display style as normally shipment_total and tax_total are shown separately.
shipment_total
currencyautoTotal shipping price after discounts.
shipment_total_credited
currencyTotal shipping price for items credited on the order.
shipments
ShipmentExpandable list of shipments created from the order.
status
enumautoCurrent status of the order. Can be pending, draft, payment_pending, delivery_pending, hold, complete, or canceled.
Possible enum values:
sub_total
currencyautoSum of all line items before discounts, taxes and shipping.
subscription
SubscriptionExpandable link to the subscription that spawned the order, if applicable.
subscription_delivery
booleanIndicates the order has at least one line item with delivery=subscription.
subscription_id
objectIdautoID of the subscription that spawned the order, if applicable.
tax_included_total
currencyautoTotal of taxes applied separately from line items.
tax_total
currencyautoTotal tax amount applied to the order including line items and shipping.
taxes
array of objectList of taxes applied to the order.
id
stringUnique identifier for the object.
amount
currencyFixed tax amount.
name
stringName of the tax rule. For example, "NY Sales Tax".
priority
intPriority indicates the order in which a tax rule was applied. Higher priority rules are added on top of other tax rules with a lower priority. Rules with the same priority are calculated excluding each other.
rate
floatTax percentage used in calculating the fixed amount.
shipping
booleanIndicates the tax applies to shipping.
taxes_fixed
booleanIndicates the order is tax-exempt. Taxes will not be calculated or applied when true.
test
booleanIndicates the order was made in test mode.
webhook_attempts_failed
intautoNumber of failed order webhook attempts, if applicable. Value is unset after an order webhook is successfully returned for the record.
webhook_response
stringautoText response of the last failed order webhook attempt, if applicable. Value is unset after an order webhook is successfully returned for the record.
webhook_status
intautoHTTP response status of the last failed order webhook attempt, if applicable. Value is unset after an order webhook is successfully returned for the record.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.put('/orders/{id}', {
id: '5cad15bc9b14d1990724663a',
shipping: {
name: 'Jon Snow',
address1: '1 Main Street',
city: 'Brooklyn',
state: 'NY',
zip: '11201',
country: 'US',
phone: '(555) 555-5555',
},
});
Response
{
"id": "5cad15bc9b14d1990724663a",
"account_id": "5a9ea7ba3f95740a914267f1",
"billing": {...},
"shipping": {
"name": "Jon Snow",
"first_name": "Jon",
"last_name": "Snow",
"address1": "1 Main Street",
"city": "Brooklyn",
"state": "NY",
"zip": "11201",
"country": "US",
"phone": "(555) 555-5555"
},
"items": [
{
"id": "5a9ea7ba3f95740a914267f2",
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2,
"price": 9.99,
"price_total": 18.98,
"shipment_weight": 1.5,
...
}
],
"coupon_code": "FREESHIPPING",
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"date_updated": "2019-04-01T00:00:00.000Z",
"delivered": false,
"discount_total": 0,
"grand_total": 18.98,
"item_quantity": 2,
"item_shipment_weight": 3.0,
"item_tax": 0,
"number": "100101",
"paid": false,
"payment_balance": -18.98,
"payment_total": 0,
"refund_total": 0,
"refunded": false,
"shipment_price": 0,
"shipment_total": 0,
"status": "payment_pending",
"sub_total": 0,
"tax_total": 0,
...
}
Return a list of orders.
Arguments
expand
stringExpand link fields and child collections by using the expand argument.
- For example, expand=account would return a related customer account if one exists.
When the field represents a collection, you can specify the query limit.
- For example, expand=variants:10 would return up to 10 records of the variants collection.
See expanding for more details.
fields
stringReturns only the specified fields in the result.
- For example fields=name,slug would return only the fields name and slug in the response.
Supports nested object and array fields using dot-notation.
- For example, items.product_id. The product id is always returned.
include
objectInclude one or more arbitrary queries in the response which are potentially related to the main query.
See including for more details.
limit
intLimit the number of records returned, ranging between 1 and 1000. Defaults to 15.
page
intThe page number of results to return given the specified or default limit.
search
stringA text search is performed using the search argument. Searchable fields are defined by the model.
- For example, search=red would return records containing the word "red" anywhere in the defined text fields.
See searching for more details.
sort
stringExpression to sort results by using a format similar to a SQL sort statement.
- For example, sort=name asc would return records sorted by name ascending.
See sorting for more details.
where
objectAn object with criteria to filter the result.
- For example, active=true would return records containing a field active with the value true.
It's also possible to use query operators, for example, $eq, $ne, $gt, and more.
See querying for more details.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.get('/orders', {
where: {
account_id: '592ef41c57ce232e1ce3729e',
},
limit: 25,
page: 1,
});
Response
{
"count": 51,
"results": [
{
"id": "5cad15bc9b14d1990724663a",
"account_id": "5a9ea7ba3f95740a914267f1",
"billing": {...},
"shipping": {
"name": "Jon Snow",
"first_name": "Jon",
"last_name": "Snow",
"address1": "1 Main Street",
"city": "Brooklyn",
"state": "NY",
"zip": "11201",
"country": "US",
"phone": "(555) 555-5555"
},
"items": [
{
"id": "5a9ea7ba3f95740a914267f2",
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2,
"price": 9.99,
"price_total": 18.98,
"shipment_weight": 1.5,
...
}
],
"coupon_code": "FREESHIPPING",
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"date_updated": "2019-04-01T00:00:00.000Z",
"delivered": false,
"discount_total": 0,
"grand_total": 18.98,
"item_quantity": 2,
"item_shipment_weight": 3.0,
"item_tax": 0,
"number": "100101",
"paid": false,
"payment_balance": -18.98,
"payment_total": 0,
"refund_total": 0,
"refunded": false,
"shipment_price": 0,
"shipment_total": 0,
"status": "payment_pending",
"sub_total": 0,
"tax_total": 0,
...
},
{...},
{...}
],
"page": 1,
"pages": {
"1": {
"start": 1,
"end": 25
},
"2": {
"start": 26,
"end": 50
},
"2": {
"start": 51,
"end": 51
}
}
}
Delete an order permanently.
Arguments
id
objectIdrequiredThe id of the order to delete.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.delete('/orders/{id}', {
id: '5cad15bc9b14d1990724663a',
});
Response
{
"id": "5cad15bc9b14d1990724663a",
"account_id": "5a9ea7ba3f95740a914267f1",
"billing": {...},
"shipping": {
"name": "Jon Snow",
"first_name": "Jon",
"last_name": "Snow",
"address1": "1 Main Street",
"city": "Brooklyn",
"state": "NY",
"zip": "11201",
"country": "US",
"phone": "(555) 555-5555"
},
"items": [
{
"id": "5a9ea7ba3f95740a914267f2",
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2,
"price": 9.99,
"price_total": 18.98,
"shipment_weight": 1.5,
...
}
],
"coupon_code": "FREESHIPPING",
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"date_updated": "2019-04-01T00:00:00.000Z",
"delivered": false,
"discount_total": 0,
"grand_total": 18.98,
"item_quantity": 2,
"item_shipment_weight": 3.0,
"item_tax": 0,
"number": "100101",
"paid": false,
"payment_balance": -18.98,
"payment_total": 0,
"refund_total": 0,
"refunded": false,
"shipment_price": 0,
"shipment_total": 0,
"status": "payment_pending",
"sub_total": 0,
"tax_total": 0,
...
}