@doordash/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.6.12 • Public • Published

DoorDash Node.js SDK

This is a Node.js SDK for the DoorDash API which includes the ability to request deliveries through the Drive API.

Prerequisite

node >= 12

Install

$ npm install --save @doordash/sdk

How to use

If you are using CommonJS modules:

const DoorDashClient = require("@doordash/sdk");
const { v4: uuidv4 } = require("uuid");

const client = new DoorDashClient.DoorDashClient({
  developer_id: "{your developer_id}",
  key_id: "{your key_id}",
  signing_secret: "{your signing_secret}",
});

const response = client
  .createDelivery({
    external_delivery_id: uuidv4(),
    pickup_address: "1000 4th Ave, Seattle, WA, 98104",
    pickup_phone_number: "+1(650)5555555",
    dropoff_address: "1201 3rd Ave, Seattle, WA, 98101",
    dropoff_phone_number: "+1(650)5555555",
  })
  .then(() => {
    // do something
  })
  .catch((err) => {
    // handle error
  });

If you are using ES6 modules:

import { DoorDashClient } from "@doordash/sdk";
import { v4 as uuidv4 } from "uuid";

const client = new DoorDashClient({
  developer_id: "{your developer_id}",
  key_id: "{your key_id}",
  signing_secret: "{your signing_secret}",
});

const response = await client.createDelivery({
  external_delivery_id: uuidv4(),
  pickup_address: "1000 4th Ave, Seattle, WA, 98104",
  pickup_phone_number: "+1(650)5555555",
  dropoff_address: "1201 3rd Ave, Seattle, WA, 98101",
  dropoff_phone_number: "+1(650)5555555",
});

If you are using TypeScript:

import {
  DeliveryResponse,
  DoorDashAuthorizationError,
  DoorDashClient,
  DoorDashResponse,
} from "@doordash/sdk";

import { v4 as uuidv4 } from "uuid";

const client = new DoorDashClient({
  developer_id: "{your developer_id}",
  key_id: "{your key_id}",
  signing_secret: "{your signing_secret}",
});

client
  .createDelivery({
    external_delivery_id: uuidv4(),
    pickup_address: "1000 4th Ave, Seattle, WA, 98104",
    pickup_phone_number: "+1(650)5555555",
    dropoff_address: "1201 3rd Ave, Seattle, WA, 98101",
    dropoff_phone_number: "+1(650)5555555",
  })
  .then((response: DoorDashResponse<DeliveryResponse>) => {
    // do something
  })
  .catch((err: any) => {
    // handle error
  });

How can I get onboarded to DoorDash Drive?

Please visit DoorDash Developer portal for more details.

Does the SDK support DoorDash Drive Classic API?

No. SDK will only support the latest version of Drive API not support Drive Classic API.

Package Sidebar

Install

npm i @doordash/sdk

Weekly Downloads

1,949

Version

0.6.12

License

MIT

Unpacked Size

186 kB

Total Files

25

Last publish

Collaborators

  • doordash-admin
  • ryngonzalez
  • markn
  • shayon
  • ifsred
  • badsauce
  • hweeks
  • andymaidd
  • thanmayaraghuram
  • eien
  • cburbank
  • msitter