-
Notifications
You must be signed in to change notification settings - Fork 0
Order
Placing order involves two steps:
Note: You should have an active checkout session. Read more about checkout session
Methods | Returns Promise | Description |
---|---|---|
addCoupon |
NO | Add coupon code to your order |
removeCoupon |
NO | Remove coupon code to your order |
setAddress |
NO | Set address to your order |
makeBill |
YES | Prepare bill to place an order |
placeOrder |
YES | Place order |
- To add coupon, call
c.addCoupon({coupon:<coupon code>, phone:<phone no>})
Phone is required, if user is not loggedin.
- To remove the coupon from your order, call
c.removeCoupon()
Note: After adding/removing coupon you have to call makeBill()
.makeBill()
Important: The bill object will contain the available payment options for that specific order. User should not be allowed to select any other payment option while placing an order.
However, this values can be overridden by passing the obj in .makeBill
.
c.makeBill
will always have to be called before calling placing order.
c.makeBill
will return the bill which includes all required information that can be shown in UI.
Note: charges, total, taxes should not be calculated client-side. Information will be available in the response of c.makeBill
. Or the last generated bill can be accessed by calling .getBill
.setAddress(param)
If fulfillment mode is delivery
you must provide a valid address:
You can call c.setAddress(param)
where params can be:
Read more about user addresses
For logged in user param is {address_id}
:
{
address_id:<address_id>
}
For guest user the param is:
{
address_1:<address line 1>,
address_2:<address line 2 | Optional>,
sub_locality: <sub locality>,
city: <city>,
pin: <pin | Optional>,
lat: <latitude | Optional>,
lng: <longitude | Optional>
}
placeOrder(params)
Params:
{
phone: <phone no>,
payment_option: <cash | prepaid | payment_gateway>,
delivery_datetime: <timestamp>,
instructions: <instructions>
}
Important :
- If the user is not logged in or the user is not registered, guest checkout can be enabled for the phone no. - Guest checkout
- How to use Payment gateway.
How to handle delivery time:
There are two types of deliverable time:
-
Slot based time (i.e. 12:30pm - 3:30pm)
Pass the day in milliseconds indelivery_datetime
.
Set start time intime_slot_start
end time intime_slot_end
and in the formathh:mm:ss
{
phone: <phone no>,
payment_option: <cash | prepaid | payment_gateway>,
delivery_datetime: <timestamp>,
instructions: <instructions>,
time_slot_start: "10:00:00",
time_slot_end: "12:30:00"
}
Time slots are part of store object. Refer store
-
Specific time (i.e. 4.30pm)
Pass the time in milliseconds indelivery_datetime
.
Note: delivery_datetime
is a mandatory field for both specific delivery time or slot based delivery time.