Webhooks

This Webhooks APIs allow developers to register a new webhook, edit the current webhook, and retrieve registered webhooks.

Callback Payload

Whenever there is a change in the Order Status/Weight, SuperShip will send an update to the Partner's System via the Callback URL that the Partner has previously set up.

Request

Parameters

FieldTypeDescription
typeStringType of update. For example: update_status.
Possible values:
- Status: update_status.
- Weight: update_weight.
codeStringSuperShip Order Code. For example: SGNS336484LM.883568271.
shortcodeStringSuperShip Short Order Code. For example: 883568271.
socStringSender's Order Code. For example: JLN-1805-1456.
phoneStringReceiver's Phone Number. For example: 01629091355.
addressStringReceiver's Address. For example: 47 Huỳnh Văn Bánh, Phường 5, Quận Phú Nhuận, Thành phố Hồ Chí Minh.
amountIntegerAmount to be collected. For example: 450000.
weightIntegerWeight of the Order. For example: 200.
fshipmentIntegerDelivery Fee. For example: 25000.
statusStringOrder Status Code. For example: 12.
status_nameStringOrder Status Name. For example: Đã Giao Hàng Toàn Bộ.
partialStringIs the order partially delivered? For example: 1.
barterStringIs the order a barter? For example: 1.
reason_codeStringReason Code. For example: 304.
reason_textStringReason Detail. For example: Không liên lạc được với Người Nhận.
created_atString- Order creation time. For example: 2018-07-03T17:18:29+07:00.
- Format ISO 8601
updated_atString- Order update time. For example: 2018-07-03T17:18:29+07:00.
- Format ISO 8601
pushed_atString- Thời Gian Đẩy Webhook. For example: 2018-07-03T17:18:29+07:00.
- Format ISO 8601

Example

curl --request POST \
  --url https://example.com/listen/supership \
  --header 'Content-Type: application/json' \
  --data '{
    "type": "update_status",
    "code": "SGNS336484LM.883568271",
    "shortcode": "883568271",
    "soc": "EG27533038-24",
    "name": "Anh Nam",
    "phone": "078882888",
    "address": "Đường Hữu Trí - Thị Trấn Tân Túc -Bình Chánh",
    "payer": "1",
    "amount": 230000,
    "weight": 800,
    "fshipment": 40000,
    "finsurance": 0,
    "status": "14",
    "status_name": "Hoãn Giao Hàng",
    "partial": "0",
    "barter": "0",
    "reason_code": "304",
    "reason_text": "Không liên lạc được với Người Nhận",
    "created_at": "2022-05-10T10:27:26+07:00",
    "updated_at": "2022-05-11T22:26:11+07:00",
    "pushed_at": "2022-05-11T22:26:11+07:00"
}'

Response

SuperShip relies on the HTTP response status code to determine whether the order update sent to the Partner System was successful. If the result is 200, SuperShip considers it a successful update.

Get Webhook Information

This API allows you to retrieve information about all the current webhooks.

Endpoint

get/v1/partner/webhooks

Request

Example

curl --request GET \
  --url https://api.mysupership.vn/v1/partner/webhooks \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <Access-Token>'

Response

Returned Result

FieldTypeDescription
urlStringThe URL to receive order updates from SuperShip. For example: https://example.com/listen/supership.
created_atString- Webhook creation time. For example: 2018-07-03T17:18:29+07:00.
- Format ISO 8601
updated_atString- Webhook update time. For example: 2018-07-03T17:18:29+07:00.
- Format ISO 8601

Example

{
    "status": "Success",
    "results": {
        "url": "https://example.com/listen/supership",
        "created_at": "2017-09-29 01:52:09",
        "updated_at": "2017-09-29 02:08:28"
    }
}

Create Webhook

This API allows you to create a new webhook.

DID YOU KNOW

For orders belonging to E-commerce Partners, Software Partners, and other major partners, the Automatic Webhook applies to orders that have filled in the Partner Code when creating orders through the API Channel. Therefore, there is no need to use this API to manually add a webhook for each user.

TIPS & NOTES

  • To change the current webhook, you just need to use this API with the new value.
  • Orders created after the successful webhook change will apply the new webhook.

Endpoint

post/v1/partner/webhooks/create

Request

Parameters

FieldRequiredTypeDescription
urlYesStringThe URL that the partner wants to receive order update information from SuperShip. For example: https://example.com/listen/supership.

Example

curl --request POST \
  --url https://api.mysupership.vn/v1/partner/webhooks/create \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <Access-Token>' \
  --header 'Content-Type: application/json' \
  --data '{
	"url": "https://example.com/listen/supership"
}'

Response

Returned Result

FieldTypeDescription
urlStringThe URL to receive order updates from SuperShip. For example: https://example.com/listen/supership.
created_atString- Webhook creation time. For example: 2018-07-03T17:18:29+07:00.
- Format ISO 8601
updated_atString- Webhook update time. For example: 2018-07-03T17:18:29+07:00.
- Format ISO 8601

Example

{
  "status": "Success",
  "results": {
    "url": "https://example.com/listen/supership",
    "created_at": "2017-09-29 01:52:09",
    "updated_at": "2017-10-13 00:09:18"
  }
}
Last Updated: 5/6/2023, 4:28:03 PM