Spree DoorDash
This is a DoorDash Drive delivery extension for Spree Commerce, an open source e-commerce platform built with Ruby on Rails. It's the companion to spree_square — quotes and dispatches DoorDash Drive deliveries for completed Spree orders, keyed off each order's fulfilling location.
⚠️ DoorDash Drive API production access is currently restricted by DoorDash, with no committed timeline — see their Get Started guide. Sandbox is fully open, and this extension's entire flow (live quoting, dispatch, webhook-driven status sync, admin diagnostics) is built and verified end to end against Sandbox — including DoorDash's own Delivery Simulator — without ever needing production approval. Going live requires DoorDash's separate approval on their own timeline.
What this does
- Live delivery-fee quoting at checkout —
Spree::Calculator::Shipping::DoordashQuoterequests a real DoorDash quote and shows it as an ordinary shipping rate, no custom storefront code needed. - Dispatch on order completion — accepts the checkout-time quote (re-quoting first if it's expired; DoorDash quotes are only valid 5 minutes) and creates the real delivery.
- Delivery status synced back via webhooks — a Dasher picking up/dropping off/canceling the order updates the Spree shipment/order state automatically.
- Admin visibility — DoorDash Deliveries and DoorDash Webhooks pages for support/diagnostics.
Installation
-
Add this extension to your Gemfile with this line:
bundle add spree_doordash -
Run the install generator
bundle exec rails g spree_doordash:install -
Restart your server
If your server was running, restart it so that it can find the assets properly.
Connecting to DoorDash
DoorDash Drive auth has no OAuth/refresh flow — a static access key, created once, signs a fresh short-lived JWT on every API call:
- Create a DoorDash Developer Portal account and create an
access key (Credentials in the left nav). This gives you a
developer_id,key_id, andsigning_secret. - In your Spree admin, go to DoorDash Connection in the sidebar and paste the three values
in. They're encrypted at rest (ActiveRecord::Encryption) —
same mechanism
spree_squareuses for its own credentials, sharing the sameACTIVE_RECORD_ENCRYPTION_*keys. - Configure a webhook endpoint for delivery status updates in the Developer Portal's
Webhooks page (Sandbox and Production each support one endpoint), protected with Basic
Auth. Paste that exact
Authorizationheader value into the Webhook Basic Auth value field on the same connection page — it's a static string DoorDash echoes back verbatim on every webhook, not a credential DoorDash itself authenticates. - Point the webhook URL at
POST /spree_doordash/webhooks/doordashon your store (needs to be internet-reachable —ngrok/cloudflaredfor local dev).
Access keys created before requesting production access are Sandbox-only — you can build and fully test this extension's entire flow (quotes, dispatch, status webhooks, DoorDash's own Delivery Simulator) without ever needing production approval.
Setting up a DoorDash Delivery shipping method
-
Map each fulfilling stock location to a DoorDash store:
bin/rails "spree_doordash:map_location[stock_location_id_or_name,doordash_store_id,doordash_business_id]"doordash_business_iddefaults to"default"— DoorDash Sandbox auto-assigns a default business/store to every access key, so that's normally all you need there. -
In Settings → Shipping Methods, create a new shipping method (e.g. "DoorDash Delivery") with calculator DoordashQuote, attached to whichever zone/shipping category your delivery orders use.
Spree::Stock::Estimatorpicks it up automatically — no further wiring needed; any code path that estimates shipping rates for an order (checkout, admin, API) will now request a live quote for that rate whenever the order has a ship address.
Development
bundle install
bundle exec rake test_app # generates spec/dummy
bundle exec rspec
When testing your application's integration with this extension you may use its factories. Simply add this require statement to your spec_helper:
require 'spree_doordash/factories'
Releasing a new version
bundle exec gem bump -p -t
bundle exec gem release
For more options please see gem-release README
Contributing
If you'd like to contribute, please take a look at the instructions for installing dependencies and crafting a good pull request.