Skip to main content

Webhook & Callback flow

Authentication Method

Ahamove support 3 types of authorization header (API-KEY, BEARER-TOKEN, BASIC-AUTH)

API Key

Partners put the API key in the Authorization header

Header: { apikey: "auth_token" }

Ex: { "apikey": "KJhb4seu82dHe3hkDgyU7mQoh5AB1o" }

Bearer Token

Partners send the token in the Authorization header when making requests to protected resources

Header: { Authorization: "Bearer + auth_token" }

Ex: { "Authorization": "Bearer KJhb4seu82dHe3hkDgyU7mQoh5AB1o"}

Basic Auth

With this method, Partners place a username: password into the request header. The username and password are encoded with Base64

Header: { Authorization: "Basic {b64.StdEncoding.EncodeToString([]byte({username}:{password})}" }

Ex: { "Authorization": "Basic KJhb4seu82dHe3hkDgyU7mQoh5AB1o"}

Callback Flow

image.jpeg

Sample Callback

{
"_id": "22VMV54W",
"accept_time": 0,
"board_time": 0,
"cancel_by_user": false,
"cancel_comment": "",
"cancel_image_url": "",
"cancel_time": 0,
"city_id": "SGN",
"complete_time": 0,
"create_time": 1665742305.9305305,
"currency": "VND",
"order_time": 1665742305.9305305,
"partner": "",
"path": [
{
"address": "725 Hẻm số 7 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh, Việt Nam",
"cod": 0,
"por_info": "",
"short_address": "Quận 10",
"formatted_address": "",
"mobile": "09xxxxxxxx",
"status": "",
"complete_lat": 0,
"complete_lng": 0,
"fail_lat": 0,
"fail_lng": 0,
"complete_time": 0,
"fail_time": 0,
"return_time": 0,
"pod_info": "",
"fail_comment": "",
"name": "Anh",
"remarks": "call me"
},
{
"address": "Chợ Bến Thành, Bến Thành, Quận 01, Hồ Chí Minh, Việt Nam",
"cod": 0,
"por_info": "",
"short_address": null,
"formatted_address": "",
"mobile": "09xxxxxxxx",
"status": "",
"complete_lat": 0,
"complete_lng": 0,
"fail_lat": 0,
"fail_lng": 0,
"complete_time": 0,
"fail_time": 0,
"return_time": 0,
"pod_info": "",
"fail_comment": "",
"name": "Bao"
}
],
"payment_method": "CASH",
"pickup_time": 0,
"service_id": "SGN-BIKE",
"status": "ASSIGNING",
"sub_status": "",
"supplier_id": "",
"supplier_name": "",
"surcharge": 1.1,
"user_id": "",
"user_name": "",
"total_pay": 32000,
"promo_code": "",
"stoppoint_price": 0,
"special_request_price": 0,
"vat": 0,
"distance_price": 32000,
"voucher_discount": 0,
"subtotal_price": 32000,
"total_price": 32000,
"surge_rate": 1.1,
"api_key": "<API_KEY_STG>",
"shared_link": "https://cloudstg.ahamove.com/share-order/22VMV54W/84911434061",
"app": "Ahamove",
"store_id": 0,
"distance": 4.68
}

Your app will need to provide a webhook URL to receive order updated events from Ahamove. Ahamove will call this API each time the order has updates. For example, Ahamove will call POST below url when a supplier completes the order

http://example.com/partner/update_ahamove_status

How to test Webhook

  1. Implement webhook url to receive order_id & status, then send Ahamove the URL to config
  2. Use this link download to install Ahamove Driver staging app on Android device
  3. Register an account, then login and go online
  4. Use above order/create API to create an order within 1km from the supplier location
  5. The supplier app will receive a notification, click on the notification to accept the order
  6. Ahamove server will trigger an event to webhook URL from ACCEPTED status
  7. Try to Complete on the supplier app, Ahmove server will trigger events to webhook URL with according order statuses