Biteship API Integration

biteship.com/docs

I’ve integrated Biteship API into both web and mobile platforms — enabling real-time delivery rate calculation and instant courier booking based on live coordinates.

This is especially useful in food delivery scenarios, where precision, speed, and low-friction checkout are essential.


📦 Use Case: Real-Time Instant Courier Integration

1. Courier Rate Checker (/rates/couriers)

A backend API route that calculates delivery fees between two pinned coordinates:

const response = await fetch('https://api.biteship.com/v1/rates/couriers/', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BITESHIP_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    origin_latitude: origin_lat,
    origin_longitude: origin_lng,
    destination_latitude: destination_lat,
    destination_longitude: destination_lng,
    couriers: 'gojek,grab,borzo,lalamove,rara',
    items: [
      {
        name: 'Order ',
        value: 50000,
        weight: 1000,
        quantity: 1,
        description: 'Food Delivery',
        length: 20,
        width: 20,
        height: 10,
      },
    ],
  }),
})

✅ Supports dynamic input
✅ Courier list customizable
✅ Integrated into checkout flow

2. Create Delivery Order (/orders)

A backend endpoint to place delivery requests directly to Biteship once user confirms checkout:

const response = await fetch('https://api.biteship.com/v1/orders', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BITESHIP_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    origin_contact_name: 'Store Name',
    origin_contact_phone: '0851......',
    origin_address: 'Jakarta',
    origin_coordinate: {
      latitude: process.env.NEXT_PUBLIC_ORIGIN_LAT,
      longitude: process.env.NEXT_PUBLIC_ORIGIN_LNG,
    },
    destination_contact_name: payload.destination.name,
    destination_contact_phone: payload.destination.phone,
    destination_address: payload.destination.label,
    destination_coordinate: {
      latitude: payload.destination.lat,
      longitude: payload.destination.lng,
    },
    courier_company: payload.courier_company,
    courier_type: payload.courier_type,
    delivery_type: 'now',
    reference_id: payload.order_id,
    items: payload.items.map((item) => ({
      name: item.name,
      value: item.price,
      quantity: item.quantity,
      weight: item.weight ?? 500,
    })),
  }),
})

🚚 Why Biteship?

  • 📍 Live geolocation support (lat/lng)
  • 🚀 Instant delivery (delivery_type: now)
  • 🧱 Clean API structure — easy to integrate
  • 📦 Multiple courier companies in one integration

🧠 My Experience ✅ Integrated Biteship in both Next.js web apps and mobile apps
✅ Dynamically fetch rates, then place orders
✅ Firestore used to store order & delivery status
✅ Fully compatible with dynamic Google Maps pinning

📘 Related Project

This integration works alongside:

👉 Cobakso Checkout Flow
👉 Xendit Payment Integration