dineup-nodejs
v1.0.15
Published
This library provides convenient access to the DineUp API for server-side applications.
Downloads
40
Readme
DineUp Node.js Server Library
This library provides convenient access to the DineUp API for server-side applications.
Requires Node.js v16+
Installation
Install the package with:
npm install dineup-nodejs --save
Usage
This package requires a DineUp API key. If you are a partner with DineUp, contact us to get your API keys.
const dineup = require('dineup-nodejs')('sk_test_...');
dineup.createOrder({
...
})
.then(order=> console.log(order))
.catch(error=> console.error(error));
Or using ES modules and async/await
import DineUp from 'dineup-nodejs';
const dineup = new DineUp('sk_test_...');
const order = await dineup.createOrder({
...
})
console.log(order);
Typescript
This package includes TypeScript types
Documentation
createOrder(options: CreateOrderOptions): Promise<Order>
createOrder
creates a new order for the specified airport, flight and customer.
CreateOrderOptions {
airport_code: string // IATA code
customer_email: string
customer_first_name: string
customer_last_name: string
type: "embed"; // Currently only embed order type is supported
embed_view_style: "flat"; // Currently only flat view style is supported
flight_date: Date
flight_identifier: string // flight designator or tail number
}
getOrder(id: string): Promise<Order>
confirmOrder(id: string): Promise<Order>
confirmOrder
creates a submitted order and sets submitted_line_items
from the cart_line_items
Types
Order {
flight_identifier: string;
id: string;
client_secret: string;
cart_line_items: LineItem[];
submitted_line_items: LineItem[];
state: OrderState;
}
LineItem {
id: string;
amount: number;
image_url: string;
name: string;
product_id: string;
quantity: number;
special_request: string;
}
OrderState = {
Created,
Started,
Captured,
Paid,
Delivered,
Completed,
Failed,
Cancelled
};