UNPKG

shopify-admin-api

Version:

Shopify Admin API is a NodeJS library built to help developers easily authenticate and make calls against the Shopify API. It was inspired by and borrows heavily from ShopifySharp.

270 lines (269 loc) 8.81 kB
import { Address } from './address'; import { Customer } from './customer'; import { DiscountCode } from './discount_code'; import { LineItem } from './line_item'; import { NoteAttribute } from './note_attribute'; import { ShippingLine } from './shipping_line'; import { ShippingRate } from './shipping_rate'; import { TaxLine } from './tax_line'; /** * Represents an abandoned checkout. */ export interface Checkout { /** * A unique identifier for a particular checkout. */ token: string; /** * The discount metadata generated by applying a discount code. A custom discount can also be added by specifying values for amount, title, description, value, and value_type. */ applied_discount: { /** * The amount that is deducted from payment_due in presentment currency. */ amount: string; /** * The title to categorize the applied discount. */ title: string; /** * The description of the applied discount. */ description: string; /** * The value that was used to calculate the final applied discount amount. */ value: string; /** * The type of value that was used to calculate the final applied discount amount. Valid values: `fixed_amount` and `percentage`. */ value_type: 'fixed_amount' | 'percentage'; /** * The reason why the discount is not applicable, if the discount cannot be applied to the checkout. */ non_applicable_reason: string | null; /** * Whether this discount code can be applied to the checkout. */ applicable: boolean; }; /** * The recovery URL that's sent to a customer so they can recover their checkout. * @deprecated */ abandoned_checkout_url?: string; /** * The mailing address associated with the payment method. * @readonly */ billing_address: Address; /** * Whether the customer would like to receive email updates from the shop. * This is set by the "I want to receive occasional emails about new products, promotions and other news" checkbox during checkout. */ buyer_accepts_marketing: boolean; /** * The ID for the cart that's attached to the checkout. * @deprecated */ cart_token?: string | null; /** * The date and time (ISO 8601 format) when the checkout was closed. If the checkout was not closed, then this value is null. * @readonly */ closed_at: string | null; /** * The date and time (ISO 8601 format) when the checkout was completed. For abandoned checkouts, this value is always null. * @readonly */ completed_at: string | null; /** * The date and time (ISO 8601 format) when the checkout was created. * @readonly */ created_at: string; /** * The three-letter code (ISO 4217 format) of the shop's default currency at the time of checkout. * For the currency that the customer used at checkout, see presentment_currency. * @readonly */ currency: string; /** * Information about the customer. For more information, see the Customer resource. */ customer: Customer; /** * The two or three-letter language code, optionally followed by a region modifier. * Example values: en, en-CA. */ customer_locale: string | null; /** * The ID of the Shopify POS device that created the checkout. */ device_id: number | null; /** * Discount codes applied to the checkout. Returns an empty array when no codes are applied. */ discount_codes: DiscountCode[]; /** * The customer's email address. */ email: string | null; /** * The payment gateway used by the checkout. For abandoned checkouts, this value is always null for abandoned checkouts. */ gateway: string | null; /** * The URL for the page where the customer entered the shop. */ landing_site: string; /** * A list of line items, each containing information about an item in the checkout. */ line_items: LineItem[]; /** * The ID of the physical location where the checkout was processed. */ location_id: number | null; /** * The text of an optional note that a shop owner can attach to the order. */ note: string | null; /** * Extra information that is added to the order. */ note_attributes: NoteAttribute[]; /** * An object containing the ID, name, and status page URL of the associated order when the checkout is complete. * Default value: null. * @readonly */ order: { id: number; name: string; status_url: string; } | null; /** * The amount left to be paid in presentment currency. * This is equal to the sum of the checkout line prices, taxes, and shipping minus discounts and gift cards. * @readonly */ payment_due: string; /** * The URL that must be used to store credit cards in Shopify's card vault. * These URLs are subject to change, so you should always use the one supplied here. * The general pattern for the URLs is https://elb.deposit.shopifycs.com/sessions. * @readonly */ payment_url: string; /** * The customer's phone number. */ phone: string | null; /** * The three-letter code (ISO 4217 format) of the currency that the customer used at checkout. * For the shop's default currency, see currency. * */ presentment_currency: string; /** * Whether the checkout requires shipping. * If true, then `shipping_line` must be set before creating a payment. * @readonly */ requires_shipping: boolean; /** * The website that referred the customer to the shop. */ referring_site: string | null; /** * The mailing address where the order will be shipped to. */ shipping_address?: Address; /** * The selected shipping rate. * A new shipping rate can be selected by updating the value for `handle`. * A shipping line is required when `requires_shipping` is `true`. * Learn more about selecting shipping rates: https://shopify.dev/docs/admin-api/rest/reference/sales-channels/checkout#shipping_rates */ shipping_line: ShippingLine; /** * Information about the chosen shipping method. */ shipping_lines: ShippingLine[]; /** * The selected shipping rate. This property is not writable. * @readonly */ shipping_rate: ShippingRate; /** * undocumented; always null in test data */ source?: null | any; /** * undocumented string, which seems to be of the format `${location_id}-${POS_DEVICE_ID}-${POS_ORDER_NUMBER}` for POS orders, where `POS_DEVICE_ID` is an id associated with the device and `POS_ORDER_NUMBER` is counted up for each separate device */ source_identifier: string | null; /** * Where the checkout originated. * Valid values: web, pos, iphone, android. */ source_name: string; /** * undocumented; always null in test data */ source_url?: null | any; /** * The price of the checkout before shipping and taxes. * @readonly */ subtotal_price: string; /** * An array of tax line objects, each of which details a tax applicable to the checkout. */ tax_lines: TaxLine[]; /** * Whether taxes are included in the price. * @readonly */ taxes_included: boolean; /** * The total amount of discounts to be applied. * @deprecated */ total_discounts?: string; /** * The sum of the prices of all line items in the checkout. */ total_line_items_price: string; /** * The sum of the prices of all line items in the checkout, discounts, shipping costs, and taxes. * @readonly */ total_price: string; /** * The sum of all the taxes applied to the checkout. * @readonly */ total_tax: string; /** * The sum of all the weights in grams of the line items in the checkout. * @deprecated */ total_weight?: number; /** * The date and time (ISO 8601 format) when the checkout was last modified. * @readonly */ updated_at: string; /** * The ID of the user who created the checkout. This value is passed to the order. Default value: null. */ user_id: number | null; /** * The URL pointing to the checkout accessible from the web. * E.g. `"https://checkout.shopify.com/112233/checkouts/4207896aad57dfb159?key=123abc"` * @readonly */ web_url: string; }