Book a service
https://api.nexgapp.com/v1/ordersComing soonNot served yet
This endpoint is designed but not live. Nothing here works against api.nexgapp.com today; the request and response below are the planned shape and may change. It will appear in the changelog when it ships.
Designed for a business that books NexG services for its own guests: a hotel or tour company booking an airport transfer, for example. The database function behind it exists; the HTTP route is not served yet, so a POST to /v1/orders returns 405 today.
You say what and how many; NexG works out the price from its fee settings, the same way checkout does. A request can never state a price. The total is frozen on the order when it is placed.
Every booking needs an Idempotency-Key header. A retry with the same key returns the first answer instead of booking twice.
- Authentication
- API key with
merchant_write, bound to your merchant - Rate limit cost
- 5 tokens
- Caching
- Never cached
- Status
- Coming soon
Headers
X-Api-Keyheader · stringRequiredA key bound to your merchant, with merchant_write.
Idempotency-Keyheader · stringRequired16 to 128 characters, unique per booking. Reuse it only to retry the same booking.
Content-Typeheader · stringRequiredapplication/json
Request body
Booking request, sent as JSON.
servicestringA service code from GET /v1/services.
quantityintegerHow many units, 1 to 60. Defaults to 1. For a transfer, passengers.
pickup_labelstringWhere to collect from. Needed for a ride or a courier.
pickup_latnumberPickup latitude.
pickup_lngnumberPickup longitude.
dropoff_labelstringWhere to go. Needed for a ride or a courier.
dropoff_latnumberDrop-off latitude.
dropoff_lngnumberDrop-off longitude.
scheduled_fortimestampWhen, with a UTC offset. Leave it out for as soon as possible.
passengersarrayUp to 60 of { name, phone, flight } for the people travelling.
payment_methodstringon_account (the default), mpesa_stk or card.
notestringAnything the driver should know. Up to 1,000 characters.
Response
Receipt body
okbooleanAlways true on a receipt.
order_iduuidNexG’s id for the new order.
referencestringThe reference people read.
servicestringThe service code you booked.
quantityintegerHow many units.
total_centsintegerWhat it cost, in cents, priced by NexG from its fee settings. A caller never sets a price.
currencystringAlways KES.
payment_methodstringHow it will be paid.
scheduled_fortimestamp or nullWhen it is booked for, if scheduled.
Good to know
- The planned request and receipt are shown, taken from ServiceBooking and BookingReceipt in @nexg/contracts/api. They may change before the route ships. The amount is illustrative.