UNPKG

@bebapps/rapyd-sdk

Version:

An un-official [Rapyd](https://rapyd.net) SDK for Node.js.

115 lines (113 loc) 4.24 kB
import { Payment } from './Payment'; import { Address } from './Address'; export interface Order { /** * Unique ID of the Order object. If the merchant does not define an ID, Rapyd generates a string starting with **order_**. */ id: `order_${string}`; /** * - **In request:** In each item of type **sku**, the cost of one individual item, in units specified in `currency`. Decimal, including the correct number of decimal places for the currency exponent, as defined in ISO 2417:2015. If the amount is a whole number, use an integer and not a decimal. * * - **In response:** Total amount of the order, the sum of the amount of the 'shipping' items, plus the `amount` of the tax, plus `amount` times `quantity` of each of the 'sku' items. Decimal. Response only. */ amount: number; /** * Total amount of returns against the order. Decimal. Response only. */ amount_returned: number; /** * ID of a discount coupon that is applied against this order. The coupon `duration` must be **once**. */ coupon: string; /** * When the order was created, in [*Unix time*](ref:glossary). Response only. */ created: number; /** * Three-letter ISO 4217 code for the currency used in the 'item' objects. Uppercase. */ currency: string; /** * ID of the customer. String starting with **cus_**. */ customer: `cus_${string}`; /** * Contains information about the coupon that applies to the subscription. Response only. * * Adding a discount is a 2-step process: * 1. [Create Coupon](ref:create-coupon), which returns a coupon ID. * 2. Add the coupon ID to the `coupon` field of the order with [Create an Order](ref:create-an-order) or [Update Order](ref:update-order). * * For more information, see [Discount Object](ref:discount-object). */ discount: string; /** * Email address of the customer. */ email: string; /** * ID for the coupon, defined by the merchant. */ external_coupon_code: string; /** * Each item describes one charge in this invoice. There must be one item of `type` = **shipping** and at least one item of `type` = **sku**. * * See ***Items Object***, below. */ items: (object)[]; /** * A JSON object defined by the client. */ metadata: object; /** * Describes the collection efforts being made against this order. Read-only. See [Payment Object](ref:payment-object). */ payment: Partial<Payment>; /** * Payment method ID. String starting with **card_** or **other_**. * * If not specified in this field, the payment method is the default payment method specified for the customer. * * To create a payment method token, use the [Add Payment Method](ref:add-payment-method) method. */ payment_method: `card_${string}`; /** * A list of the returns charged against this order. */ returns: (object)[]; /** * Address to receive the shipment. For more information, see [Address Object](ref:address-object). */ shipping_address: Partial<Address>; /** * Indicates the status of the order. One of the following: * * **created** - Created. * * **pending** - The collection process has been started. * * **paid** - Paid in full. * * **canceled** - The total amount of returns against this order equal the total amount of the order. * * **fulfilled** - The products have been delivered to the customer. * * **returned** - A return has been processed against this order. */ status: 'created' | 'pending' | 'paid' | 'canceled' | 'fulfilled' | 'returned'; /** * Records the number of transitions to each possible status. Each field contains an integer. Read-only. Contains the following fields: * * `canceled` * * `fulfilled` * * `paid` * * `pending` * * `returned` */ status_transitions: { canceled: unknown; fulfilled: unknown; paid: unknown; pending: unknown; returned: unknown }; /** * Percentage of tax to charge. Decimal 0-100, up to four decimal places. */ tax_percent: number; /** * Time the order was last updated, in [*Unix time*](ref:glossary). Response only. */ updated: number; /** * Merchant-defined ID for the order. */ upstream_id: string; };